Refactor agent starter for multi-chat helper agents#154
Open
threepointone wants to merge 1 commit into
Open
Conversation
Rework the starter from a single chat agent into a richer launch point for multi-chat agent applications. The app now has an Inbox root agent that owns chat metadata and shared MCP configuration, per-chat Chat subagents for independent conversations, and retained Researcher/Planner helper agents exposed through agentTool. The UI now includes a multi-chat sidebar, contained Suspense boundaries for chat and drill-in loading, inline helper run cards, markdown-rendered tool/helper output, and readonly helper drill-in panels. The React code is split into focused components for the app shell, active chat pane, MCP panel, and tool/drill-in rendering so the starter is easier to understand and customize. Update the server-side implementation with clearer helper-agent and subagent access guard comments, remove the old data URL workaround and aggressive message pruning, and keep full message history by default for easier starter behavior. Shared MCP tool descriptors are proxied from Inbox into each Chat so external tools can be configured once and reused across conversations. Refresh the README to document the new architecture, customization paths, helper-agent workflow, shared MCP behavior, Durable Object routing, long-conversation guidance, and updated project structure. Regenerate Wrangler environment types to match the current root Inbox binding. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the starter from a single chat-agent example into a richer multi-chat launch point for building agent applications on Cloudflare.
The new architecture is centered around an
Inboxroot agent that owns app-level state and shared MCP configuration. Each conversation is represented by aChatsubagent, and focused helper agents such asResearcherandPlannerare exposed throughagentToolso the main assistant can delegate work while preserving inspectable helper transcripts.What changed
Inbox,Chat,Researcher, andPlanneragents.Inboxlevel and proxied MCP tools into eachChatso external tools can be configured once and reused across conversations.src/app.tsxfor the app shell, header, inbox connection, and chat sidebar.src/components/active-chat.tsxfor the chat pane, composer, attachments, messages, and scheduling toasts.src/components/mcp-panel.tsxfor shared MCP server controls.src/components/tool-views.tsxfor tool cards, helper run cards, markdown output, and readonly drill-in panels.src/constants.tsfor shared starter constants.wrangler.jsoncand regeneratedenv.d.tsfor the rootInboxDurable Object binding.Why
The starter is meant to be a launching point. The previous shape demonstrated a capable single chat agent, but it did not clearly show how to build a multi-chat app, delegate work to retained subagents, share MCP tools across conversations, or inspect helper-agent runs. This refactor keeps the demo approachable while giving users a more realistic foundation for production agent apps.
Test plan
npm run checksuccessfully.npx vite buildsuccessfully.npm run types.Notes for reviewers
Inboxis the only directly bound Durable Object inwrangler.jsonc;Chat,Researcher, andPlannerare reached as subagents through the Agents SDK routing layer.Made with Cursor