Skip to main content

Crate wabot_feature_agent

Crate wabot_feature_agent 

Source
Expand description

§wabot-feature-agent

Rust port of wabot-ts/src/feature/agent. An agent is an LLM you drive from code, where a Mindset is one an end user talks to. Same models, same #[tools], different control:

ⓘ
let mut session = factory.for_agent(triage).with_context(order_json).session().await;

let urgent: bool = session.confirm("Is this complaint urgent?").await?;
let plan: Plan = session.ask("Draft a resolution plan.").await?;

ask returns a validated, typed value: the answer struct is offered to the model as a synthetic tool, and a malformed answer goes back to the model to correct rather than to the caller as an error.

§Delegation from a mindset

A chatbot can hand work to an agent (MindsetOperator::with_agents). That path is deliberately narrow, because the person on the other end of the chat is not the developer:

  • tool sets marked expose_to_mindsets = false are invisible unless the binding allow-lists them by name;
  • each call gets a fresh session with no chat history — only the task text the model wrote;
  • a budget is capped by default (DEFAULT_MINDSET_AGENT_BUDGET), so an autonomous delegation can’t run away on cost.

Re-exports§

pub use agent::Agent;
pub use factory::AgentBuilder;
pub use factory::AgentFactory;
pub use mindset_toolset::agent_binding;
pub use mindset_toolset::register_agents;
pub use mindset_toolset::AgentBindingBuilder;
pub use mindset_toolset::AgentSpec;
pub use mindset_toolset::MindsetAgentToolset;
pub use mindset_toolset::DEFAULT_MINDSET_AGENT_BUDGET;
pub use reply::AgentError;
pub use reply::AgentReply;
pub use reply::StopReason;
pub use reply::ANSWER_TOOL_NAME;
pub use session::AgentBudget;
pub use session::AgentSession;
pub use session::AgentSessionDeps;
pub use session::BooleanAnswer;
pub use session::DEFAULT_CHAT_ITEMS;
pub use session::DEFAULT_MAX_STEPS;

Modules§

agent
What an agent is. Port of IAgent + @agent({ … }) in wabot-ts/src/feature/agent.
factory
Building sessions. Port of AgentFactory / AgentBuilder / AgentOperator in wabot-ts/src/feature/agent.
mindset_toolset
Exposing agents to a mindset. Port of wabot-ts/src/feature/agent/MindsetAgentToolset.ts.
reply
What a turn produced. Port of wabot-ts/src/feature/agent/AgentReply.ts.
session
A stateful conversation with an agent. Port of wabot-ts/src/feature/agent/AgentSession.ts.