pub struct SendRequest {Show 13 fields
pub agent_mode: Option<SendAgentMode>,
pub attachments: Option<Vec<Value>>,
pub billable: Option<bool>,
pub display_prompt: Option<String>,
pub mode: Option<SendMode>,
pub prepend: Option<bool>,
pub prompt: String,
pub request_headers: Option<HashMap<String, String>>,
pub required_tool: Option<String>,
pub response_format: Option<SendRequestResponseFormat>,
pub traceparent: Option<String>,
pub tracestate: Option<String>,
pub wait: Option<bool>,
/* private fields */
}Expand description
Parameters for sending a user message to the session
Experimental. This type is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases.
Fields§
§agent_mode: Option<SendAgentMode>The UI mode the agent was in when this message was sent. Defaults to the session’s current mode.
attachments: Option<Vec<Value>>Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message
billable: Option<bool>If false, this message will not trigger a Premium Request Unit charge. User messages default to billable.
display_prompt: Option<String>If provided, this is shown in the timeline instead of prompt
mode: Option<SendMode>How to deliver the message. enqueue (default) appends to the message queue. immediate interjects during an in-progress turn.
prepend: Option<bool>If true, adds the message to the front of the queue instead of the end
prompt: StringThe user message text
request_headers: Option<HashMap<String, String>>Custom HTTP headers to include in outbound model requests for this turn. Merged with session-level provider headers; per-turn headers augment and overwrite session-level headers with the same key.
required_tool: Option<String>If set, the request will fail if the named tool is not available when this message is among the user messages at the start of the current exchange
response_format: Option<SendRequestResponseFormat>Provider-native output format for this turn, including all tool-call iterations. Not inherited by later turns or subagents. Ordinary steering inherits the active format; specifying responseFormat with mode: immediate is an error, even while idle. Returned assistant content remains text; the runtime does not parse or validate it. Unsupported models or schemas produce provider errors.
traceparent: Option<String>W3C Trace Context traceparent header for distributed tracing of this agent turn
tracestate: Option<String>W3C Trace Context tracestate header for distributed tracing
wait: Option<bool>If true, await completion of the agentic loop for this message before returning. Defaults to false (fire-and-forget). When true, the result still contains the same messageId; the caller can rely on the agent having processed the message before the call resolves. Transport-dependent tail semantics: on a LOCAL (in-process) session the wait additionally blocks until the completed turn’s event tail has been dispatched to this session’s in-process subscribers, so a subsequent read of subscriber state already reflects the turn; on a REMOTE session the wait resolves once the loop completes and mirrored delivery follows over the wire. Callers that need the stronger local guarantee on remote sessions should await the event stream explicitly.
Implementations§
Source§impl SendRequest
impl SendRequest
Sourcepub fn with_source(self, source: MessageSource) -> Self
pub fn with_source(self, source: MessageSource) -> Self
Set the message provenance without changing other request options.
When this is not called, the source field is omitted by default.