Toggle Menu
Prev Up Next

# `langchain.agents.initialize`.initialize_agent

langchain.agents.initialize.initialize_agent(tools: Sequence[BaseTool], llm: BaseLanguageModel, agent: Optional[AgentType] = None, callback_manager: Optional[BaseCallbackManager] = None, agent_path: Optional[str] = None, agent_kwargs: Optional[dict] = None, *, tags: Optional[Sequence[str]] = None, **kwargs: Any) → AgentExecutor

  [Deprecated] Load an agent executor given tools and LLM.

  Parameters

    - tools (Sequence[BaseTool]) – List of tools this agent has access to.

    - llm (BaseLanguageModel) – Language model to use as the agent.

    - agent (Optional[AgentType]) – Agent type to use. If None and agent_path is also None, will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION.

    - callback_manager (Optional[BaseCallbackManager]) – CallbackManager to use. Global callback manager is used if not provided. Defaults to None.

    - agent_path (Optional[str]) – Path to serialized agent to use.

    - agent_kwargs (Optional[dict]) – Additional keyword arguments to pass to the underlying agent

    - tags (Optional[Sequence[str]]) – Tags to apply to the traced runs.

    - **kwargs (Any) – Additional keyword arguments passed to the agent executor

  Returns

    An agent executor

  Return type

    AgentExecutor

  Notes

  Deprecated since version 0.1.0: Use Use new agent constructor methods like create_react_agent, create_json_agent, create_structured_chat_agent, etc. instead.

# Examples using initialize_agent

- ANTHROPIC_API_KEY=<YOUR ANTHROPIC API KEY>

- Answer with ‘Zhu’

- Artifacts are charts created by matplotlib when `plt.show()` is called

- Connect to Comet if no API Key is set

- Copilot Sandbox

- Debugging

- Extract pdf content

- First, define custom callback handler implementations

- Flyte

- For Windows/Linux

- How YahooFinanceNewsTool works? {#how-yahoofinancenewstool-works}

- IMPORTANT: If you plan to use this account in the future, make sure to save the

- If this is your first time using playwright, you’ll have to install a browser executable.

- Initialize the language model

- LLM Hyperparameters

- LLMonitor

- Needed if you would like to display images in the notebook

- SCENARIO 1 - LLM

- SearchApi

- Select the LLM to use. Here, we use gpt-3.5-turbo-instruct

- Serper - Google Search API

- Set environmental variables here

- Set this to your Zep server URL

- Set your environment variables using os.environ

- Setup and use the ClearML Callback

- Specify your Connery Runner credentials.

- Streamlit

- These are sample parameters for Falcon 40B Instruct Deployed from Amazon SageMaker JumpStart

- Used by the agent in this tutorial

- Using https://huggingface.co/laiyer/deberta-v3-base-prompt-injection

- argilla.md

- awslambda.md

- bash.md

- chatgpt_plugins.md

- document_comparison_toolkit.md

- edenai_tools.md

- eleven_labs_tts.md

- folder_id=’1yucgL9WGgWZdM1TOuKkeghlPizuzMYb5’

- get from https://platform.openai.com/

- google_finance.md

- google_serper.md

- gradio_tools.md

- graphql.md

- jira.md

- memorize.md

- nasa.md

- need to use GPT-4 here as GPT-3.5 does not understand, however hard you insist, that

- openweathermap.md

- os.environ[“OPENAI_API_KEY”] = “”

- os.environ[“OPENAI_ORGANIZATION”] = “…”

- scenario 1 - LLM

- sceneXplain.md

- search_tools.md

- searchapi.md

- steam.md

- token_usage_tracking.md

- use it with langchain {#use-it-with-langchain}

- wandb documentation to configure wandb using env variables

- xata_chat_message_history.md