cloudflare/agents-starter#154's strongest UX pattern: a delegated agent run is simultaneously (1) a normal tool call in the parent transcript, (2) a retained child with its own persisted history, (3) live run events keyed by toolCallId (useAgentToolEvents → runsByToolCallId), and (4) a readonly drill-in panel ("Readonly drill-in. Follow up in the main chat").
This maps directly onto our sandbox-as-tool: a sandbox session referenced by id IS a retained subagent. Instead of dumping stdout into the chat, the tool chip should expand into a drill-in transcript of the sandbox session (commands, outputs, files touched).
Pieces:
- agent-app: a run-events contract — loop emits
tool_run progress events keyed by toolCallId; products persist run transcripts keyed by (threadId, toolCallId).
- web-react:
ToolRunChip + readonly RunDrillIn panel components consuming those events.
- Fail-closed child access like their
onBeforeSubAgent: clients may only attach to run ids the server-side loop created (matches our "trusted context never from tool args" invariant).
Also worth adopting from the same PR, smaller: out-of-band broadcast for async completions (e.g. "training run finished" as a toast, never injected into chat history — their comment notes injecting causes the model to loop on the notification), and workspace-scoped shared MCP/integration connections proxied into per-chat toolsets with descriptor caching (they re-discover MCP tools synchronously before every message — flagged in their own PR as a flaw).
🤖 Generated with Claude Code
cloudflare/agents-starter#154's strongest UX pattern: a delegated agent run is simultaneously (1) a normal tool call in the parent transcript, (2) a retained child with its own persisted history, (3) live run events keyed by
toolCallId(useAgentToolEvents→runsByToolCallId), and (4) a readonly drill-in panel ("Readonly drill-in. Follow up in the main chat").This maps directly onto our sandbox-as-tool: a sandbox session referenced by id IS a retained subagent. Instead of dumping stdout into the chat, the tool chip should expand into a drill-in transcript of the sandbox session (commands, outputs, files touched).
Pieces:
tool_runprogress events keyed by toolCallId; products persist run transcripts keyed by (threadId, toolCallId).ToolRunChip+ readonlyRunDrillInpanel components consuming those events.onBeforeSubAgent: clients may only attach to run ids the server-side loop created (matches our "trusted context never from tool args" invariant).Also worth adopting from the same PR, smaller: out-of-band
broadcastfor async completions (e.g. "training run finished" as a toast, never injected into chat history — their comment notes injecting causes the model to loop on the notification), and workspace-scoped shared MCP/integration connections proxied into per-chat toolsets with descriptor caching (they re-discover MCP tools synchronously before every message — flagged in their own PR as a flaw).🤖 Generated with Claude Code