pub struct AgentCall<T = NoSchema> { /* private fields */ }Expand description
A fluent, owned builder for one agent leaf. Created by agent.
The type parameter T selects the terminal: NoSchema (default) yields
the agent’s text, a StructuredSchema type T yields a validated T, and
RawJson yields a validated serde_json::Value. T is phantom — it lives
only here, so the underlying runner stays Value-only and object-safe.
Implementations§
Source§impl<T> AgentCall<T>
impl<T> AgentCall<T>
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Set the display label (used in events and as the runner name).
Sourcepub fn phase(self, phase: impl Into<String>) -> Self
pub fn phase(self, phase: impl Into<String>) -> Self
Override the phase this call is grouped under.
Sourcepub fn model(self, model: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
Run this leaf on a different model: a ROLE name (“fast”, “frontier”) or a raw model id, resolved by the ctx’s provider factory. Dynamic model-by-task, the Claude Code way — the workflow decides per agent.
Sourcepub fn isolation(self, isolation: Isolation) -> Self
pub fn isolation(self, isolation: Isolation) -> Self
Isolate this leaf’s filesystem effects (see Isolation).
Sourcepub fn tools(self, tools: Vec<Arc<dyn Tool>>) -> Self
pub fn tools(self, tools: Vec<Arc<dyn Tool>>) -> Self
Wire a tool set into this agent, overriding the ctx’s base tools. The agent can then call these tools during its ReAct loop. (Sub-agents inherit tools the way Claude Code’s subagents inherit the allowlist.)
Sourcepub fn goal(self, goal: GoalCondition) -> Self
pub fn goal(self, goal: GoalCondition) -> Self
Attach a persistent GoalCondition:
the leaf self-continues until an independent judge confirms the objective
(bounded by the goal’s max_continuations). The continuations all run
inside the one leaf, so their combined token spend is recorded once
against the shared flow budget, and a run-wide budget breach or
cancellation aborts the goal loop at the leaf’s cancel race.
Source§impl AgentCall<NoSchema>
impl AgentCall<NoSchema>
Sourcepub fn schema<S: StructuredSchema>(self) -> AgentCall<S>
pub fn schema<S: StructuredSchema>(self) -> AgentCall<S>
Force validated structured output of type S, transforming this into an
AgentCall<S> whose run() returns Option<S>. The schema comes from
StructuredSchema::json_schema.
Sourcepub fn schema_value(self, schema: Value) -> AgentCall<RawJson>
pub fn schema_value(self, schema: Value) -> AgentCall<RawJson>
Force validated structured output against a hand-written JSON Schema,
transforming this into an AgentCall<RawJson> whose run() returns the
raw validated serde_json::Value (no deserialization).