feat(#4556): AG-UI serve — AgUiServer.from(agent)#226
Merged
Conversation
…2.7) The fourth agentic-web serve surface (agent↔user/frontend) beside McpServer (agent↔tools), A2AServer (agent↔agent), and NlWebServer (agent↔web-content). - AgUiServer.from(agent): POST a RunAgentInput -> SSE stream of typed AG-UI events. The last user message is the agent input; runs agent.session(input) and pipes its AgentEvent stream through the bridge. Same from(agent) loopback + bearer posture as the other serve surfaces; hand-rolled SSE over JDK HttpServer, no AG-UI SDK (the community JVM SDKs are client-side only). - AgUiEventBridge: AgentEvent -> AG-UI events in the RUN_STARTED…RUN_FINISHED envelope. Token -> TEXT_MESSAGE_START/CONTENT/END, ToolCall* -> TOOL_CALL_START/ARGS/END, Skill* -> STEP_STARTED/FINISHED, Failed -> RUN_ERROR. Holds the text-message state machine that guarantees AG-UI ordering (text closes before any tool call / step finish / run end); a non-streamed final output is surfaced as one text message. - New package agents_engine.agui (core; no external deps -> uses internal McpJson/ LenientJsonParser). 6 tests (bridge mapping + in-process SSE round trip). - README/CHANGELOG/PRD §12.7/internals adjunct updated. agents.kt now serves the agentic web four ways: MCP, A2A, NLWeb, AG-UI. Follow-ups: STATE/REASONING families, client-tool round-trips. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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
AG-UI serve side (#4556, epic #4523, PRD §12.7) — the fourth agentic-web serve surface (agent↔user/frontend) beside
McpServer(agent↔tools),A2AServer(agent↔agent), andNlWebServer(agent↔web-content). The only one that reaches an end-user UI (e.g. a CopilotKit React chat) without us building a frontend.What landed
AgUiServer.from(agent)— not a descriptor exporter, a runtime streaming surface:POSTan AG-UIRunAgentInput→ SSE stream of typed events. The lastusermessage is the agent input; runsagent.session(input)and pipes theAgentEventstream out live. Samefrom(agent)shape, loopback-only (127.0.0.1), optional bearer, gateway-for-network posture as the other serve surfaces. Hand-rolled SSE over the JDKHttpServer— no AG-UI SDK (community JVM SDKs are client-side only).AgUiEventBridge—AgentEvent→ AG-UI events in theRUN_STARTED … RUN_FINISHEDenvelope:Token→TEXT_MESSAGE_START/CONTENT/END,ToolCall*→TOOL_CALL_START/ARGS/END,Skill*→STEP_STARTED/FINISHED,Failed→RUN_ERROR. Holds the text-message state machine that guarantees AG-UI ordering (text closes before any tool call / step finish / run end); a non-streamed final output is surfaced as one text message.agents_engine.agui(core; no external deps).Gates
6 tests (bridge mapping incl. text+tool families + in-process SSE round trip with a real agent). Full
./gradlew buildgreen (detekt + DocsConsistency + internals-adjunct validation). README + CHANGELOG + PRD §12.7 + internals adjunct updated.Follow-ups (epic #4523): STATE_SNAPSHOT/STATE_DELTA (needs a shared agent↔UI state model), REASONING/THINKING, client-tool round-trips. Closes #4556.
🤖 Generated with Claude Code