agent¶
Functions
|
Create a default planner with the given model client, model kwargs, template, task desc, cache path, use cache, max steps. |
|
Create a default tool manager with the given tools, context variables, and add_llm_as_fallback. |
Classes
|
A high-level agentic component that orchestrates AI planning and tool execution. |
- class Agent(name: str, tools: ~typing.List[~typing.Any] | None = None, context_variables: ~typing.Dict | None = None, add_llm_as_fallback: bool | None = False, model_client: ~adalflow.core.model_client.ModelClient | None = None, model_kwargs: ~typing.Dict[str, ~typing.Any] | None = {}, model_type: ~adalflow.core.types.ModelType | None = ModelType.LLM, template: str | None = None, role_desc: str | ~adalflow.core.prompt_builder.Prompt | None = None, cache_path: str | None = None, use_cache: bool | None = True, answer_data_type: ~typing.Type[~components.agent.agent.T] | None = <class 'str'>, max_steps: int | None = 10, is_thinking_model: bool | None = False, tool_manager: ~adalflow.core.tool_manager.ToolManager | None = None, planner: ~adalflow.core.generator.Generator | None = None, **kwargs)[source]¶
Bases:
Component
A high-level agentic component that orchestrates AI planning and tool execution.
The Agent combines a Generator-based planner for task decomposition with a ToolManager for function calling. It uses a ReAct (Reasoning and Acting) architecture to iteratively plan steps and execute tools to solve complex tasks.
The Agent comes with default prompt templates for agentic reasoning, automatic tool definition integration, and step history tracking. It includes built-in helper tools: - llm_tool: Fallback tool using LLM world knowledge for simple queries
- Architecture:
Agent contains two main components: 1. Planner (Generator): Plans and reasons about next actions using an LLM 2. ToolManager: Manages and executes available tools/functions
- name¶
Unique identifier for the agent instance
- Type:
str
- tool_manager¶
Manages available tools and their execution
- Type:
- answer_data_type¶
Expected type for the final answer output
- Type:
Type
- max_steps¶
Maximum number of planning steps allowed
- Type:
int
- is_thinking_model¶
Whether the underlying model supports chain-of-thought
- Type:
bool