pub enum Request {
Show 16 variants
Submit {
text: String,
},
Notify {
content: String,
},
Interrupt {
content: String,
},
Wake {
content: String,
},
Cancel,
SetModel {
model: String,
},
SetEffort {
effort: Option<String>,
},
Compact {
instructions: Option<String>,
},
SetPlanMode {
on: bool,
},
SideAsk {
text: String,
},
GetHistory,
Status,
ListSessions,
ListModels,
Define {
name: Option<String>,
model: Option<String>,
role: Option<String>,
tools: Option<Vec<String>>,
base_url: Option<String>,
api_key: Option<String>,
read_only: bool,
effort: Option<String>,
},
Unknown,
}Expand description
Inbound intent: the requests a session’s mailbox accepts.
Every variant maps one-to-one onto an existing crate::agent::Agent
method, so the current session behavior is expressible without the actor
inventing anything new:
Request | today |
|---|---|
Submit | Agent::run |
Notify | Agent::notify (append, no turn) |
Interrupt | Agent::steer |
Wake | run — a turn even when idle |
Cancel | Agent::cancel |
SetModel | Agent::set_model |
SetEffort | Agent::set_effort |
Compact | Agent::compact |
The one exception is Request::ListSessions: a transport-level probe the
server answers, not an Agent method.
Inbound payloads carry user content, not an AgentMessage: a remote peer
must not be able to inject an Assistant/ToolResult message and impersonate
the model. The session wraps content as a user message, exactly as
Agent::run does. GetHistory is a read: it carries no payload and its
answer comes back as AgentEvent::History
(with the other replies — AgentEvent::Ack,
and AgentEvent::Error — alongside it).
These reply variants are never streamed: they answer a specific request,
which the transport correlates (an in-process oneshot today, the envelope’s
reply_to on the wire).
Variants§
Submit
Start a turn: persist the text as a user message and run the loop until
it stops. The run’s progress and result stream back as AgentEvents.
Notify
Append content to the conversation without starting a turn (recorded
now if idle, or at the next turn boundary if a run is in flight). The
“tell, don’t ask” delivery mode — Agent::notify.
Interrupt
Inject content at the next turn boundary of the in-flight run — a soft
interrupt that does not cancel the run. Formerly Steer; "steer"
still deserializes here.
Wake
Wake the session: run content as a turn even if it is idle (mid-run
it rides the follow-up channel instead). Formerly FollowUp;
"follow_up" still deserializes here.
"follow_up" still deserializes here.
Cancel
Cancel the in-flight run (and any retry/backoff wait). Idempotent.
SetModel
Swap the model for subsequent turns.
SetEffort
Set the reasoning effort, or clear it (None = send nothing).
Compact
Summarize the older prefix of the conversation now, optionally focused
by instructions.
SetPlanMode
Toggle plan mode. The actor flips the agent’s shared PlanModeHandle
(removing mutating tools + mutating bash) and recomposes the system
prompt. Infallible — replies AgentEvent::Ack.
SideAsk
Ask a side question (/btw): answer text tool-free, from the current
context, WITHOUT recording it. A read — carries user content, names no
AgentMessage (see the enum doc above). Reply:
AgentEvent::SideAnswer. A SideAsk arriving mid-run is answered from
the latest turn-boundary snapshot (like GetHistory), not refused.
GetHistory
Read back the conversation so far. Reply:
AgentEvent::History.
Status
A compact read of the session’s latest activity — the text of its most
recent assistant message — WITHOUT shipping the transcript (unlike
Request::GetHistory). A member-style peek: the reply is one small
string, not the whole history. Reply: AgentEvent::Status.
ListSessions
Ask the transport for the sessions a server serves — serve order,
root first. The one request that names no Agent method: an in-process
session has no roster, so the actor answers it with AgentEvent::Ack
(like Request::Unknown); a socket server intercepts it and replies
AgentEvent::Sessions.
ListModels
Ask the transport for the model catalog the provider advertises
(streamfn::list_models). Mirrors Request::ListSessions: it names
no Agent method, so an in-process session answers it with
crate::event::AgentEvent::Ack (like Request::Unknown); a socket
server intercepts it and replies crate::event::AgentEvent::Models.
Define
Define a worker on a served peer (§8, S4). Like Request::ListSessions
it names no Agent method: a socket server intercepts it and asks an
injected handler to build a session, replying AgentEvent::Spawned with
its address (or a correlated AgentEvent::Error). Mirrors the CLI’s
worker spec, so a peer can customize the worker’s model, role, tool set,
read_only, effort, and provider. An in-process session has no
factory, so the actor answers
it with AgentEvent::Error.
Fields
Unknown
Forward-compatibility catch-all: an older peer must skip a request it does not understand rather than fail the connection.