Skip to main content

Agent

Trait Agent 

Source
pub trait Agent: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn core_prompt(&self) -> &'static str;
    fn available_tools(&self) -> Vec<ToolName>;

    // Provided methods
    fn requested_prompt_components(&self) -> PromptComponentSelection { ... }
    fn requested_context_components(&self) -> ContextComponentSelection { ... }
    fn requires_tool_use(&self) -> bool { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

fn core_prompt(&self) -> &'static str

Source

fn available_tools(&self) -> Vec<ToolName>

Provided Methods§

Source

fn requested_prompt_components(&self) -> PromptComponentSelection

If there are prompt components installed, this instructs which components should be included when building prompts for this agent.

Prompt components are a way to define generic, reusable, slices of the prompt which are reused by many agents, for example, how to talk to the user, how to use your tools. Generally opting in to all prompt components is a safe default, however some agents may wish to disable or control prompt more.

Source

fn requested_context_components(&self) -> ContextComponentSelection

If there are context components, this instructs the ContextBuilder on which components should be included when building contexts for this agent.

Context messages (aka “continuous steering”) is a feature where the last message to the agent always gives a big blob of up to date context. For example, the context may have a list of files in the project, some file contents, some memories, a task list, etc. All of these are updated on each request to the AI to ensure the context is always fresh. Stale versions of files, outdated task lists, etc never appear in our agents context.

Generally all context is helpful for agents, however if an agent needs more fine grain control they may opt out of or control which context components are included.

Source

fn requires_tool_use(&self) -> bool

Implementors§