pub struct AgentRunOptions {
pub chat_options: Option<ChatOptions>,
pub additional_tools: Vec<ToolDefinition>,
pub background: Option<bool>,
pub continuation_token: Option<ContinuationToken>,
}Expand description
Per-run option overrides for a single SupportsAgentRun::run_with_options /
SupportsAgentRun::run_stream call, merged over the agent’s build-time defaults.
Mirrors upstream run/run_stream per-call keyword arguments and .NET
AgentRunOptions: the per-run ChatOptions take precedence over the
agent’s defaults (via ChatOptions::merge, matching Python’s
run_chat_options & ChatOptions(...)), and
additional_tools are appended to the tool list
for that call only.
Fields§
§chat_options: Option<ChatOptions>Chat-option overrides merged over the agent’s defaults (per-run wins).
additional_tools: Vec<ToolDefinition>Extra tools available only for this run, appended to the agent’s tools.
Declaration-only tools (no executor) surface their calls back to the caller instead of being executed locally — this is how a hosting frontend injects client-side tools (see the AG-UI router).
background: Option<bool>Run as a background (long-running) operation, overriding
ChatOptions::background for this run.
Mirrors .NET AgentRunOptions.AllowBackgroundResponses (Python
passes background in the run options). When the service accepts
the request without finishing it, the response carries a
continuation_token to poll or
resume with. A background run needs a session, so that the follow-up
runs share its conversation.
continuation_token: Option<ContinuationToken>Poll or resume the background run that issued this token, overriding
ChatOptions::continuation_token for this run.
Mirrors .NET AgentRunOptions.ContinuationToken. A run that carries
one continues an existing operation, so it takes no new messages, and
neither history nor context providers are consulted for the request.
Implementations§
Source§impl AgentRunOptions
impl AgentRunOptions
Sourcepub fn new() -> AgentRunOptions
pub fn new() -> AgentRunOptions
Empty options (no overrides).
Sourcepub fn with_chat_options(self, options: ChatOptions) -> AgentRunOptions
pub fn with_chat_options(self, options: ChatOptions) -> AgentRunOptions
Set the per-run chat-option overrides (merged over the agent defaults, per-run winning).
Sourcepub fn with_tool(self, tool: ToolDefinition) -> AgentRunOptions
pub fn with_tool(self, tool: ToolDefinition) -> AgentRunOptions
Append a tool available only for this run.
Sourcepub fn with_tools(
self,
tools: impl IntoIterator<Item = ToolDefinition>,
) -> AgentRunOptions
pub fn with_tools( self, tools: impl IntoIterator<Item = ToolDefinition>, ) -> AgentRunOptions
Append multiple tools available only for this run.
Sourcepub fn with_background(self, background: bool) -> AgentRunOptions
pub fn with_background(self, background: bool) -> AgentRunOptions
Ask for a background (long-running) run. See Self::background.
Sourcepub fn with_continuation_token(
self,
token: ContinuationToken,
) -> AgentRunOptions
pub fn with_continuation_token( self, token: ContinuationToken, ) -> AgentRunOptions
Poll or resume a background run. See Self::continuation_token.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether these options carry no overrides at all. Used by the default
SupportsAgentRun::run_with_options to decide whether to warn about ignoring
options it cannot honor.
Trait Implementations§
Source§impl Clone for AgentRunOptions
impl Clone for AgentRunOptions
Source§fn clone(&self) -> AgentRunOptions
fn clone(&self) -> AgentRunOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more