feat: ActionAgent DO with tool-use chat via Agents SDK - #75
Conversation
Integrate Cloudflare Agents SDK to provide a persistent conversational agent with financial tool-use and ChittyStorage document access. Each authenticated user gets an isolated DO instance with auto-persisted chat history in SQLite. - ActionAgent (AIChatAgent<Env>) with Workers AI (Llama 3.3 70B) - 7 financial tools: snapshot, obligations, disputes, recommendations, approve_action, legal deadlines, cashflow projections - 4 storage tools: search, classify, list entity docs, ingest (proxied to storage.chitty.cc MCP endpoint) - Mounted at /agent/* behind existing authMiddleware - Upgraded zod v3 → v4 (required by agents SDK, backward compatible) - Added deps: @cloudflare/ai-chat, hono-agents, workers-ai-provider, ai@6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
chittycommand-ui | f85414e | Mar 29 2026, 05:36 AM |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
|
To use Codex here, create a Codex account and connect to github. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughA new AI-powered agent system is introduced with multi-turn conversation support, integrating Cloudflare Workers AI and Durable Objects. The system includes database-backed financial tools for querying obligations, recommendations, and cashflow, plus remote document storage tools via an MCP client. Agent middleware is configured for authenticated access to the agent endpoint. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ActionAgent
participant SystemPrompt
participant WorkersAI
participant Database
participant StorageMCP
Client->>ActionAgent: POST /agent/* (chat message)
ActionAgent->>Database: getDb() connection
ActionAgent->>SystemPrompt: buildSystemPrompt(sql)
SystemPrompt->>Database: Query financial data<br/>(cash, obligations, disputes, deadlines)
Database-->>SystemPrompt: Financial snapshot
SystemPrompt-->>ActionAgent: Dynamic system prompt
ActionAgent->>WorkersAI: createWorkersAI(llama-3.3-70b)
ActionAgent->>ActionAgent: convertToModelMessages(history)
ActionAgent->>WorkersAI: streamText(prompt, tools, history)
WorkersAI->>WorkersAI: Generate response with tool calls
WorkersAI->>Database: Tool execution (financial tools)
Database-->>WorkersAI: Query results
WorkersAI->>StorageMCP: Tool execution (storage tools)
StorageMCP-->>WorkersAI: MCP response
WorkersAI-->>ActionAgent: Streamed text + tool results
ActionAgent-->>Client: toUIMessageStreamResponse()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
ActionAgentDurable Object using Cloudflare Agents SDK (AIChatAgent) with Workers AI (Llama 3.3 70B)storage.chitty.cc/mcp)/agent/*behind existingauthMiddleware@hono/zod-validatorsupports both)Test plan
npm run typecheckpasses (verified locally)npm run devstarts,/healthstill responds/agent/ActionAgent/{userId}connects and streams tool-use responses/api/*) and MCP (/mcp) unaffected🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores