pub struct Context {
pub system: Vec<Block>,
pub guides: Vec<Block>,
pub history: Vec<Turn>,
pub task: Task,
pub policy: Policy,
pub metadata: BTreeMap<String, Value>,
pub tools: Vec<ToolSchema>,
pub response_format: ResponseFormat,
}Expand description
The model-visible state of an in-progress agent run.
Fields§
§system: Vec<Block>§guides: Vec<Block>§history: Vec<Turn>§task: Task§policy: Policy§metadata: BTreeMap<String, Value>§tools: Vec<ToolSchema>Tools the agent may call this turn. Model adapters translate these to
the provider’s tool-calling format (OpenAI tools, Anthropic tools, …).
response_format: ResponseFormatConstraint on the model’s terminal reply. Defaults to Free —
providers receive no extra request fields. See ResponseFormat.
Implementations§
Source§impl Context
impl Context
pub fn new(task: Task) -> Self
Sourcepub fn push_model_output(&mut self, out: &ModelOutput)
pub fn push_model_output(&mut self, out: &ModelOutput)
Append a model turn to the history. Captures reasoning content so it can be echoed back on subsequent calls (required by DeepSeek thinking mode and Anthropic thinking blocks).
Sourcepub fn push_feedback(&mut self, signals: Vec<Signal>)
pub fn push_feedback(&mut self, signals: Vec<Signal>)
Append feedback signals as a tool-role turn.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Context
impl<'de> Deserialize<'de> for Context
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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
Mutably borrows from an owned value. Read more