Skip to content

Commit cdfaaf0

Browse files
authored
Merge pull request #155 from awslabs/issue-121-openai-agent-missing-property
Fix issue #121
2 parents cd62ac3 + 876f3dc commit cdfaaf0

File tree

18 files changed

+2210
-530
lines changed

18 files changed

+2210
-530
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ if (response.streaming == true) {
247247
# Optional: Set up a virtual environment
248248
python -m venv venv
249249
source venv/bin/activate # On Windows use `venv\Scripts\activate`
250-
pip install multi-agent-orchestrator
250+
pip install multi-agent-orchestrator[aws]
251251
```
252252

253253
#### Default Usage

docs/src/content/docs/agents/built-in/amazon-bedrock-agent.mdx

Lines changed: 168 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,189 @@ The `AmazonBedrockAgent` is a specialized agent class in the Multi-Agent Orchest
77

88
## Creating an AmazonBedrockAgent
99

10-
To create a new `AmazonBedrockAgent` with only the required parameters, use the following code:
10+
Here are various examples showing different ways to create and configure an AmazonBedrockAgent:
11+
12+
### Basic Examples
13+
14+
**1. Minimal Configuration**
1115

1216
import { Tabs, TabItem } from '@astrojs/starlight/components';
1317

1418
<Tabs syncKey="runtime">
1519
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
16-
```typescript
17-
import { AmazonBedrockAgent } from 'multi-agent-orchestrator';
18-
19-
const agent = new AmazonBedrockAgent({
20-
name: 'My Bank Agent',
21-
description: 'You are a helpful and friendly agent that answers questions about loan-related inquiries',
22-
agentId: 'your-agent-id',
23-
agentAliasId: 'your-agent-alias-id'
24-
});
25-
```
20+
```typescript
21+
const agent = new AmazonBedrockAgent({
22+
name: 'My Bank Agent',
23+
description: 'A helpful and friendly agent that answers questions about loan-related inquiries',
24+
agentId: 'your-agent-id',
25+
agentAliasId: 'your-agent-alias-id'
26+
});
27+
```
28+
</TabItem>
29+
<TabItem label="Python" icon="seti:python">
30+
```python
31+
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
32+
name='My Bank Agent',
33+
description='A helpful and friendly agent that answers questions about loan-related inquiries',
34+
agent_id='your-agent-id',
35+
agent_alias_id='your-agent-alias-id'
36+
))
37+
```
2638
</TabItem>
39+
</Tabs>
40+
41+
<hr/>
42+
43+
**2. Using Custom Client**
44+
45+
<Tabs syncKey="runtime">
46+
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
47+
```typescript
48+
import { BedrockAgentRuntimeClient } from "@aws-sdk/client-bedrock-agent-runtime";
49+
const customClient = new BedrockAgentRuntimeClient({ region: 'us-east-1' });
50+
const agent = new AmazonBedrockAgent({
51+
name: 'My Bank Agent',
52+
description: 'A helpful and friendly agent for banking inquiries',
53+
agentId: 'your-agent-id',
54+
agentAliasId: 'your-agent-alias-id',
55+
client: customClient
56+
});
57+
```
58+
</TabItem>
2759
<TabItem label="Python" icon="seti:python">
28-
```python
29-
from multi_agent_orchestrator.agents import AmazonBedrockAgent, AmazonBedrockAgentOptions
30-
31-
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
32-
name='My Bank Agent',
33-
description='You are a helpful and friendly agent that answers questions about loan-related inquiries',
34-
agent_id='your-agent-id',
35-
agent_alias_id='your-agent-alias-id'
36-
))
37-
```
60+
```python
61+
import boto3
62+
custom_client = boto3.client('bedrock-agent-runtime', region_name='us-east-1')
63+
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
64+
name='My Bank Agent',
65+
description='A helpful and friendly agent for banking inquiries',
66+
agent_id='your-agent-id',
67+
agent_alias_id='your-agent-alias-id',
68+
client=custom_client
69+
))
70+
```
71+
</TabItem>
72+
</Tabs>
73+
74+
<hr/>
75+
76+
**3. With Tracing Enabled**
77+
78+
<Tabs syncKey="runtime">
79+
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
80+
```typescript
81+
const agent = new AmazonBedrockAgent({
82+
name: 'My Bank Agent',
83+
description: 'A banking agent with tracing enabled',
84+
agentId: 'your-agent-id',
85+
agentAliasId: 'your-agent-alias-id',
86+
enableTrace: true
87+
});
88+
```
89+
</TabItem>
90+
<TabItem label="Python" icon="seti:python">
91+
```python
92+
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
93+
name='My Bank Agent',
94+
description='A banking agent with tracing enabled',
95+
agent_id='your-agent-id',
96+
agent_alias_id='your-agent-alias-id',
97+
enable_trace=True
98+
))
99+
```
38100
</TabItem>
39101
</Tabs>
40102

41-
In this basic example, we provide the four required parameters: `name`, `description`, `agent_id`, and `agent_alias_id`.
103+
<hr/>
104+
105+
**4. With Streaming Enabled**
106+
107+
<Tabs syncKey="runtime">
108+
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
109+
```typescript
110+
const agent = new AmazonBedrockAgent({
111+
name: 'My Bank Agent',
112+
description: 'A streaming-enabled banking agent',
113+
agentId: 'your-agent-id',
114+
agentAliasId: 'your-agent-alias-id',
115+
streaming: true
116+
});
117+
```
118+
</TabItem>
119+
<TabItem label="Python" icon="seti:python">
120+
```python
121+
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
122+
name='My Bank Agent',
123+
description='A streaming-enabled banking agent',
124+
agent_id='your-agent-id',
125+
agent_alias_id='your-agent-alias-id',
126+
streaming=True
127+
))
128+
```
129+
</TabItem>
130+
</Tabs>
131+
132+
<hr/>
133+
134+
**5. Complete Example with All Options**
135+
136+
<Tabs syncKey="runtime">
137+
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
138+
```typescript
139+
import { AmazonBedrockAgent } from "multi-agent-orchestrator";
140+
import { BedrockAgentRuntimeClient } from "@aws-sdk/client-bedrock-agent-runtime";
141+
const agent = new AmazonBedrockAgent({
142+
// Required fields
143+
name: "Advanced Bank Agent",
144+
description: "A fully configured banking agent with all features enabled",
145+
agentId: "your-agent-id",
146+
agentAliasId: "your-agent-alias-id",
147+
// Optional fields
148+
region: "us-west-2",
149+
streaming: true,
150+
enableTrace: true,
151+
client: new BedrockAgentRuntimeClient({ region: "us-west-2" }),
152+
});
153+
154+
```
155+
</TabItem>
156+
<TabItem label="Python" icon="seti:python">
157+
```python
158+
import boto3
159+
from multi_agent_orchestrator.agents import AmazonBedrockAgent, AmazonBedrockAgentOptions
160+
161+
custom_client = boto3.client('bedrock-agent-runtime', region_name='us-west-2')
162+
163+
agent = AmazonBedrockAgent(AmazonBedrockAgentOptions(
164+
# Required fields
165+
name='Advanced Bank Agent',
166+
description='A fully configured banking agent with all features enabled',
167+
agent_id='your-agent-id',
168+
agent_alias_id='your-agent-alias-id',
169+
170+
# Optional fields
171+
region='us-west-2',
172+
streaming=True,
173+
enable_trace=True,
174+
client=custom_client
175+
))
176+
```
177+
</TabItem>
178+
</Tabs>
179+
42180

43181
### Option Explanations
44182

45183
- `name`: (Required) Identifies the agent within your system.
46184
- `description`: (Required) Describes the agent's purpose or capabilities.
47-
- `agent_id`: (Required) The ID of the Amazon Bedrock agent you want to use.
48-
- `agent_alias_id`: (Required) The alias ID of the Amazon Bedrock agent.
49-
- `enableTrace`: If you set enableTrace to `true` in the request, you can trace the agent’s steps and reasoning process that led it to the response.
50-
- `streaming`: Specifies whether to enable streaming for the final response. This is set to false by default `False`
185+
- `agentId/agent_id`: (Required) The ID of the Amazon Bedrock agent you want to use.
186+
- `agentAliasId/agent_alias_id`: (Required) The alias ID of the Amazon Bedrock agent.
187+
- `region`: (Optional) AWS region for the Bedrock service. If not provided, uses the default AWS region.
188+
- `client`: (Optional) Custom BedrockAgentRuntimeClient for specialized configurations.
189+
- `enableTrace/enable_trace`: (Optional) When set to true, enables tracing of the agent's steps and reasoning process.
190+
- `streaming`: (Optional) Enables streaming for the final response. Defaults to false.
191+
192+
51193

52194
## Adding the Agent to the Orchestrator
53195

0 commit comments

Comments
 (0)