Skip to main content

Module agent_client

Module agent_client 

Source
Expand description

lev agent-client - serve a Leviath agent over the Agent Client Protocol.

§Which protocol this is

This speaks the Agent Client Protocol: JSON-RPC 2.0, newline-delimited, over stdio. It is the protocol Zed and Gas City use to drive a headless agent as a child process - initialize / session/new / session/prompt / session/cancel, with session/update notifications streaming output back.

It is not the Agent Communication Protocol (a REST + SSE API from the BeeAI project). The two share the acronym “ACP” and nothing else. This command is the one that actually integrates Leviath with Gas City.

§How it works

lev agent-client is a thin front end over the shared-world daemon, exactly like lev run / lev serve / lev dash: it owns no agent world of its own. A session/prompt spawns (or, on later prompts, messages) an agent in the daemon over the control socket, then translates the daemon’s live WorldEvent stream and the run’s per-stage output into session/update notifications until the run finishes or parks.

The protocol logic is serve_over, which takes its reader/writer generically and erases them to trait objects internally, so the whole handshake→prompt→stream sequence is driven in tests over an in-memory duplex against a fake daemon - no process, no terminal, no real stdio.

Structs§

AgentClientArgs
Arguments for lev agent-client.

Functions§

serve_over
The protocol server. Generic over transport at the boundary, then erased to trait objects internally (see the body).