Upload agents.md
Browse files- docs/source/en/agents.md +60 -0
docs/source/en/agents.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Agents
|
2 |
+
|
3 |
+
<Tip warning={true}>
|
4 |
+
|
5 |
+
Smolagents is an experimental API which is subject to change at any time. Results returned by the agents
|
6 |
+
can vary as the APIs or underlying models are prone to change.
|
7 |
+
|
8 |
+
</Tip>
|
9 |
+
|
10 |
+
To learn more about agents and tools make sure to read the [introductory guide](../index). This page
|
11 |
+
contains the API docs for the underlying classes.
|
12 |
+
|
13 |
+
## Agents
|
14 |
+
|
15 |
+
Our agents inherit from [`MultiStepAgent`], which means they can act in multiple steps, each step consisting of one thought, then one tool call and execution. Read more in [this conceptual guide](../conceptual_guides/react).
|
16 |
+
|
17 |
+
We provide two types of agents, based on the main [`Agent`] class.
|
18 |
+
- [`CodeAgent`] writes its tool calls in Python code (this is the default).
|
19 |
+
- [`ToolCallingAgent`] writes its tool calls in JSON.
|
20 |
+
|
21 |
+
Both require arguments `model` and list of tools `tools` at initialization.
|
22 |
+
|
23 |
+
### Classes of agents
|
24 |
+
|
25 |
+
[[autodoc]] MultiStepAgent
|
26 |
+
|
27 |
+
[[autodoc]] CodeAgent
|
28 |
+
|
29 |
+
[[autodoc]] ToolCallingAgent
|
30 |
+
|
31 |
+
### ManagedAgent
|
32 |
+
|
33 |
+
_This class is deprecated since 1.8.0: now you simply need to pass attributes `name` and `description` to a normal agent to make it callable by a manager agent._
|
34 |
+
|
35 |
+
### stream_to_gradio
|
36 |
+
|
37 |
+
[[autodoc]] stream_to_gradio
|
38 |
+
|
39 |
+
### GradioUI
|
40 |
+
|
41 |
+
> [!TIP]
|
42 |
+
> You must have `gradio` installed to use the UI. Please run `pip install smolagents[gradio]` if it's not the case.
|
43 |
+
|
44 |
+
[[autodoc]] GradioUI
|
45 |
+
|
46 |
+
## Prompts
|
47 |
+
|
48 |
+
[[autodoc]] smolagents.agents.PromptTemplates
|
49 |
+
|
50 |
+
[[autodoc]] smolagents.agents.PlanningPromptTemplate
|
51 |
+
|
52 |
+
[[autodoc]] smolagents.agents.ManagedAgentPromptTemplate
|
53 |
+
|
54 |
+
[[autodoc]] smolagents.agents.FinalAnswerPromptTemplate
|
55 |
+
|
56 |
+
## Memory
|
57 |
+
|
58 |
+
Smolagents use memory to store information across multiple steps.
|
59 |
+
|
60 |
+
[[autodoc]] smolagents.memory.AgentMemory
|