Serve a streaming agent over HTTP with Server-Sent Events.
Level: Advanced · Concept: Streaming · Needs: a model API key (DEEPSEEK_API_KEY as written; any provider works)
flowchart LR
C([curl]) -- POST /chat --> H[node:http] --> S[StreamingAgent]
S -. SSE events .-> C
- Each agent event becomes one
data:line. - The server uses only
node:http; any framework works the same way.
# Once, from the repository root
pnpm install && pnpm build
export DEEPSEEK_API_KEY=sk-...
pnpm --filter @astack-examples/http-server startThe full program is index.ts.