Skip to content

Commit ee5e288

Browse files
Update agent documentation.
1 parent 4931edc commit ee5e288

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/content/docs/reference/agent.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,35 @@ const tools = [
111111
];
112112
```
113113

114+
## Agents as Tools
115+
116+
Sub agents are great, but sometimes we need to leverage the power of an Agent, while not fully influencing the context of our whole orchestration, that's where using Agents as Tools comes in.
117+
118+
```typescript
119+
const translationAgent = new Agent({
120+
name: "Translation Agent",
121+
purpose:
122+
"I translate text into different languages, just let me know the language you want to translate to.",
123+
});
124+
125+
const greetingAgent = new Agent({
126+
name: "Greeting Agent",
127+
purpose: "Generate a greeting",
128+
tools: [
129+
translationAgent.asTool({
130+
request: {
131+
type: "string",
132+
description: `The text to translate`,
133+
},
134+
language: {
135+
type: "string",
136+
description: `The language to translate to`,
137+
},
138+
}),
139+
],
140+
});
141+
```
142+
114143
## Using Web Search
115144

116145
Agents can perform web searches when configured:

0 commit comments

Comments
 (0)