# initialize_agent

> **Function** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/agents/initialize/initialize_agent)

Load an agent executor given tools and LLM.

!!! warning

    This function is no deprecated in favor of
    [`create_agent`][langchain.agents.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](https://docs.langchain.com/oss/python/migrate/langchain-v1)
    and
    [Migrating from AgentExecutor](https://python.langchain.com/docs/how_to/migrate_agent/).

## Signature

```python
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
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `tools` | `Sequence[BaseTool]` | Yes | List of tools this agent has access to. |
| `llm` | `BaseLanguageModel` | Yes | Language model to use as the agent. |
| `agent` | `AgentType \| None` | No | Agent type to use. If `None` and agent_path is also None, will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. (default: `None`) |
| `callback_manager` | `BaseCallbackManager \| None` | No | CallbackManager to use. Global callback manager is used if not provided. (default: `None`) |
| `agent_path` | `str \| None` | No | Path to serialized agent to use. If `None` and agent is also None, will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. (default: `None`) |
| `agent_kwargs` | `dict \| None` | No | Additional keyword arguments to pass to the underlying agent. (default: `None`) |
| `tags` | `Sequence[str] \| None` | No | Tags to apply to the traced runs. (default: `None`) |
| `kwargs` | `Any` | No | Additional keyword arguments passed to the agent executor. (default: `{}`) |

## Returns

`AgentExecutor`

An agent executor.

## ⚠️ Deprecated

Deprecated since version 0.1.0. Will be removed in version 1.0.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/9f232caa7a8fe1ca042a401942d5d90d54ceb1a6/libs/langchain/langchain_classic/agents/initialize.py#L19)