Claude Agent SDK agentic chat example
npm install @cloudbase/agent-examples-claude-agent-agentic-chatThis example demonstrates how to use Claude Agent SDK with AG-Kit for a simple conversational chatbot.
- Claude Agent SDK Integration: Uses the official Claude Agent SDK
- Built-in Tools: Leverages Claude's powerful built-in tools (Bash, File Operations, Web tools, etc.)
- Permission Management: Fine-grained control over tool execution
- MCP Support: Model Context Protocol for extending capabilities
- AG-Kit Compatible: Integrates seamlessly with AG-Kit server infrastructure
```
claude-agent/agentic-chat/
├── src/
│ ├── agent.ts # Agent creation logic
│ └── index.ts # Export entry point
├── package.json
├── tsconfig.json
├── tsup.config.ts
└── README.md
This package is designed to be imported by the AG-Kit server. The agent factory is exposed via:
`typescript
import { createAgent } from "@cloudbase/agent-examples-claude-agent-agentic-chat";
const agent = createAgent();
`
The agent is configured through environment variables:
- ANTHROPIC_API_KEY: Your Anthropic API key (required)CLAUDE_MODEL
- : Claude model to use (default: claude-3-5-sonnet-20241022)
- auto: Execute tools automatically with permission checkingask
- : Always ask user before executing toolssilent
- : Execute tools without notificationsdisable
- : Disable all tool execution
Claude Agent SDK includes powerful built-in tools:
- Bash: Execute shell commands
- File Operations: Read, write, edit files
- Glob: Find files by pattern
- Grep: Search file contents
- Web Fetch: Fetch web content
- Web Search: Search the web
`bash`
pnpm build
This will compile the TypeScript code to the dist` directory.
- Claude Agent SDK Documentation
- AG-Kit Documentation
- Model Context Protocol (MCP)