Skip to content

Commit e9a2e14

Browse files
committed
fix(showcase): add shared-tools symlinks and refactor imports
Replace sys.path.insert hacks in Python agent files with direct imports via symlinks to shared/{python,typescript}/tools. Update Dockerfiles, entrypoints, and configs to support the new symlink-based tool resolution. Add PARITY_NOTES for frameworks that have known gaps.
1 parent dd06dd8 commit e9a2e14

164 files changed

Lines changed: 347 additions & 463 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

showcase/integrations/ag2/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ test-results/
1111

1212
# Shared modules (copied by CI)
1313
shared_frontend/
14-
shared_python/

showcase/integrations/ag2/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ COPY --chown=app:app --from=frontend /app/public ./public
5858
COPY --chown=app:app src/agent_server.py ./
5959
COPY --chown=app:app src/agents/ ./agents/
6060

61-
# Shared Python tools (copied into build context by CI/dev-local.sh)
62-
COPY --chown=app:app shared_python/ /app/shared/python/
63-
ENV PYTHONPATH=/app/shared/python
61+
# Shared Python tools (symlinked locally, copied into build context by CI)
62+
COPY --chown=app:app tools/ /app/tools/
63+
ENV PYTHONPATH=/app
6464

6565
# Entrypoint
6666
COPY --chown=app:app entrypoint.sh ./

showcase/integrations/ag2/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ echo "[entrypoint] Next.js started (PID: $NEXTJS_PID)"
6868
# and Railway restarts the container. We kill the agent (not the whole
6969
# script) first so `set -e` + `wait -n; exit $?` handles the restart
7070
# through the normal path rather than a forced `exit` that would bypass
71-
# logging. Generalized from showcase/packages/crewai-crews/entrypoint.sh
71+
# logging. Generalized from showcase/integrations/crewai-crews/entrypoint.sh
7272
# (PRs #4114 + #4115).
7373
(
7474
FAILS=0

showcase/integrations/ag2/manifest.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: >-
77
CopilotKit integration with AG2. Supports the full range of CopilotKit features
88
including generative UI, shared state, human-in-the-loop, sub-agents, and streaming.
99
partner_docs: null
10-
repo: https://github.com/CopilotKit/CopilotKit/tree/main/showcase/packages/ag2
10+
repo: https://github.com/CopilotKit/CopilotKit/tree/main/showcase/integrations/ag2
1111
copilotkit_version: 2.0.0
1212
backend_url: https://showcase-ag2-production.up.railway.app
1313
deployed: true
@@ -220,12 +220,12 @@ demos:
220220
- src/app/demos/frontend-tools-async/notes-card.tsx
221221
- src/app/api/copilotkit/route.ts
222222
starter:
223-
path: showcase/starters/ag2
223+
path: showcase/integrations/ag2
224224
name: Sales Dashboard
225225
description: Full-featured sales pipeline with 4 GenUI rendering strategies
226-
github_url: https://github.com/CopilotKit/CopilotKit/tree/main/showcase/starters/ag2
226+
github_url: https://github.com/CopilotKit/CopilotKit/tree/main/showcase/integrations/ag2
227227
demo_url: https://showcase-starter-ag2-production.up.railway.app
228-
clone_command: npx degit CopilotKit/CopilotKit/showcase/starters/ag2 my-copilotkit-app
228+
clone_command: npx degit CopilotKit/CopilotKit/showcase/integrations/ag2 my-copilotkit-app
229229
managed_platform:
230230
name: Agent OS
231231
url: https://ag2.ai/product

showcase/integrations/ag2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"dev": "concurrently \"next dev --turbopack\" \"python -m uvicorn agent_server:app --host 0.0.0.0 --port 8000 --reload\"",
6+
"dev": "concurrently \"next dev --turbopack\" \"PYTHONPATH=. python -m uvicorn agent_server:app --host 0.0.0.0 --port 8000 --reload\"",
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",

showcase/integrations/ag2/src/agents/agent.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import json
1111
import os
12-
import sys
1312
from typing import Annotated, Any
1413

1514
from autogen import ConversableAgent, LLMConfig
@@ -19,7 +18,6 @@
1918
load_dotenv()
2019

2120
# Import shared tool implementations
22-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "shared", "python"))
2321
from tools import (
2422
get_weather_impl,
2523
query_data_impl,

showcase/integrations/ag2/src/app/demos/agentic-chat/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import { z } from "zod";
1313

1414
export default function AgenticChatDemo() {
1515
return (
16+
// @region[provider-setup]
1617
<CopilotKit runtimeUrl="/api/copilotkit" agent="agentic_chat">
1718
<Chat />
1819
</CopilotKit>
20+
// @endregion[provider-setup]
1921
);
2022
}
2123

@@ -68,6 +70,7 @@ function Chat() {
6870
},
6971
});
7072

73+
// @region[configure-suggestions]
7174
useConfigureSuggestions({
7275
suggestions: [
7376
{
@@ -81,6 +84,7 @@ function Chat() {
8184
],
8285
available: "always",
8386
});
87+
// @endregion[configure-suggestions]
8488

8589
return (
8690
<div

showcase/integrations/ag2/src/app/demos/gen-ui-tool-based/page.tsx

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React, { useState } from "react";
44
import { CopilotKit } from "@copilotkit/react-core";
55
import {
6-
CopilotSidebar,
6+
CopilotChat,
77
useFrontendTool,
88
useConfigureSuggestions,
99
} from "@copilotkit/react-core/v2";
@@ -16,16 +16,30 @@ interface Haiku {
1616
gradient: string;
1717
}
1818

19+
const VALID_IMAGE_NAMES = [
20+
"Osaka_Castle_Turret_Stone_Wall_Pine_Trees_Daytime.jpg",
21+
"Tokyo_Skyline_Night_Tokyo_Tower_Mount_Fuji_View.jpg",
22+
"Itsukushima_Shrine_Miyajima_Floating_Torii_Gate_Sunset_Long_Exposure.jpg",
23+
"Takachiho_Gorge_Waterfall_River_Lush_Greenery_Japan.jpg",
24+
"Bonsai_Tree_Potted_Japanese_Art_Green_Foliage.jpeg",
25+
"Shirakawa-go_Gassho-zukuri_Thatched_Roof_Village_Aerial_View.jpg",
26+
"Ginkaku-ji_Silver_Pavilion_Kyoto_Japanese_Garden_Pond_Reflection.jpg",
27+
"Senso-ji_Temple_Asakusa_Cherry_Blossoms_Kimono_Umbrella.jpg",
28+
"Cherry_Blossoms_Sakura_Night_View_City_Lights_Japan.jpg",
29+
"Mount_Fuji_Lake_Reflection_Cherry_Blossoms_Sakura_Spring.jpg",
30+
];
31+
1932
export default function GenUiToolBasedDemo() {
2033
return (
2134
<CopilotKit runtimeUrl="/api/copilotkit" agent="gen-ui-tool-based">
22-
<SidebarWithSuggestions />
23-
<HaikuDisplay />
35+
<Chat />
2436
</CopilotKit>
2537
);
2638
}
2739

28-
function SidebarWithSuggestions() {
40+
function Chat() {
41+
const [haikus, setHaikus] = useState<Haiku[]>([]);
42+
2943
useConfigureSuggestions({
3044
suggestions: [
3145
{ title: "Nature Haiku", message: "Write me a haiku about nature." },
@@ -35,43 +49,6 @@ function SidebarWithSuggestions() {
3549
available: "always",
3650
});
3751

38-
return (
39-
<CopilotSidebar
40-
defaultOpen={true}
41-
labels={{
42-
modalHeaderTitle: "Haiku Generator",
43-
}}
44-
/>
45-
);
46-
}
47-
48-
const VALID_IMAGE_NAMES = [
49-
"Osaka_Castle_Turret_Stone_Wall_Pine_Trees_Daytime.jpg",
50-
"Tokyo_Skyline_Night_Tokyo_Tower_Mount_Fuji_View.jpg",
51-
"Itsukushima_Shrine_Miyajima_Floating_Torii_Gate_Sunset_Long_Exposure.jpg",
52-
"Takachiho_Gorge_Waterfall_River_Lush_Greenery_Japan.jpg",
53-
"Bonsai_Tree_Potted_Japanese_Art_Green_Foliage.jpeg",
54-
"Shirakawa-go_Gassho-zukuri_Thatched_Roof_Village_Aerial_View.jpg",
55-
"Ginkaku-ji_Silver_Pavilion_Kyoto_Japanese_Garden_Pond_Reflection.jpg",
56-
"Senso-ji_Temple_Asakusa_Cherry_Blossoms_Kimono_Umbrella.jpg",
57-
"Cherry_Blossoms_Sakura_Night_View_City_Lights_Japan.jpg",
58-
"Mount_Fuji_Lake_Reflection_Cherry_Blossoms_Sakura_Spring.jpg",
59-
];
60-
61-
function HaikuDisplay() {
62-
const [haikus, setHaikus] = useState<Haiku[]>([
63-
{
64-
japanese: ["仮の句よ", "まっさらながら", "花を呼ぶ"],
65-
english: [
66-
"A placeholder verse--",
67-
"even in a blank canvas,",
68-
"it beckons flowers.",
69-
],
70-
image_name: null,
71-
gradient: "",
72-
},
73-
]);
74-
7552
useFrontendTool(
7653
{
7754
name: "generate_haiku",
@@ -105,10 +82,7 @@ function HaikuDisplay() {
10582
image_name: image_name || null,
10683
gradient: gradient || "",
10784
};
108-
setHaikus((prev) => [
109-
newHaiku,
110-
...prev.filter((h) => h.english[0] !== "A placeholder verse--"),
111-
]);
85+
setHaikus((prev) => [newHaiku, ...prev]);
11286
return "Haiku generated!";
11387
},
11488
render: ({ args }: { args: Partial<Haiku> }) => {
@@ -120,13 +94,12 @@ function HaikuDisplay() {
12094
);
12195

12296
return (
123-
<div className="relative flex items-center justify-center h-full w-full">
124-
<div className="px-20 py-12 w-full max-w-4xl">
125-
<div className="space-y-6">
126-
{haikus.map((haiku, index) => (
127-
<HaikuCard key={index} haiku={haiku} />
128-
))}
129-
</div>
97+
<div className="flex justify-center items-center h-screen w-full">
98+
<div className="h-full w-full max-w-4xl">
99+
<CopilotChat
100+
agentId="gen-ui-tool-based"
101+
className="h-full rounded-2xl"
102+
/>
130103
</div>
131104
</div>
132105
);

showcase/integrations/ag2/tools

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../shared/python/tools

showcase/integrations/agno/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ test-results/
1111

1212
# Shared modules (copied by CI)
1313
shared_frontend/
14-
shared_python/

0 commit comments

Comments
 (0)