Load an agent executor given tools and LLM.
This function is no deprecated in favor of
create_agent from the langchain
package, which provides a more flexible agent factory with middleware
support, structured output, and integration with LangGraph.
For migration guidance, see Migrating to langchain v1 and Migrating from AgentExecutor.
initialize_agent(
tools: Sequence[BaseTool],
llm: BaseLanguageModel,
agent: AgentType | None = None,
callback_manager: BaseCallbackManager | None = None,
agent_path: str | None = None,
agent_kwargs: dict | None = None,
*,
tags: Sequence[str] | None = None,
**kwargs: Any = {}
) -> AgentExecutor| Name | Type | Description |
|---|---|---|
tools* | Sequence[BaseTool] | List of tools this agent has access to. |
llm* | BaseLanguageModel | Language model to use as the agent. |
agent | AgentType | None | Default: NoneAgent type to use. If |
callback_manager | BaseCallbackManager | None | Default: NoneCallbackManager to use. Global callback manager is used if not provided. |
agent_path | str | None | Default: NonePath to serialized agent to use. If |
agent_kwargs | dict | None | Default: NoneAdditional keyword arguments to pass to the underlying agent. |
tags | Sequence[str] | None | Default: NoneTags to apply to the traced runs. |
kwargs | Any | Default: {}Additional keyword arguments passed to the agent executor. |