mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
|
|
History
|
|
|---|---|---|
| .. | ||
| src | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| lint-staged.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| vitest.config.ts | ||
@mastra/claude
@mastra/claude connects Mastra to the Claude Agent SDK. Use it when you want Claude Code's agent loop, tools, permissions, and runtime configuration while exposing the agent through Mastra-compatible generate() and stream() methods.
Installation
npm install @mastra/claude
npm install @anthropic-ai/claude-agent-sdk
Usage
Set ANTHROPIC_API_KEY before creating the agent.
import { ClaudeSDKAgent } from '@mastra/claude';
import { Mastra } from '@mastra/core/mastra';
export const claudeAgent = new ClaudeSDKAgent({
id: 'claude-sdk-agent',
name: 'Claude SDK Agent',
description: 'Use Claude Agent SDK through Mastra.',
sdkOptions: {
cwd: process.cwd(),
},
});
export const mastra = new Mastra({
agents: { claudeAgent },
});
Documentation
Changelog
See the package changelog for version history and release notes.
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.