A full-stack EdgeOne Makers Agent template — streaming chat backed by the OpenAI Agents SDK (TypeScript), with custom tools and context.store-backed conversation memory.
Framework: OpenAI Agents SDK · Category: Quick Start · Language: TypeScript
A minimal, production-shaped starter that wires @openai/agents into EdgeOne Makers. Demonstrates the full chat loop — SSE streaming, custom tool registration, conversation persistence — so you can fork it and start replacing the toy tools (get_weather, get_clothing_advice, translate_text, text_statistics) with real ones.
- SSE streaming chat — token-by-token
text_deltaevents plustool_calledevents. - Custom Agent tools — four sample tools registered via
createTools(), ready to be replaced with your own. - Sticky conversation memory —
context.store.openaiSession(conversationId)plugs straight into the SDK'ssessionparameter. - Dual cancellation — frontend
AbortControllerplus backendAbortSignalinterrupts the LLM call mid-stream. - Two-folder backend — long-running stateful work in
agents/, short stateless/historyincloud-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). |
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).
Prerequisites: Node.js ≥ 18 and the EdgeOne CLI (npm i -g edgeone).
npm install
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.
openAI-agent-starter/
├── agents/ # Stateful EdgeOne Makers Agent Functions (Node/TS)
│ ├── chat/index.ts # POST /chat — SSE streaming chat
│ ├── stop/index.ts # POST /stop — abort active agent run
│ ├── _logger.ts # Logger utility (private)
│ ├── _sse.ts # SSE helpers (private)
│ └── _tools.ts # Agent tool definitions (private)
├── cloud-functions/ # Stateless EdgeOne Makers Node Functions
│ ├── history/index.ts # POST /history — load conversation messages
│ └── _logger.ts # Logger utility
├── src/ # React + Vite + TypeScript frontend
│ ├── App.tsx # Main app + SSE stream lifecycle
│ ├── api.ts # /chat, /stop, /history wrappers
│ └── components/ # ChatWindow, ChatInput, CodeViewer, ToolIndicators, ...
├── package.json # Includes @openai/agents
├── edgeone.json # framework=openai-agents-sdk
├── vite.config.ts
├── tsconfig.json
└── .gitignore
Files prefixed with
_are private modules — not exposed as public routes.
MIT.