AgentDefinition

Struct AgentDefinition 

Source
pub struct AgentDefinition {
Show 19 fields pub id: String, pub name: Option<String>, pub description: Option<String>, pub model: String, pub system_prompt: String, pub max_rounds: usize, pub tool_execution_mode: ToolExecutionMode, pub chat_options: Option<ChatOptions>, pub fallback_models: Vec<String>, pub llm_retry_policy: LlmRetryPolicy, pub behavior_ids: Vec<String>, pub allowed_tools: Option<Vec<String>>, pub excluded_tools: Option<Vec<String>>, pub allowed_skills: Option<Vec<String>>, pub excluded_skills: Option<Vec<String>>, pub allowed_agents: Option<Vec<String>>, pub excluded_agents: Option<Vec<String>>, pub stop_condition_specs: Vec<StopConditionSpec>, pub stop_condition_ids: Vec<String>,
}
Expand description

Agent composition definition owned by AgentOS.

This is the orchestration-facing model and uses only registry references (behavior_ids, stop_condition_ids) and declarative specs. Before execution, AgentOS resolves it into loop-facing [BaseAgent].

Fields§

§id: String

Unique identifier for this agent.

§name: Option<String>

Human-readable display name used in discovery surfaces.

§description: Option<String>

Short description exposed to callers/models when this agent is discoverable.

§model: String

Model identifier (e.g., “gpt-4”, “claude-3-opus”).

§system_prompt: String

System prompt for the LLM.

§max_rounds: usize

Maximum number of tool call rounds before stopping.

§tool_execution_mode: ToolExecutionMode

Tool execution strategy.

§chat_options: Option<ChatOptions>

Chat options for the LLM.

§fallback_models: Vec<String>

Fallback model ids used when the primary model fails.

Evaluated in order after model.

§llm_retry_policy: LlmRetryPolicy

Retry policy for LLM inference failures.

§behavior_ids: Vec<String>

Behavior references resolved from AgentOS behavior registry.

§allowed_tools: Option<Vec<String>>

Tool whitelist (None = all tools available).

§excluded_tools: Option<Vec<String>>

Tool blacklist.

§allowed_skills: Option<Vec<String>>

Skill whitelist (None = all skills available).

§excluded_skills: Option<Vec<String>>

Skill blacklist.

§allowed_agents: Option<Vec<String>>

Agent whitelist for agent_run delegation (None = all visible agents available).

§excluded_agents: Option<Vec<String>>

Agent blacklist for agent_run delegation.

§stop_condition_specs: Vec<StopConditionSpec>

Declarative stop condition specs, resolved at runtime.

§stop_condition_ids: Vec<String>

Stop condition references resolved from AgentOS StopPolicyRegistry.

Implementations§

Source§

impl AgentDefinition

Source

pub fn new(model: impl Into<String>) -> Self

Create a new instance with the given model id.

Source

pub fn with_id(id: impl Into<String>, model: impl Into<String>) -> Self

Create a new instance with explicit id and model.

Source

pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self

Set system prompt.

Source

pub fn with_max_rounds(self, max_rounds: usize) -> Self

Set max rounds.

Source

pub fn with_chat_options(self, options: ChatOptions) -> Self

Set chat options.

Source

pub fn with_fallback_models(self, models: Vec<String>) -> Self

Set fallback model ids to try after the primary model.

Source

pub fn with_fallback_model(self, model: impl Into<String>) -> Self

Add a single fallback model id.

Source

pub fn with_llm_retry_policy(self, policy: LlmRetryPolicy) -> Self

Set LLM retry policy.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Source

pub fn display_name(&self) -> &str

Source

pub fn display_description(&self) -> &str

Source

pub fn descriptor(&self) -> AgentDescriptor

Source

pub fn with_stop_condition_spec(self, spec: StopConditionSpec) -> Self

Source

pub fn with_stop_condition_specs(self, specs: Vec<StopConditionSpec>) -> Self

Source

pub fn with_tool_execution_mode(self, mode: ToolExecutionMode) -> Self

Source

pub fn with_behavior_ids(self, behavior_ids: Vec<String>) -> Self

Source

pub fn with_behavior_id(self, behavior_id: impl Into<String>) -> Self

Source

pub fn with_stop_condition_id(self, id: impl Into<String>) -> Self

Source

pub fn with_stop_condition_ids(self, ids: Vec<String>) -> Self

Source

pub fn with_allowed_tools(self, tools: Vec<String>) -> Self

Source

pub fn with_excluded_tools(self, tools: Vec<String>) -> Self

Source

pub fn with_allowed_skills(self, skills: Vec<String>) -> Self

Source

pub fn with_excluded_skills(self, skills: Vec<String>) -> Self

Source

pub fn with_allowed_agents(self, agents: Vec<String>) -> Self

Source

pub fn with_excluded_agents(self, agents: Vec<String>) -> Self

Trait Implementations§

Source§

impl Clone for AgentDefinition

Source§

fn clone(&self) -> AgentDefinition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AgentDefinition

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more