.rst
.pdf
Agents
 Contents 
Action Agents
Plan-and-Execute Agents
Agents#
Note
Conceptual Guide
Some applications require not just a predetermined chain of calls to LLMs/other tools,
but potentially an unknown chain that depends on the user’s input.
In these types of chains, there is an agent which has access to a suite of tools.
Depending on the user input, the agent can then decide which, if any, of these tools to call.
At the moment, there are two main types of agents:
Action Agents: these agents decide the actions to take and execute that actions one action at a time.
Plan-and-Execute Agents: these agents first decide a plan of actions to take, and then execute those actions one at a time.
When should you use each one? Action Agents are more conventional, and good for small tasks.
For more complex or long running tasks, the initial planning step helps to maintain long term objectives and focus.
However, that comes at the expense of generally more calls and higher latency.
These two agents are also not mutually exclusive - in fact, it is often best to have an Action Agent be in charge
of the execution for the Plan and Execute agent.
Action Agents#
High level pseudocode of the Action Agents:
The user input is received
The agent decides which tool - if any - to use, and what the tool input should be
That tool is then called with the tool input, and an observation is recorded (the output of this calling)
That history of tool, tool input, and observation is passed back into the agent, and it decides the next step
This is repeated until the agent decides it no longer needs to use a tool, and then it responds directly to the user.
The different abstractions involved in agents are:
rtdocs_stable/api.python.langchain.com/en/stable/modules/agents.html