Skip to main content

Request

Enum Request 

Source
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:

Requesttoday
SubmitAgent::run
NotifyAgent::notify (append, no turn)
InterruptAgent::steer
Wakerun — a turn even when idle
CancelAgent::cancel
SetModelAgent::set_model
SetEffortAgent::set_effort
CompactAgent::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.

Fields

§text: String
§

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.

Fields

§content: String
§

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.

Fields

§content: String
§

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.

Fields

§content: String
§

Cancel

Cancel the in-flight run (and any retry/backoff wait). Idempotent.

§

SetModel

Swap the model for subsequent turns.

Fields

§model: String
§

SetEffort

Set the reasoning effort, or clear it (None = send nothing).

Fields

§effort: Option<String>
§

Compact

Summarize the older prefix of the conversation now, optionally focused by instructions.

Fields

§instructions: Option<String>
§

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.

Fields

§on: bool
§

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.

Fields

§text: String
§

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

§name: Option<String>

The worker’s address; auto-assigned (w1, w2, …) when absent.

§model: Option<String>

Model id override; None inherits the server’s model.

§role: Option<String>

Role text appended to the worker’s system prompt.

§tools: Option<Vec<String>>

Tool allow-list; None = the full default set.

§base_url: Option<String>

Provider base URL override; None inherits the server’s.

§api_key: Option<String>

Provider API key override; None inherits the server’s.

§read_only: bool

Enforce read-only for the defined worker (D1/D2); default false.

§effort: Option<String>

Reasoning-effort override (D3); None inherits, synonyms clear.

§

Unknown

Forward-compatibility catch-all: an older peer must skip a request it does not understand rather than fail the connection.

Trait Implementations§

Source§

impl Clone for Request

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Request

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Request

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Request

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Request

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoToolOutput for T
where T: Serialize + 'static,

Source§

fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>

Convert this value without routing structured data through a string.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more