examples/showcases/chatkit-studio/apps/world/README.md
Interactive world travel app demonstrating CopilotKit and AG-UI protocol integration with LangGraph agents.
Frontend (Next.js)
↓ CopilotKit Runtime
↓ AG-UI Protocol
Backend (LangGraph Agent)
↓ GPT-4o
Key Files:
src/app/api/copilotkit/route.ts - Connects frontend to LangGraph agentsrc/components/MyChat.tsx - Registers renderCountry action via useCopilotActionagent/agent.py - ReAct agent that calls frontend toolsPrerequisites: Node.js 18+, Python 3.13+, OpenAI API key
Setup:
Install dependencies:
npm install
cd agent && python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
Create .env:
OPENAI_API_KEY=your_key_here
Run both servers:
# Terminal 1
npm run dev:agent
# Terminal 2
npm run dev
handleVisit adds to journey & sends message to CopilotKitrenderCountry frontend actionMyChat renders CountryCard + AI response in chatAdd Backend Tool (agent/agent.py):
@tool
def get_weather(country: str):
"""Get weather for a country."""
return f"Weather for {country}"
backend_tools = [get_weather]
Add Frontend Action (any component):
useCopilotAction({
name: "showMap",
render: ({ args }) => <Map country={args.countryName} />,
});
MIT