Skip to main content
Run a Claude agent for each incoming message and deliver its answer as chat bubbles. Your agent keeps its tools; Flow handles the channel connection.

How it fits

  • reply() reads the query() iterator: with includePartialMessages it sends text as it streams, otherwise each assistant message’s text. Tool calls, results and system messages are not sent to the person.
  • Each assistant turn becomes its own bubble, which reads naturally in chat (“Let me check that…” then the answer).
  • tools: [] turns off Claude Code’s built-in tools, which a customer-facing agent should not have by default; allowedTools only pre-approves tools and does not restrict them.
  • Keep one Claude session per Flow conversation (conversation.id) to carry context between messages: remember each run’s session_id and pass it as resume next time (the full example does this).
  • Your production agent talks to Flow through the SDK or HTTP. The hosted MCP server is a separate build-time tool for coding agents; whether a project adds it is the project owner’s decision.
  • To see each turn’s model and tool calls and get every reply graded, send this agent’s traces to Flow Observe: Traces from agent frameworks.

Full example

examples/claude-agent-sdk on GitHub.