pub struct InvokeOptions {
pub structured_output_schema: Option<JsonSchema>,
pub invocation_state: Option<InvocationState>,
pub cancel_signal: Option<CancelSignal>,
pub invocation_context: Option<InvocationContext>,
pub limits: Option<InvokeLimits>,
}Expand description
Options for one invocation (InvokeOptions).
use strands::{InvokeOptions, InvokeLimits};
#[derive(serde::Deserialize, schemars::JsonSchema)]
struct Summary { title: String }
let options = InvokeOptions {
limits: Some(InvokeLimits { turns: Some(5), ..Default::default() }),
..Default::default()
}
.structured_output_schema::<Summary>();
assert!(options.structured_output_schema.is_some());Fields§
§structured_output_schema: Option<JsonSchema>JSON schema for this invocation’s structured output, overriding the agent’s.
The builder sets it from a type with
structured_output_schema::<T>(), or from JSON with structured_output_schema_json(..).
invocation_state: Option<InvocationState>Per-invocation state passed to hooks and tools and returned on the result.
cancel_signal: Option<CancelSignal>A signal from outside the agent that cancels the invocation, merged with the agent’s own.
Its message and after_current_tools count like the agent’s.
invocation_context: Option<InvocationContext>Runs this call inside the request a hook event’s or tool context’s handle belongs to, sharing its limits and usage.
limits: Option<InvokeLimits>Limits for the request this call starts (limits).
Implementations§
Source§impl InvokeOptions
impl InvokeOptions
Sourcepub fn builder() -> InvokeOptionsBuilder
pub fn builder() -> InvokeOptionsBuilder
Create an instance of InvokeOptions using the builder syntax
Source§impl InvokeOptions
impl InvokeOptions
Sourcepub fn structured_output_schema<T: SchemarsJsonSchema>(self) -> Self
pub fn structured_output_schema<T: SchemarsJsonSchema>(self) -> Self
Sets the structured output schema from a type’s schemars schema.
Trait Implementations§
Source§impl Clone for InvokeOptions
impl Clone for InvokeOptions
Source§impl Debug for InvokeOptions
impl Debug for InvokeOptions
Auto Trait Implementations§
impl Freeze for InvokeOptions
impl RefUnwindSafe for InvokeOptions
impl Send for InvokeOptions
impl Sync for InvokeOptions
impl Unpin for InvokeOptions
impl UnsafeUnpin for InvokeOptions
impl UnwindSafe for InvokeOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more