pub struct LlmAgentConfig {Show 24 fields
pub name: String,
pub model: Option<String>,
pub instruction: Option<String>,
pub global_instruction: Option<String>,
pub tools: Option<Vec<Arc<dyn ToolFunction>>>,
pub generate_content_config: Option<Value>,
pub disallow_transfer_to_parent: Option<bool>,
pub disallow_transfer_to_peers: Option<bool>,
pub include_contents: Option<String>,
pub input_schema: Option<Value>,
pub output_schema: Option<Value>,
pub output_key: Option<String>,
pub request_processors: Option<Vec<Value>>,
pub response_processors: Option<Vec<Value>>,
pub code_executor: Option<Value>,
pub description: Option<String>,
pub parent_agent: Option<Arc<dyn Agent>>,
pub sub_agents: Option<Vec<Arc<dyn Agent>>>,
pub before_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
pub after_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
pub before_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
pub after_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
pub before_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
pub after_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
}Expand description
The configuration options for creating an LLM-based agent. (Inherits fields from BaseAgent)
Fields§
§name: String§model: Option<String>The model to use for the agent.
instruction: Option<String>Instructions for the LLM model, guiding the agent’s behavior.
global_instruction: Option<String>Instructions for all the agents in the entire agent tree. ONLY the globalInstruction in root agent will take effect. For example: use globalInstruction to make all agents have a stable identity or personality.
tools: Option<Vec<Arc<dyn ToolFunction>>>Tools available to this agent.
generate_content_config: Option<Value>The additional content generation configurations. NOTE: not all fields are usable, e.g. tools must be configured via tools, thinking_config must be configured via planner in LlmAgent. For example: use this config to adjust model temperature, configure safety settings, etc.
disallow_transfer_to_parent: Option<bool>Disallows LLM-controlled transferring to the parent agent. NOTE: Setting this as True also prevents this agent to continue reply to the end-user. This behavior prevents one-way transfer, in which end-user may be stuck with one agent that cannot transfer to other agents in the agent tree.
disallow_transfer_to_peers: Option<bool>Disallows LLM-controlled transferring to the peer agents.
include_contents: Option<String>Controls content inclusion in model requests. Options: default: Model receives relevant conversation history none: Model receives no prior history, operates solely on current instruction and input
input_schema: Option<Value>The input schema when agent is used as a tool.
output_schema: Option<Value>The output schema when agent replies.
output_key: Option<String>The key in session state to store the output of the agent. Typically use cases: - Extracts agent reply for later use, such as in tools, callbacks, etc. - Connects agents to coordinate with each other.
request_processors: Option<Vec<Value>>Processors to run before the LLM request is sent.
response_processors: Option<Vec<Value>>Processors to run after the LLM response is received.
code_executor: Option<Value>Instructs the agent to make a plan and execute it step by step.
description: Option<String>§parent_agent: Option<Arc<dyn Agent>>§sub_agents: Option<Vec<Arc<dyn Agent>>>§before_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>Callbacks to be called before calling the LLM.
after_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>Callbacks to be called after calling the LLM.
before_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>Callbacks to be called before calling the tool.
after_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>Callbacks to be called after calling the tool.
before_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>§after_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>