Skip to content

Commit f14c010

Browse files
Rana Umar MajeedRana Umar Majeed
authored andcommitted
Add AWS Strands integration
- Implement StrandsAgent wrapper for AG-UI protocol - Add example agents (agentic_chat, agentic_chat_reasoning, backend_tool_rendering, agentic_generative_ui, shared_state) - Streamline .gitignore files - Remove debug print statements Closes #35
1 parent 9e5c6a7 commit f14c010

32 files changed

+4650
-12
lines changed

apps/dojo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@ag-ui/server-starter": "workspace:*",
2626
"@ag-ui/server-starter-all-features": "workspace:*",
2727
"@ag-ui/vercel-ai-sdk": "workspace:*",
28+
"@ag-ui/aws-strands-integration": "workspace:*",
2829
"@ai-sdk/openai": "^2.0.42",
2930
"@copilotkit/react-core": "1.10.6",
3031
"@copilotkit/react-ui": "1.10.6",

apps/dojo/src/agents.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ADKAgent } from "@ag-ui/adk";
1919
import { SpringAiAgent } from '@ag-ui/spring-ai';
2020
import { HttpAgent } from "@ag-ui/client";
2121
import { A2AMiddlewareAgent } from "@ag-ui/a2a-middleware";
22+
import { AWSStrandsAgent } from "@ag-ui/aws-strands-integration";
2223

2324
const envVars = getEnvVars();
2425
export const agentsIntegrations: AgentIntegrationConfig[] = [
@@ -375,4 +376,24 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
375376
};
376377
},
377378
},
379+
// {
380+
// id: "aws-strands-integration",
381+
// agents: async () => {
382+
// return {
383+
// agentic_chat: new AWSStrandsAgent({ url: `${envVars.awsStrandsUrl}/agent/agentic_chat` }),
384+
// backend_tool_rendering: new AWSStrandsAgent({ url: `${envVars.awsStrandsUrl}/agent/backend_tool_rendering` }),
385+
// };
386+
// },
387+
// },
388+
{
389+
id: "aws-strands",
390+
agents: async () => {
391+
return {
392+
agentic_chat: new HttpAgent({ url: `${envVars.awsStrandsUrl}/agentic-chat` }),
393+
backend_tool_rendering: new HttpAgent({ url: `${envVars.awsStrandsUrl}/backend-tool-rendering` }),
394+
agentic_generative_ui: new HttpAgent({ url: `${envVars.awsStrandsUrl}/agentic-generative-ui` }),
395+
shared_state: new HttpAgent({ url: `${envVars.awsStrandsUrl}/shared-state` }),
396+
};
397+
},
398+
},
378399
];

apps/dojo/src/env.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type envVars = {
1515
a2aMiddlewareFinanceUrl: string;
1616
a2aMiddlewareItUrl: string;
1717
a2aMiddlewareOrchestratorUrl: string;
18+
awsStrandsUrl: string;
1819
customDomainTitle: Record<string, string>;
1920
}
2021

@@ -44,6 +45,7 @@ export default function getEnvVars(): envVars {
4445
a2aMiddlewareFinanceUrl: process.env.A2A_MIDDLEWARE_FINANCE_URL || 'http://localhost:9002',
4546
a2aMiddlewareItUrl: process.env.A2A_MIDDLEWARE_IT_URL || 'http://localhost:9003',
4647
a2aMiddlewareOrchestratorUrl: process.env.A2A_MIDDLEWARE_ORCHESTRATOR_URL || 'http://localhost:9000',
48+
awsStrandsUrl: process.env.AWS_STRANDS_URL || 'http://localhost:8000',
4749
customDomainTitle: customDomainTitle,
4850
}
4951
}

apps/dojo/src/files.json

Lines changed: 12 additions & 12 deletions
Large diffs are not rendered by default.

apps/dojo/src/menu.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,14 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
160160
name: "A2A",
161161
features: ["a2a_chat"],
162162
},
163+
{
164+
id: "aws-strands",
165+
name: "AWS Strands",
166+
features: [
167+
"agentic_chat",
168+
"backend_tool_rendering",
169+
"agentic_generative_ui",
170+
"shared_state",
171+
],
172+
},
163173
];
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.nox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
*.py,cover
48+
.hypothesis/
49+
.pytest_cache/
50+
cover/
51+
52+
# pyenv
53+
# For a library or package, you might want to ignore these files since the code is
54+
# intended to run in multiple environments; otherwise, check them in:
55+
# .python-version
56+
57+
# pipenv
58+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
59+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
60+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
61+
# install all needed dependencies.
62+
# Pipfile.lock
63+
64+
# UV
65+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
66+
# This is especially recommended for binary packages to ensure reproducibility, and is more
67+
# commonly ignored for libraries.
68+
# uv.lock
69+
70+
# poetry
71+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
72+
# This is especially recommended for binary packages to ensure reproducibility, and is more
73+
# commonly ignored for libraries.
74+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
75+
# poetry.lock
76+
# poetry.toml
77+
78+
# pdm
79+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
80+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
81+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
82+
# pdm.lock
83+
# pdm.toml
84+
.pdm-python
85+
.pdm-build/
86+
87+
# pixi
88+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
89+
# pixi.lock
90+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
91+
# in the .venv directory. It is recommended not to include this directory in version control.
92+
.pixi
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
95+
__pypackages__/
96+
97+
# Environments
98+
.env
99+
.envrc
100+
.venv
101+
env/
102+
venv/
103+
ENV/
104+
env.bak/
105+
venv.bak/
106+
107+
# Spyder project settings
108+
.spyderproject
109+
.spyproject
110+
111+
# Rope project settings
112+
.ropeproject
113+
114+
# mypy
115+
.mypy_cache/
116+
.dmypy.json
117+
dmypy.json
118+
119+
# Ruff
120+
.ruff_cache/
121+
122+
# PyPI configuration file
123+
.pypirc
124+
125+
# IDE
126+
.vscode/
127+
.idea/
128+
*.swp
129+
*.swo
130+
*~
131+
132+
# OS
133+
.DS_Store
134+
Thumbs.db
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
*.py,cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# pyenv
53+
.python-version
54+
55+
# pipenv
56+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
57+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
58+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
59+
# install all needed dependencies.
60+
#Pipfile.lock
61+
62+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
63+
__pypackages__/
64+
65+
# Environments
66+
.env
67+
.venv
68+
env/
69+
venv/
70+
ENV/
71+
env.bak/
72+
venv.bak/
73+
74+
# Spyder project settings
75+
.spyderproject
76+
.spyproject
77+
78+
# Rope project settings
79+
.ropeproject
80+
81+
# mypy
82+
.mypy_cache/
83+
.dmypy.json
84+
dmypy.json
85+
86+
# Ruff
87+
.ruff_cache/
88+
89+
# IDE
90+
.vscode/
91+
.idea/
92+
*.swp
93+
*.swo
94+
*~
95+
96+
# OS
97+
.DS_Store
98+
Thumbs.db
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Strands Integration (OpenAI)
2+
3+
This integration demonstrates how to use Strands Agents SDK with OpenAI models and AG-UI protocol.
4+
5+
## Prerequisites
6+
7+
- Python 3.12 or later
8+
- Poetry for dependency management
9+
- OpenAI API key
10+
- Strands Agents SDK with OpenAI support installed
11+
12+
## Setup
13+
14+
1. Install Strands SDK with OpenAI support:
15+
```bash
16+
pip install 'strands-agents[openai]'
17+
```
18+
19+
2. Configure OpenAI API key:
20+
```bash
21+
# Set your OpenAI API key (required)
22+
export OPENAI_API_KEY=your-api-key-here
23+
```
24+
25+
3. Optional: Configure OpenAI model settings:
26+
```bash
27+
# Set the OpenAI model to use (default: gpt-4o)
28+
export OPENAI_MODEL=gpt-4o
29+
30+
# Set max tokens (default: 2000)
31+
export OPENAI_MAX_TOKENS=2000
32+
33+
# Set temperature (default: 0.7)
34+
export OPENAI_TEMPERATURE=0.7
35+
```
36+
37+
4. Install dependencies:
38+
```bash
39+
cd integrations/aws-strands-integration/python/examples
40+
poetry install
41+
```
42+
43+
## Running the server
44+
45+
To run the server:
46+
47+
```bash
48+
cd integrations/aws-strands-integration/python/examples
49+
50+
poetry install && poetry run dev
51+
```
52+
53+
The server will start on `http://localhost:8000` by default. You can change the port by setting the `PORT` environment variable.
54+
55+
## Integration Details
56+
57+
This integration uses the Strands Agents SDK with OpenAI models. The server:
58+
- Accepts AG-UI protocol requests
59+
- Connects to OpenAI models via Strands SDK
60+
- Streams responses back as AG-UI events
61+
- Handles tool calls and state management
62+
63+
## Notes
64+
65+
- The integration uses OpenAI models (default: gpt-4o)
66+
- Ensure your OpenAI API key is valid and has access to the specified model
67+
- The integration supports streaming responses when available in the Strands SDK
68+
- You can customize the model, max_tokens, and temperature via environment variables
69+

0 commit comments

Comments
 (0)