docs(agent): frontend round-trip design (client tools, commit refresh, connections)#4920
docs(agent): frontend round-trip design (client tools, commit refresh, connections)#4920mmabrouk wants to merge 3 commits into
Conversation
…, connections) Claude-Session: https://claude.ai/code/session_01GYo3UEfvsZpncagqb28Mbc
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
🤖 The AI agent says: What this covers. One generic client-tool round-trip: the run pauses, the playground shows the user something, the user acts, and the run resumes with the result. It applies twice: the agent changing its own config, and the agent requesting a connection that does not exist. It widens the human-in-the-loop approval flow we already ship rather than inventing a transport. Where to look. The locked decisions D1 to D5, Part 1b (the client-tool mechanism grounded in the Vercel AI SDK), and the owner split. Feedback needed (two passes). First, please confirm the overall approach. Then this goes to Arda for an approach review, since most of the work and the central new surface are his. The items that most need eyes:
|
|
🤖 The AI agent says: I rewrote this design from the first version, which was rejected for quality. The doc now turns on one idea: the human-in-the-loop round-trip we already ship is a client-tool round-trip. The runner's "forbid client tools" becomes "emit the call and park," and that single primitive carries both jobs: the agent committing its own config, and the agent requesting a connection. I re-grounded every claim against code and folded in two corrections (the platform op model has no Three items most need eyes:
Ready for Arda's approach review after Mahmoud's pass. Most of this is frontend, and the central new surface is Arda's. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/design/agent-workflows/projects/agent-fe-roundtrip/design.md (1)
349-349: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCapitalize "GitHub".
Per standard product spelling and the static analysis hint, use "GitHub" not "github".
Source: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c4fb48c6-52ac-4d0e-8eb5-c81ebfd96ed8
📒 Files selected for processing (2)
docs/design/agent-workflows/projects/agent-fe-roundtrip/design.mddocs/design/agent-workflows/projects/agent-fe-roundtrip/status.md
| unchanged from the catalog to the wire to the playground. We do not scatter it across | ||
| feature-named fields. | ||
|
|
||
| Layer A, the platform catalog (us). `request_connection` is a hard-coded platform op beside |
There was a problem hiding this comment.
This doesn't look correct because Request Connection, being a client-side tool, is not actually a platform op. Platform ops always connect to an API call, so in this case it looks like Request Connection is in fact a platform tool, just like we have platform skills that are hard-coded, which are basically workflows that are hard-coded. The way we would represent it, probably in the kind of inspect file, is that the build kit for the playground is through an embed.
This is very important here, and you need to read the other PRs we're working on and coordinate with the orchestrator to make sure that this part is clear both to you and to the other PR.
There was a problem hiding this comment.
🤖 The AI agent says: Adopted. request_connection is now a non-runnable reference tool: a hard-coded workflow embedded via @ag.embed, the same way a platform skill is embedded, which the embed resolver inlines into a browser-fulfilled client tool. It is not a platform op, because it has no method or path for the runner to call. In #4917 it appears in the agent-template overlay as a reference-tool entry, never committed. See the sections "request_connection: a non-runnable reference tool" and "Build-kit alignment."
|
|
||
| The wire envelope is identical either way. This is pure presentation, and it is Arda's call. | ||
|
|
||
| - Option U1, an inline status chip (lean). The connect interaction renders as a compact |
There was a problem hiding this comment.
🤖 The AI agent says: Acknowledged, thank you. No change needed here.
…UX, security) Claude-Session: https://claude.ai/code/session_01GYo3UEfvsZpncagqb28Mbc
| On every path the agent receives a definite result, so it can re-ask or move on rather than wait | ||
| forever. Application 2 covers the connect-specific UX of the incomplete state. | ||
|
|
||
| ## `request_connection`: a non-runnable reference tool |
There was a problem hiding this comment.
🤖 The AI agent says: Focus here. The load-bearing reframe. The key claim to confirm: an @ag.embed of a workflow tool already inlines to a browser-fulfilled client tool, so this needs no new tool shape and no new flag.
|
|
||
| ## `request_connection`: a non-runnable reference tool | ||
|
|
||
| This is the corrected model, and it follows ownership rather than transport. |
There was a problem hiding this comment.
I don't think we need all the details here in this document. Again, please don't mention past iterations of the documents within the document. We just need to say that the tool will be represented as an embed, and therefore it will follow the normal flow of things.
Context
This is the Part 2 design for the agent frontend round-trip, written for Arda to review the
approach before any frontend work starts. It is docs only.
An agent sometimes needs the human in the middle of a run. It rewrites its own config and wants
approval first. Or it needs a GitHub connection that does not exist yet, and the user must finish an
OAuth flow before the agent can continue. Both cases pause the run, show something in the playground,
wait for the user, and resume the agent with the result.
The finding that drives the design: the HITL approval flow we already ship is one half of this
round-trip, and the Vercel AI SDK ships the matching half. The runner's rule "forbid client tools"
becomes "emit the call and park." No new transport.
What the design proposes
One generic client-tool round-trip. A tool with no server execute is fulfilled by the browser.
The runner streams the call, parks the run, and waits. The playground renders a widget, the user
acts, and the result returns on the next turn as a
tool_resultkeyed to the same call. This is thepermission flow generalized: the outbound side carries any tool call, the inbound side carries any
structured output. The park, the cold-replay, and the resume stay as they are.
request_connectionas a non-runnable reference tool. The earlier draft modeled it as aplatform op. That was wrong. A platform op always binds to an HTTP method and path the runner calls,
and this tool has neither, because the browser does the work. The corrected model is a hard-coded
workflow the build kit embeds with
@ag.embed, the same way it embeds the authoring skill. The embedresolver inlines that embed into a browser-fulfilled
clienttool. So the round-trip needs no newtool shape and no new flag.
The abandon flow resolved. An unsettled tool part hangs the resume, so the widget settles the
parked call on every terminal path, including abandon. It detects a closed popup and settles a
cancel result, with a timeout backstop if no terminal signal arrives within a bound. The chip then
reads "Connection not completed" with a Retry action, and the agent gets a definite failure result
so it can re-ask or move on. It never waits forever.
Build-kit alignment with #4917.
request_connectionjoins the agent-template overlay as areference-tool entry, beside the authoring skill's
@ag.embed, and is never committed. The doc nowuses the finalized container path
additional_context.playground_build_kit.agent_template_overlay.There is no run flag and no service-side injection.
Two review fixes. The cold-replay anchor is renamed from
approvalKeyto the neutralparkedCallKey, since a client tool is not an approval gate. The connect widget must validateevent.originagainst the Agenta API origin before it trusts the OAuth callbackpostMessage,stated as a hard requirement, with a state binding as defense in depth.
Scope / risk
Docs only. No code changes. The design reuses the existing HITL park-and-resume machinery rather
than adding a transport, so the runtime risk lands at implementation time, not here. Out of scope and
recorded in the doc: the per-tool config-diff widget, runner auto-interception of a missing
connection, and the skill that teaches the discover-then-connect loop (owned by agent-skills). The
build-kit overlay itself is owned by default-agent-config (#4917); this doc references it and changes
neither.
How to QA
Read
docs/design/agent-workflows/projects/agent-fe-roundtrip/design.mdandstatus.md. Confirm theapproach reads correctly, in particular the
request_connectionreframe (the load-bearing claim thatan
@ag.embedof a workflow tool already inlines to a browser-fulfilled client tool), the abandonresolution, and the two review fixes. Inline focus-pointers mark the sections worth the most
attention.