agentd through a sandbox relay.
Constants
AgentClient
AgentClient.connect_sandbox()
Example
Example
Parameters
namestrSandbox name, up to 128 UTF-8 bytes.
timeoutfloat | NoneConnection timeout in seconds.
None uses the default.Returns
AgentClient
Connected client.
AgentClient.connect()
Example
Example
socket_path().
Parameters
pathstrPath to the agentd relay socket.
timeoutfloat | NoneConnection timeout in seconds.
None uses the default.Returns
AgentClient
Connected client.
AgentClient.socket_path()
Example
Example
agentd relay socket path without connecting. Returns the same path connect_sandbox() would dial, so you can talk to agentd over a raw byte transport (for example a transparent relay that splices bytes to and from the socket) instead of this frame client. The sandbox need not be running. Sandbox names are limited to 128 UTF-8 bytes.
Parameters
namestrSandbox name, up to 128 UTF-8 bytes.
Returns
str
Filesystem path to the relay socket.
Instance methods
client.request()
Example
Example
Parameters
flagsintFrame flag byte, e.g. a combination of
FLAG_* constants.bodybytesCBOR-encoded protocol message body.
Returns
The response frame.
client.stream()
Example
Example
AgentStream carries the protocol correlation id and is also an async iterator of raw frames.
Parameters
flagsintFrame flag byte; pass
FLAG_SESSION_START to open a session.bodybytesCBOR-encoded protocol message body.
Returns
Open streaming session.
client.send()
Example
Example
id from the AgentStream returned by stream().
Parameters
idintCorrelation id of an open session, from
stream.id.flagsintFrame flag byte.
bodybytesCBOR-encoded protocol message body.
client.ready_bytes()
Example
Example
core.ready frame body as CBOR bytes.
Returns
bytes
CBOR-encoded
core.ready frame body.client.close()
Example
Example
AgentStream
Returned by stream()
An async iterator of raw agent frames.stream.id
int
Protocol correlation id; pass to send() for follow-up frames
stream.next()
None at EOF
Returns
Awaitable[RawFrame \| None]
stream.close()
Returns
Awaitable[None]
Example
Example
Types
RawFrame
Returned by request() · yielded by AgentStream
A raw protocol frame with a CBOR-encoded body.