A full-stack EdgeOne Makers Agent template — streaming chat backed by the Claude Agent SDK (Python), with EdgeOne sandbox tools wired in via MCP and conversation memory persisted through context.agent.store.
Framework: Claude Agent SDK · Category: Quick Start · Language: Python
A minimal, production-shaped Python starter that wires the Claude Agent SDK into EdgeOne Makers. Demonstrates the full chat loop — SSE streaming, sandbox tool calls, conversation persistence — so you can fork it and start replacing prompts and tools instead of plumbing.
- SSE streaming chat — token-by-token
text_deltaevents, plustool_calledevents whenever the model invokes a tool. - Sandbox tools via MCP —
commands,files,code_interpreter,browserare wrapped asSdkMcpTools and registered throughcreate_sdk_mcp_server, then handed to Claude viamcp_servers. - Sticky conversation memory — Claude transcript stored in
context.store.claude_session_store(); user/assistant messages mirrored viastore.append_message()for replayable history. - Dual cancellation — frontend
AbortControllerplus backendcontext.utils.abort_active_run()so/stopactually interrupts the LLM call. - Two-folder backend — long-running stateful work in
agents/, short stateless CRUD incloud-functions/.
| Variable | Required | Description |
|---|---|---|
AI_GATEWAY_API_KEY |
Yes | Model gateway API key. Use your Makers Models API Key, or any OpenAI-compatible provider key. |
AI_GATEWAY_BASE_URL |
Yes | Gateway base URL. For Makers Models, use https://ai-gateway.edgeone.link/v1. |
AI_GATEWAY_MODEL |
No | Model ID. Defaults to @makers/deepseek-v4-flash (a free built-in model). |
WSA_API_KEY |
No | Tencent Cloud Web Search API key. Required only if you use the web-search tool. See How to get WSA_API_KEY. |
This template follows the OpenAI-compatible standard — point these at Makers Models or any compatible provider.
- Open the Makers Console.
- Sign in and enable Makers.
- Go to Makers → Models → API Key and create a key.
- Copy it into
AI_GATEWAY_API_KEY.
The built-in @makers/deepseek-v4-flash model is free with a usage cap and is suitable for prototyping. For production, bind your own paid provider (BYOK).
WSA_API_KEY is only needed when calling the web-search tool. See the documentation.
agents/_model.py also reads ANTHROPIC_API_KEY / ANTHROPIC_BASE_URL / ANTHROPIC_CUSTOM_HEADERS directly — useful if you want to call the Anthropic API instead of going through a gateway. If both sets are present, the gateway variables take precedence. Set AI_GATEWAY_SMALL_MODEL (or ANTHROPIC_SMALL_FAST_MODEL) to override the small model the SDK uses for internal sub-calls.
Prerequisites: Node.js ≥ 18, Python ≥ 3.10, and the EdgeOne CLI (npm i -g edgeone).
npm install
pip install -r agents/requirements.txt
cp .env.example .env # then fill in AI_GATEWAY_API_KEY / AI_GATEWAY_BASE_URL
edgeone makers devLocal agent metrics & traces are exposed at http://localhost:8080/agent-metrics.
claude-agent-starter-python/
├── agents/ # Stateful EdgeOne Makers Agent Functions (Python)
│ ├── chat/index.py # POST /chat — SSE streaming chat
│ ├── stop/index.py # POST /stop — abort active agent run
│ ├── _model.py # Model & gateway env config (private)
│ ├── _logger.py # Logger utility (private)
│ ├── config.json # Route config
│ └── requirements.txt # Python agent dependencies
├── cloud-functions/ # Stateless EdgeOne Makers Python cloud functions
│ ├── history/index.py # POST /history — load conversation messages
│ ├── conversations/index.py # POST /conversations — list a user's conversations
│ ├── clear-history/index.py # POST /clear-history — clear messages of one conversation
│ ├── delete-conversation/index.py # POST /delete-conversation — delete a conversation entirely
│ ├── _logger.py # Logger utility
│ ├── _redact.py # Sensitive-field redactor for logs
│ └── requirements.txt # Python cloud-function dependencies
├── src/ # React + Vite + TypeScript frontend
│ ├── App.tsx # Conversation ID + SSE stream orchestration
│ ├── api.ts # /chat, /stop, /history, ... wrappers and SSE parser
│ └── components/ # ChatWindow, ChatInput, CodeViewer, ToolIndicators, ...
├── package.json # Frontend dependencies
├── edgeone.json # EdgeOne deployment config
├── .env.example # Environment variables template
├── vite.config.ts
└── tsconfig.json
Files prefixed with
_are private modules — not exposed as public routes.
MIT.