Skip to content

Commit 01c71e0

Browse files
committed
temp
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 43c9dcf commit 01c71e0

File tree

10 files changed

+960
-539
lines changed

10 files changed

+960
-539
lines changed

agent/main.py

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,52 @@
1+
"""Agentic Chat example for AWS Strands.
2+
3+
Simple conversational agent with change_background frontend tool.
14
"""
2-
Example for serving you Agno agent as an AG-UI server
3-
"""
45

5-
import dotenv
6-
from agno.os import AgentOS
7-
from agno.os.interfaces.agui import AGUI
6+
import os
7+
8+
from ag_ui_strands import StrandsAgent, create_strands_app
9+
from dotenv import load_dotenv
10+
from strands import Agent, tool
11+
from strands.models.openai import OpenAIModel
12+
13+
load_dotenv()
14+
15+
# Debug: Print API key status (first 10 chars only for security)
16+
api_key = os.getenv("OPENAI_API_KEY", "")
817

9-
from src.agent import agent
18+
# Use Gemini model
19+
model = OpenAIModel(
20+
client_args={"api_key": api_key},
21+
model_id="gpt-5.1",
22+
)
1023

11-
dotenv.load_dotenv()
1224

13-
# Build AgentOS and extract the app for serving
14-
agent_os = AgentOS(agents=[agent], interfaces=[AGUI(agent=agent)])
15-
app = agent_os.get_app()
25+
@tool
26+
def get_weather(location: str):
27+
"""
28+
The theme color to set. Make sure to pick nice CSS safe colors.
29+
"""
30+
# Return None - frontend will handle the actual execution
31+
return "Sunny and 70 degrees"
32+
33+
34+
strands_agent = Agent(
35+
model=model,
36+
tools=[get_weather], # Register so LLM knows about it
37+
system_prompt="You are a helpful assistant.",
38+
)
39+
40+
agui_agent = StrandsAgent(
41+
agent=strands_agent,
42+
name="agentic_chat",
43+
description="Conversational Strands agent with AG-UI streaming",
44+
)
45+
46+
app = create_strands_app(agui_agent, "/")
1647

1748
if __name__ == "__main__":
18-
agent_os.serve(app="main:app", port=8000, reload=True)
49+
# run the app
50+
import uvicorn
51+
52+
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)

agent/pyproject.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[project]
2-
name = "investment-analyst-agent"
2+
name = "aws-strands-server"
33
version = "0.1.0"
4-
description = "An Agno Agent with Finance tools exposed in an AG-UI compatible way"
5-
requires-python = ">=3.12"
4+
description = "Strands integration server for AG-UI using OpenAI models"
5+
authors = [{ name = "AG-UI Contributors" }]
6+
readme = "README.md"
7+
requires-python = ">=3.12,<3.14"
68
dependencies = [
7-
"agno>=1.7.8",
8-
"openai>=1.88.0",
9-
"yfinance>=0.2.63",
10-
"fastapi>=0.115.13",
9+
"ag-ui-protocol>=0.1.5",
10+
"fastapi>=0.115.12",
1111
"uvicorn>=0.34.3",
12-
"ag-ui-protocol>=0.1.8",
13-
"packaging>=25.0.0",
14-
"python-dotenv>=1.0.0",
12+
"strands-agents[OpenAI]>=1.15.0",
13+
"strands-agents-tools>=0.2.14",
14+
"ag_ui_strands==0.1.0a2",
1515
]

agent/src/agent.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

agent/src/tools/backend.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

agent/src/tools/frontend.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

agent/uv.lock

Lines changed: 885 additions & 446 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@ag-ui/agno": "0.0.3",
17+
"@ag-ui/client": "^0.0.41",
1718
"@copilotkit/react-core": "1.10.6",
1819
"@copilotkit/react-ui": "1.10.6",
1920
"@copilotkit/runtime": "1.10.6",

src/app/api/copilotkit/route.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ import {
44
copilotRuntimeNextJSAppRouterEndpoint,
55
} from "@copilotkit/runtime";
66

7-
import { AgnoAgent } from "@ag-ui/agno"
7+
import { HttpAgent } from "@ag-ui/client";
88
import { NextRequest } from "next/server";
9-
9+
1010
// 1. You can use any service adapter here for multi-agent support. We use
1111
// the empty adapter since we're only using one agent.
1212
const serviceAdapter = new ExperimentalEmptyAdapter();
13-
13+
1414
// 2. Create the CopilotRuntime instance and utilize the Agno AG-UI
1515
// integration to setup the connection.
1616
const runtime = new CopilotRuntime({
1717
agents: {
1818
// Our FastAPI endpoint URL
19-
"agno_agent": new AgnoAgent({url: "http://localhost:8000/agui"}),
20-
}
19+
strands_agent: new HttpAgent({ url: "http://localhost:8000" }),
20+
},
2121
});
22-
22+
2323
// 3. Build a Next.js API route that handles the CopilotKit runtime requests.
2424
export const POST = async (req: NextRequest) => {
2525
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
26-
runtime,
26+
runtime,
2727
serviceAdapter,
2828
endpoint: "/api/copilotkit",
2929
});
30-
30+
3131
return handleRequest(req);
32-
};
32+
};

src/app/layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ export default function RootLayout({
1717
return (
1818
<html lang="en">
1919
<body className={"antialiased"}>
20-
<CopilotKit runtimeUrl="/api/copilotkit" agent="agno_agent">
20+
<CopilotKit
21+
runtimeUrl="/api/copilotkit"
22+
agent="strands_agent"
23+
threadId="foo"
24+
>
2125
{children}
2226
</CopilotKit>
2327
</body>

src/app/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ import {
66
useRenderToolCall,
77
} from "@copilotkit/react-core";
88
import { CopilotKitCSSProperties, CopilotSidebar } from "@copilotkit/react-ui";
9-
import { useState } from "react";
9+
import { useEffect, useState } from "react";
1010
import { DefaultToolComponent } from "@/components/default-tool-ui";
1111
import { WeatherCard } from "@/components/weather";
1212

1313
export default function CopilotKitPage() {
1414
const [themeColor, setThemeColor] = useState("#6366f1");
1515

16+
useEffect(() => {
17+
console.log(themeColor);
18+
}, [themeColor]);
19+
1620
// 🪁 Frontend Actions: https://docs.copilotkit.ai/guides/frontend-actions
1721
useFrontendTool({
1822
name: "set_theme_color",

0 commit comments

Comments
 (0)