You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain-hub/agents
Francisco Ingham 2826ef9e8a
improved the sql agent prompt to reflect interaction with sql chains (#12)
Co-authored-by: Francisco Ingham <>
1 year ago
..
self-ask-with-search add agents (#7) 1 year ago
zero-shot-react-conversation add more agents (#9) 1 year ago
zero-shot-react-description add more agents (#9) 1 year ago
zero-shot-react-sql improved the sql agent prompt to reflect interaction with sql chains (#12) 1 year ago
README.md cr 1 year ago
readme_template.md add agents (#7) 1 year ago

README.md

Agents

This directory covers loading and uploading of agents. Each sub-directory covers a different agent, and has not only the serialized agent but also a README file describing that agent.

Loading

All agents can be loaded from LangChain by specifying the desired path, and adding the lc:// prefix. The path should be relative to the langchain-hub repo.

For example, to load the agent at the path langchain-hub/agents/self-ask-with-search/agent.json, the path you want to specify is lc://agents/self-ask-with-search/agent.json

Once you have that path, you can load it in the following manner:

from langchain.agents import initialize_agent

llm = ...
tools = ...

agent = initialize_agent(tools, llm, agent_path="lc://agents/self-ask-with-search/agent.json")

Uploading

To upload an agent to the LangChainHub, you must upload 2 files:

  1. The agent. There are 2 supported file formats for agents: json and yaml.
  2. Associated README file for the agent. This provides a high level description of the agent.

Supported file formats

json

To get a properly formatted json file, if you have an agent in memory in Python you can run:

agent.save_agent("file_name.json")

Replace "file_name" with the desired name of the file.

yaml

To get a properly formatted yaml file, if you have an agent in memory in Python you can run:

agent.save_agent("file_name.yaml")

Replace "file_name" with the desired name of the file.