Skip to content

docs(agent): agent protocol RFC (POST /messages, sessions, SSE streaming)#4735

Draft
mmabrouk wants to merge 2 commits into
mainfrom
docs/agent-protocol-rfc
Draft

docs(agent): agent protocol RFC (POST /messages, sessions, SSE streaming)#4735
mmabrouk wants to merge 2 commits into
mainfrom
docs/agent-protocol-rfc

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

What

Adds the normative protocol spec for the agent chat interface as a new RFC document:
docs/design/agent-workflows/agent-protocol-rfc.md. This PR contains only that file.

It specifies a new endpoint, POST /messages, that sits next to the existing workflow
/invoke (which does not change). The spec covers:

  • Sessions. An optional session_id in the request and response body, with normative
    resolution rules (mint / create-with-id / resume) scoped to (project_id, session_id).
  • Streaming. A Server-Sent Events response in the Vercel AI SDK v5/v6 "UI Message Stream"
    format, so the frontend consumes it with useChat directly. Includes the part registry,
    the mapping from our internal AgentEvents to Vercel parts, headers, framing, and a full
    example transcript.
  • Inputs. The conversation as a first-class data.messages (UIMessage shape), plus
    named variables in data.inputs.
  • POST /load-session. Returns a session's history so the client can rebuild the UI.

Written IETF-style (RFC 2119 keywords, message formats, sequence diagrams) so a frontend or
backend engineer can build against it directly.

Why

The current single request/response /invoke cannot stream an agent's work or hold a
multi-turn conversation server-side. This RFC defines the contract for both, additively,
without touching /invoke.

Notes

  • Draft, for review.
  • Docs only. No code changes.
  • The companion design doc (rationale and trade-offs), referenced as streaming-and-sessions.md,
    lands separately. Its relative link resolves once that doc is in the tree.

…reaming)

Specify a new POST /messages endpoint for the chat agent, sitting next to
the unchanged workflow /invoke. Covers an optional session_id in the
request/response body with scoped resolution rules, a Server-Sent Events
response in the Vercel AI UI Message Stream format, UIMessage inputs, and a
load-session endpoint. Written IETF-style so it can be built against directly.
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 18, 2026 7:17pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ce5dff8-8818-43bf-b3ba-2a85b115ca7f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/agent-protocol-rfc

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mmabrouk mmabrouk requested review from ardaerzin and jp-agenta June 18, 2026 15:14
ardaerzin added a commit that referenced this pull request Jun 18, 2026
…essages

Per the agent-protocol RFC (#4735), Track A (UIMessage parts) is the contract. Drop Track B, the toAgentaMessage adapter, and the A/B toggle.

- web: transport posts the RFC envelope {session_id, references?, data:{messages, parameters}} to POST /messages; single createAgentChatTransport(appId)

- example: contract_stream serves POST /messages reading data.messages; echoes session_id on start.messageMetadata; drops tool_approvals path

- docs: update frontend-agent-chat-ui 'Running the slice' (resolved A/B → Track A) + RAG_QA README

- cleanup: remove NEXT_PUBLIC_AGENT_CHAT_TRACK + run-script AGENT_CHAT_TRACK knob
Both are additive and already proven end-to-end by the agent-chat slice (this PR's companion); writing them into the spec:

- 6.2.3: tool-approval-request + tool-output-denied parts (+ preliminary flag on tool-output-available)

- 6.2.4: traceId on finish messageMetadata so the client can open the trace

- 6.2.5: AgentEvent-map rows for the before-tool-hook approval pause + traceId

- 6.2.6: new 'Tool approval (human-in-the-loop)' round-trip section; decision rides in data.messages (no new request field); marked an OPTIONAL extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants