Repository navigation
Description
Summary
Consolidate how external systems talk to the agent. One long-lived infer daemon owns every external connection, every client speaks one event contract, and logs land in one place.
Before
Four client families reached the agent four different ways:
- Desktop app
- It spawns
infer headless --format ag-uiper prompt, derives busy state from the process, and cancels with SIGKILL. - It loads history with
infer conversations show --format json. - It runs its own copy of the extension panel protocol (
backend/src/browser_bridge.rs:chat_eventenvelope,conversation_snapshotbuilt from JSONL,request_idapprovals). - It relays
browser_commandto each child CLI's bridge on port 52790.
- It spawns
- opentask extension
- It talks to whichever
infer chatholds port 52789, through a bespokechat_eventenvelope around AG-UI. - One
RUN_STARTEDbrackets the whole connection, so the panel guesses busy state fromTOOL_CALL_START/TEXT_MESSAGE_END. - Approvals use a second dialect (
request_id/action) next to the headlessipcone (tool_call_id/approved).
- It talks to whichever
- Telegram, scheduler and heartbeat:
infer daemonspawnsinfer headlessper message or job throughinternal/platform/agentrunner. - Logs are split per process into
~/.infer/logs/<prefix>-<date>.log.
Landed so far
infer headless --serveis the session worker. It runs one AG-UI run peruser_message.infer daemonhosts the AG-UI WebSocket binding and supervises one worker per thread through thesessionsthread registry.- Browser use on the extension backend reaches the browser only through the daemon.
infer chatand a standaloneinfer headlessdial the binding asbrowserclients and start the daemon on demand. - The daemon serves generated artifacts per project on the binding's listener.
internal/protocols/aguiis a general-purpose package. It names no client, no context and no host, and its import list is closed.- The CLI speaks standard AG-UI 1.0 on the binding ([TASK] Refactor replace custom events and frames with standard AG-UI #1419), reports the extension's state ([FEATURE] Report the browser extension's state to the daemon's clients #1403) and publishes computer-use activity and the recording state ([FEATURE] Computer-use action and recording events for the desktop overlay and monitor #1404).
docs/ag-ui-output.mdis the one event reference,docs/browser-extension-protocol.mdthe daemon binding reference anddocs/daemon.mdthe hub page ([DOCS] One event and wire reference for worker stdio and the daemon WebSocket #1405). - The opentask extension speaks the binding contract (feat(bridge): connect the panel to the infer daemon AG-UI binding opentask#213) and renders per-project artifacts (fix(markdown): rewrite per-project artifact images onto the daemon route opentask#212).
- The desktop app reads the computer-use events (feat(agent): read computer-use activity and the recording state from the AG-UI stream desktop#373). feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374 drives chats through daemon threads and retires the browser bridge.
Target
desktop app ───────────┐
opentask extension ────┼── AG-UI WebSocket binding ──┐
infer chat / headless ─┘ (browser clients) ├── infer daemon ── session workers
Telegram ──── in-process client of the registry ─────┘ │ (one per thread, AG-UI over stdio)
├── scheduler and heartbeat
│ (one infer headless per job)
└── one log
infer daemonowns every external connection and a thread registry. A thread is a project dir plus a conversation id.- Each thread runs in a long-lived worker process the daemon supervises. Workers keep their own project cwd and config and crash isolation. They can move in-process later.
- One wire vocabulary on every transport. A frame with an uppercase
typeis an AG-UI event and belongs to a run. A frame with a lowercasetypeis an app frame, in either direction. Both are identical on worker stdio and on the daemon WebSocket. - Each agent turn is one run:
RUN_STARTED, then exactly oneRUN_FINISHEDorRUN_ERROR. A stopped turn ends with outcomecancelled. - Standard AG-UI first. Approvals and questions are interrupts, a prompt is a
RunAgentInput, token counts areusage, and progress is state and activity events. CUSTOM events and app frames are the last resort. - Browser use and computer use are paused the same way: the client stops the run and continues with a new one. The state of the extension connection is an app frame, because it belongs to a connection and not to a run.
- The
protocol_versionhandshake is lenient. Any valid-token hello is accepted, and clients show an "update" state on a mismatch.
Layering
internal/protocols/aguiknows the protocol and nothing else:Runwrites the events of one run, andBindingandDialare the two ends of the socket.- Each context owns what it puts on the wire.
browserowns the browser frames, the client kinds, the handshake and the extension relay.computerowns the CUSTOM events it publishes.presentation/headlessmaps agent chat events onto a run and answers the panel frames.sessionsowns the thread registry and imports no protocol. cmd/daemoncomposes them behind the binding's one handler.
Standard AG-UI first
The less of the wire that is ours, the less every client has to learn. Upstream froze spec/1.0 of ag-ui-protocol/ag-ui (schema.json and conformance/streams), and it covers most of what the CLI carried in events and frames of its own. CUSTOM is a legitimate part of AG-UI, the extension point for an application's own events, and it stays the last resort.
Rules for every ticket of this epic:
- A standard AG-UI event or field is used whenever one fits. A CUSTOM event or an app frame needs a reason the protocol cannot cover
- Every frame with an uppercase
typevalidates against the upstream schema - Every event is written between
RUN_STARTEDand the run's terminal event - What is left in CUSTOM carries a
nameand avaluethat is never absent
#1419 moves what already landed:
| Ours today | Standard AG-UI |
|---|---|
CUSTOM approval_request / approval_resolved, the approval_response frame |
Outcome interrupt with reason: "tool_call", answered by a resume entry |
CUSTOM user_question_request, the user_question_response frame |
An interrupt with reason: "input_required" and a responseSchema |
CUSTOM computer_use_paused / computer_use_resumed, the computer_use_control frame |
Stopping the run (outcome cancelled) and continuing with a new run |
CUSTOM token_usage |
usage on the terminal event, and the state key usage |
CUSTOM background_tasks, screen_recording |
State keys |
CUSTOM agent_status, judge_verdict |
ACTIVITY_SNAPSHOT |
The user_message frame |
A frame that carries a RunAgentInput |
MESSAGES_SNAPSHOT outside a run |
MESSAGES_SNAPSHOT inside a run |
What stays ours, because AG-UI has nothing for it:
- The handshake (
browser_hello,browser_hello_ack) - Opening a thread (
new_session,resume_conversation) and stopping a run (interrupt) - The panel requests and their replies (
list_*,select_model,set_mode,tool_request) - The browser commands (
browser_command,browser_result) - The state of the extension connection (
browser_extension_status)
Rollout
v0.220.0 (2026-09-30) speaks bare AG-UI on the binding, and infer chat no longer hosts the extension panel. The extension release carrying inference-gateway/opentask#213 speaks that contract, and the desktop release carrying inference-gateway/desktop#374 stops holding port 52789 and drives chats through the daemon. Browser commands are unchanged on the wire. Until those two client releases ship, the released extension and desktop app break against v0.220.0.
- [TASK] Refactor replace custom events and frames with standard AG-UI #1419 landed before the clients adopted the binding, so they implemented the contract once
- [FEATURE] Connect to the infer daemon AG-UI binding opentask#209 shipped after the CLI release, not before it
- [FEATURE] Drive agents through infer daemon instead of spawning infer headless per prompt desktop#367 and [TASK] Refactor retire the desktop browser bridge in favour of infer daemon desktop#369 land together in feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374
Decisions
infer chatstays standalone. Its in-process extension panel mirror retired, and the panel shows daemon threads.infer chatand a standaloneinfer headlessreach the browser asbrowserclients of the daemon and start it on demand.infer headlessstays for CI, scripts and infer-action. Agent-tool subagents are unchanged.- Scheduled jobs and heartbeat wake-ups keep running as one-shot
infer headlessinside the daemon. Each is one process per run either way, and no client follows a job run. - Existing issues are edited in place.
Phases
- Ground work in the CLI
- [TASK] Refactor move the browser extension socket into internal/protocols/agui behind an injected browser request #1395 Move the extension socket into
internal/protocols/aguibehind an injected browser request - [TASK] Refactor the AG-UI encoder into a per-run type shared by stdout and the WebSocket binding #1397 Split the AG-UI encoder into a per-run type, add the resume snapshot and the
cancelledoutcome - [FEATURE] Long-lived headless session worker that runs one AG-UI run per user_message #1398 Long-lived headless session worker, one AG-UI run per
user_message
- [TASK] Refactor move the browser extension socket into internal/protocols/agui behind an injected browser request #1395 Move the extension socket into
- The daemon
- [FEATURE] infer daemon hosts the AG-UI WebSocket binding and supervises session workers #1399
infer daemonhosts the AG-UI WebSocket binding and supervises session workers - [FEATURE] Route browser-use through the infer daemon's extension connection #1400 Route browser-use through the daemon's extension connection
- [FEATURE] Serve generated artifacts per project from the infer daemon's AG-UI binding #1414 Serve generated artifacts per project from the binding
- [FEATURE] Run Telegram sessions through daemon workers #1401 Run Telegram sessions through daemon workers, and start the binding without browser-use
- [FEATURE] Centralize daemon, worker, channel and connection logs #1402 Centralize daemon, worker, channel and connection logs
- [FEATURE] infer daemon hosts the AG-UI WebSocket binding and supervises session workers #1399
- Standard AG-UI
- [TASK] Refactor replace custom events and frames with standard AG-UI #1419 Replace custom events and frames with standard AG-UI
- Browser-use and computer-use events
- [FEATURE] Report the browser extension's state to the daemon's clients #1403 Report the browser extension's state to the daemon's clients
- [FEATURE] Computer-use action and recording events for the desktop overlay and monitor #1404 Computer-use action and recording events for the overlay and monitor
- Clients
- [FEATURE] Connect to the infer daemon AG-UI binding opentask#209 Connect the extension to the daemon binding
- [FEATURE] Rewrite per-project artifact images onto the daemon's /artifacts/ route in the opentask extension #1415 Rewrite per-project artifact images onto the daemon's route in the extension
- [FEATURE] Drive agents through infer daemon instead of spawning infer headless per prompt desktop#367 Drive agents through the daemon instead of spawning headless per prompt (feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374)
- [TASK] Refactor retire the desktop browser bridge in favour of infer daemon desktop#369 Retire the desktop browser bridge (feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374)
- [FEATURE] Consume computer-use action and recording events in the overlay and monitor desktop#368 Consume the computer-use events in the overlay and monitor
- Docs
- [DOCS] One event and wire reference for worker stdio and the daemon WebSocket #1405 One event and wire reference for worker stdio and the daemon WebSocket
- [DOCS] Document infer daemon as the hub for the desktop app, browser extension and Telegram docs#856 Document
infer daemonas the hub
Out of scope
- In-process sessions inside the daemon.
- A published JSON schema for the CUSTOM event values in
inference-gateway/schemas. Add it once the hand-written Rust and TypeScript decoders start to drift. - Moving
infer chatonto the daemon. - Moving scheduled jobs and heartbeat wake-ups onto session workers.
- Modelling the browser commands as AG-UI frontend tools.
- Renaming the
browser_helloandbrowser_hello_ackframes, which is a protocol version bump across the clients.
Acceptance Criteria
- Every sub-issue below is done (feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374 is the last one)
- The desktop app, the opentask extension and Telegram never spawn
infer headless(the extension and Telegram do not, the desktop app stops with feat(agent): drive chats through infer daemon threads and retire the browser bridge desktop#374) - One event reference doc covers worker stdio and the daemon WebSocket
- Daemon, worker, channel and connection logs land in the daemon log
- Every event validates against the upstream AG-UI schema, and what stays custom is the list above
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(agui): split the AG-UI encoder into a per-run type shared by std…
feat(headless): add a --serve worker that runs one AG-UI run per user…
feat(browser): report the extension's state to the daemon's clients (#…
feat(computer): publish computer-use activity and the recording frame…
docs: one event and wire reference for the daemon binding and worker …
fix(headless): run direct tasks in the serve worker without a model t…