Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Commit e3198d2

Browse files
Update Guides and API reference pages (#280)
* Update Guides and Python API reference * More Guides, API ref updates - Add `vector.get()` usage to API reference, examples in Guides - Fix code formatting for Vector DB guide - Clean up Guides headings - Fix Python agent communication examples (should use `get_agent`) * CodeRabbit suggestions * More fixes * Update Object Storage examples * Add full metadata back to examples * More fixes * Fix Python log info, agent logging guide * Implement suggestions
1 parent 09d4781 commit e3198d2

11 files changed

Lines changed: 550 additions & 308 deletions

‎content/Guides/agent-communication.mdx‎

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ description: Agent-to-Agent communication patterns, usage and best practices
55

66
import Image from "next/image";
77

8-
<Image src="/images/agent-to-agent.png" alt="Agent-to-AgentCommunication" width={640} height={640} />
8+
<Image src="/images/agent-to-agent.png" alt="Agent-to-Agent Communication" width={640} height={640} />
99

10-
### How do agents communicate with each other?
10+
## Overview
1111

12-
In most advanced agentic scenarios, agents need to communicate with other agents to achieve their goals.
13-
14-
In fact, our recommendation is that you build agents with highly specialized roles and skills and use agent-to-agent communication to achieve the overall goal.
12+
In most advanced agentic scenarios, agents need to communicate with other agents to achieve their goals. In fact, our recommendation is that you build agents with highly specialized roles and skills and use agent-to-agent communication to achieve the overall goal.
1513

1614
There are a number of ways to achieve agent-to-agent communication natively in Agentuity.
1715

18-
#### Communication Types
16+
## Communication Types
1917

2018
Agents can communicate with each other in a number of ways in the Agentuity platform. The following are the different types of communication that are supported:
2119

@@ -25,28 +23,28 @@ Agents can communicate with each other in a number of ways in the Agentuity plat
2523
| **Inter Project** | Agents can communicate with each other across projects within the same organization across the internal network |
2624
| **Inter Organization** | Agents can communicate with each other across organizations across the internal network |
2725

28-
##### Intra Project
26+
### Intra Project
2927

3028
Intra project communication is the simplest form of agent-to-agent communication. Agents within the same project can communicate with each other locally without leaving the local network.
3129

32-
##### Inter Project
30+
### Inter Project
3331

3432
Inter project communication is a more advanced form of agent-to-agent communication. Agents can communicate with each other across projects within the same organization but will communicate over the internal network.
3533

36-
##### Inter Organization
34+
### Inter Organization
3735

3836
Inter organization communication is the most advanced form of agent-to-agent communication. Agents can communicate with each other across organizations. Currently, Agentuity only supports inter organization agent communication if the target agent is public and the source agent has been given the agent ID by the other organization. For inter organization communication, the source agent will communicate over the internal network.
3937

40-
#### Communication Methods
38+
## Communication Methods
4139

42-
Agents has two primary methods of communication with other agents:
40+
Agents have two primary methods of communication with other agents:
4341

4442
| Type | Description |
4543
|-----------|-------------|
4644
| Handoff | Agents can handoff a request to another agent to complete |
4745
| Invocation | Agents can invoke another agent to complete a task and wait for the result |
4846

49-
##### Handoff
47+
### Handoff
5048

5149
When an agent needs to handoff a request to another agent, it can do so by using the SDK `handoff` method. The `handoff` method will send the request to another agent and the other agent will be responsible for completing the request.
5250

@@ -81,20 +79,24 @@ export default async function Agent(
8179
resp: AgentResponse,
8280
ctx: AgentContext
8381
) {
84-
return resp.handoff({name: 'My Other Agent'}, "would you please do this?");
82+
return resp.handoff(
83+
{name: 'My Other Agent'},
84+
{ data: "would you please do this?", contentType: "text/plain" }
85+
);
8586
}`} py={`from agentuity import AgentRequest, AgentResponse, AgentContext
8687
8788
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
89+
# Python infers: string → text/plain, dict → application/json
8890
return response.handoff({"name":"My Other Agent"}, "would you please do this?")
8991
`} />
9092

91-
##### Invocation
93+
### Invocation
9294

93-
When an agent needs to invoke another agent to complete a task and wants to wait for the result, it can do so by using the SDK `getAgents` method on `AgentContext`. The `getAgents` will perform resolution to determine the target agent location and return a handle to the target agent that can be used to `run` the target agent.
95+
When an agent needs to invoke another agent to complete a task and wants to wait for the result, it can do so by using the SDK `getAgent` method on `AgentContext`. The `getAgent` will perform resolution to determine the target agent location and return a handle to the target agent that can be used to `run` the target agent.
9496

95-
If the target agent is local (intra project), the `getAgents` method will return a handle to an internal agent which can be used to `run` the target agent.
97+
If the target agent is local (intra project), the `getAgent` method will return a handle to an internal agent which can be used to `run` the target agent.
9698

97-
If the target agent is remote (inter project or inter organization), the `getAgents` method will return a handle to an external agent which can be used to `run` the target agent. In addition, the SDK internally will use the authorization token to authenticate the source agent to the target agent.
99+
If the target agent is remote (inter project or inter organization), the `getAgent` method will return a handle to an external agent which can be used to `run` the target agent. In addition, the SDK internally will use the authorization token to authenticate the source agent to the target agent.
98100

99101
<Mermaid chart="
100102
sequenceDiagram
@@ -115,23 +117,31 @@ export default async function Agent(
115117
ctx: AgentContext
116118
) {
117119
const agent = await ctx.getAgent({name: 'My Other Agent'});
118-
const agentResponse = await agent.run({name: 'My Other Agent'}, "would you please do this?");
120+
// Basic usage - perfect for simple string data
121+
const agentResponse = await agent.run({ data: "would you please do this?" });
122+
// Explicit control when needed:
123+
// const agentResponse = await agent.run({ data: "would you please do this?", contentType: "text/plain" });
119124
const text = await agentResponse.data.text();
120125
return resp.text(text);
121126
}`} py={`from agentuity import AgentRequest, AgentResponse, AgentContext
122127
123128
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
124-
agent = await context.getAgent({"name":"My Other Agent"})
125-
agent_response = await agent.run({"name":"My Other Agent"}, "would you please do this?")
129+
agent = await context.get_agent({"name":"My Other Agent"})
130+
# Send plain text (content type inferred as text/plain)
131+
agent_response = await agent.run("would you please do this?")
132+
# Or send JSON (content type inferred as application/json)
133+
# agent_response = await agent.run({"message": "would you please do this?"})
126134
text = await agent_response.data.text()
127135
return response.text(text)
128136
`} />
129137

138+
> **Note:** JavaScript uses `{ data, contentType }` format while Python infers content type from the raw payload passed directly.
139+
130140
In this trivial example above, the functionality is similar to the handoff example above. The source agent is sending a request to the `My Other Agent` agent and passing a message to the other agent. The `My Other Agent` agent will receive the request, perform an operation and return the result to the source agent. The source agent will simply return the result as a text result.
131141

132142
In a real life scenario, you'll likely want to pass the appropriate data types to the target agent and wait for the result and then use the result in your own agent to perform additional tasks.
133143

134-
###### Parallel Execution
144+
#### Parallel Execution
135145

136146
Sometimes you want to send a request to multiple agents at the same time. This is an example of parallel execution.
137147

@@ -144,22 +154,28 @@ export default async function Agent(
144154
) {
145155
const agent1 = await ctx.getAgent({name: 'My First Agent'});
146156
const agent2 = await ctx.getAgent({name: 'My Second Agent'});
157+
// Basic usage - perfect for simple object data
147158
await Promise.all([
148-
agent1.run({task: 'My First Task'}),
149-
agent2.run({task: 'My Second Task'}),
159+
agent1.run({ data: { task: 'My First Task' } }),
160+
agent2.run({ data: { task: 'My Second Task' } }),
150161
]);
162+
// Explicit control when needed:
163+
// await Promise.all([
164+
// agent1.run({ data: { task: 'My First Task' }, contentType: 'application/json' }),
165+
// agent2.run({ data: { task: 'My Second Task' }, contentType: 'application/json' }),
166+
// ]);
151167
return resp.text('OK');
152168
}`} py={`from agentuity import AgentRequest, AgentResponse, AgentContext
153169
import asyncio
154170
155171
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
156172
157-
agent1 = await context.getAgent({"name":"My First Agent"})
158-
agent2 = await context.getAgent({"name":"My Second Agent"})
173+
agent1 = await context.get_agent({"name":"My First Agent"})
174+
agent2 = await context.get_agent({"name":"My Second Agent"})
159175
160176
await asyncio.gather(
161-
agent1.run({"task":"My First Task"}),
162-
agent2.run({"task":"My Second Task"}),
177+
agent1.run({"task": "My First Task"}), # content type inferred as JSON
178+
agent2.run({"task": "My Second Task"}), # content type inferred as JSON
163179
)
164180
165181
return response.text('OK')
@@ -175,27 +191,27 @@ sequenceDiagram
175191
actor Agentuity
176192
actor Agent 2
177193
actor Agent 3
178-
Agent 1-->>Agentuity: Get Agent 1
179194
Agent 1-->>Agentuity: Get Agent 2
195+
Agent 1-->>Agentuity: Get Agent 3
180196
Agent 1->>Agent 2: Run
181197
Agent 1->>Agent 3: Run
182198
"/>
183199

184-
#### Agent Resolution
200+
## Agent Resolution
185201

186-
How do we resolve the target agent? There are two main ways to do this:
202+
How do we resolve the target agent? There are three main ways to do this:
187203

188204
| Type | Description |
189205
|-----------|-------------|
190206
| Agent ID | The agent ID is a unique identifier for an agent. It is a string that is assigned to an agent when it is created. |
191207
| Agent Name | The agent name is a human readable name for an agent. It is a string that was used for the agent's name. |
192208
| Project ID | The agent project ID is specified to disambiguate agents with the same name in different projects. |
193209

194-
##### Intra Project Resolution
210+
### Intra Project Resolution
195211

196212
When calling an agent within the same project, the agent name is usually the easiest way to resolve the target agent. The agent name is a human readable name for an agent. It is a string that was used for the agent's name.
197213

198-
##### Inter Project Resolution
214+
### Inter Project Resolution
199215

200216
When calling an agent across projects within the same organization, the agent ID is typically the most reliable way to resolve the target agent. The agent ID is a unique identifier for an agent.
201217

@@ -211,23 +227,23 @@ export default async function Agent(
211227
ctx: AgentContext
212228
) {
213229
return resp.handoff({
214-
id: 'agent_123456789abcedef',
215-
projectId: 'project_123456789abcedef',
230+
id: 'agent-123456789abcedef',
231+
projectId: 'project-123456789abcedef',
216232
});
217233
}`} py={`
218234
from agentuity import AgentRequest, AgentResponse, AgentContext
219235
220236
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
221237
return response.handoff({
222-
"id": "agent_123456789abcedef",
223-
"projectId": "project_123456789abcedef"
238+
"id": "agent-123456789abcedef",
239+
"projectId": "project-123456789abcedef"
224240
})
225241
`} />
226242

227-
##### Inter Organization Resolution
243+
### Inter Organization Resolution
228244

229245
Currently, Agentuity only supports inter organization agent communication if the target agent is public and the source agent has been given the agent ID by the other organization. When using inter organization communication, only the agent ID is required to resolve the target agent.
230246

231-
#### Communication Authorization
247+
## Communication Authorization
232248

233249
When communicating with other agents outside the local project, Agentuity will automatically generate a one-time use authorization token with a short expiration. This token is used to authenticate the source agent to the target agent automatically without the need for the source agent to pass the token to the target agent.

‎content/Guides/agent-data-handling.mdx‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ title: Agent Data Handling
33
description: How to handle data formats in your agents
44
---
55

6-
We provide a few different ways to handle data formats in your agents to make it easier to work with different data types. Of course, your agent can always perform its own data handling by use the raw data and the content type property. However, most common data types are supported out of the box.
6+
## Overview
7+
8+
We provide a few different ways to handle data formats in your agents to make it easier to work with different data types. Of course, your agent can always perform its own data handling by using the raw data and the content type property. However, most common data types are supported out of the box.
79

810
## How it works
911

@@ -37,16 +39,16 @@ export default async function Agent(
3739
}`} py={`from agentuity import AgentRequest, AgentResponse, AgentContext
3840
3941
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
40-
contentType = request.data.contentType
41-
if contentType == 'text/plain':
42-
text = await request.data.text()
43-
# do something with the text
44-
elif contentType == 'application/json':
45-
json = await request.data.json()
46-
# do something with the json
47-
else:
48-
# do something with the data
49-
pass
42+
contentType = request.data.contentType
43+
if contentType == 'text/plain':
44+
text = await request.data.text()
45+
# do something with the text
46+
elif contentType == 'application/json':
47+
json = await request.data.json()
48+
# do something with the json
49+
else:
50+
# do something with the data
51+
pass
5052
`} />
5153

5254
## Request Data Formats
@@ -55,7 +57,7 @@ The following request data formats are supported out of the box:
5557

5658
### Text
5759

58-
You use use the `text` method on the `Data` object to get the raw text data.
60+
You can use the `text` method on the `Data` object to get the raw text data.
5961

6062
<CodeExample js={`import type { AgentContext, AgentRequest, AgentResponse } from '@agentuity/sdk';
6163
@@ -442,7 +444,7 @@ async def run(request: AgentRequest, response: AgentResponse, context: AgentCont
442444
chat_completion = client.chat.completions.create(
443445
messages=[
444446
{"role": "system", "content": "You are a friendly assistant!"},
445-
{"role": "user", "content": request.data.text or "Why is the sky blue?"},
447+
{"role": "user", "content": (await request.data.text()) or "Why is the sky blue?"},
446448
],
447449
model="gpt-4o",
448450
stream=True,

0 commit comments

Comments
 (0)