A Turborepo monorepo with a Next.js CopilotKit sidebar and a LangGraph agent. The agent classifies intent, looks up a customer, generates a reply and decides on escalation for a telecom company.
CopilotKit docs · CopilotKit · More examples · studio1hq.com
An AI customer support app for a fictional telecom company, built with CopilotKit and LangGraph. A customer or support rep chats in a CopilotKit sidebar. A LangGraph agent handles the inquiry, looks up the customer's plan, writes a personalised answer and escalates complex issues to a human team.
The repo is a monorepo managed with Turborepo and pnpm workspaces. apps/web is the Next.js frontend and apps/agent is the LangGraph agent.
Demo video
Untitled.design.14.mp4
- Intent Agent: Classifies the customer's message and sets its urgency.
- Customer Lookup Agent: Retrieves the customer profile and service details from sample data.
- Reply Agent: Generates a personalised response from the intent and customer context.
- Escalation Agent: Decides whether to route the issue to a human support team.
- CopilotKit sidebar: Chat UI and shared state between the web app and the agent, with frontend actions available to the agent.
- Customer context in the UI: The web app tracks the current customer and shows service pricing details.
| Layer | Tool |
|---|---|
| Frontend | Next.js 16, React, TypeScript |
| Copilot | CopilotKit 1.50 (react-core, react-ui, runtime) |
| Agent | LangGraph JS, @copilotkit/sdk-js |
| LLM | OpenAI (gpt-4o for the chat node, gpt-5-nano for the escalation tool) via @langchain/openai |
| Monorepo | Turborepo, pnpm workspaces |
- Node.js 18 or later
- pnpm 9.15.0 or later
- An OpenAI API key for the LangGraph agent
git clone https://github.com/Studio1HQ/support-help.git
cd support-help
pnpm install| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI key for the agent. Put it in apps/agent/.env. |
LANGGRAPH_DEPLOYMENT_URL |
Optional. URL of the LangGraph server. Defaults to http://localhost:8123. |
LANGSMITH_API_KEY |
Optional. LangSmith key passed to the LangGraph agent connection. |
cd apps/agent
echo "OPENAI_API_KEY=your-openai-api-key-here" > .envStart both apps with Turborepo. The Next.js app runs on port 3000 and the LangGraph agent on port 8123:
pnpm devOpen http://localhost:3000. Other scripts:
pnpm dev:studio: start the web app and the agent with the LangGraph Studio UI.pnpm build: build all apps.pnpm lint: lint all apps.
Run one app at a time with pnpm filters:
pnpm --filter web dev
pnpm --filter agent devIf you see "I'm having trouble connecting to my tools", check that the LangGraph agent is running, your OpenAI key is set and both servers started.
.
├── apps/
│ ├── web/ # Next.js frontend with the CopilotKit sidebar
│ └── agent/ # LangGraph agent
├── pnpm-workspace.yaml
├── turbo.json
└── package.json
apps/web/src/app/api/copilotkit/route.tscreates aCopilotRuntimewith aLangGraphAgent(starterAgent) that points at the LangGraph server.apps/agent/src/agent.tsbuilds the graph. The chat node binds the CopilotKit frontend actions plus four tools:intentClassifierTool,customerLookupTool,escalationDecisionToolandreplyGeneratorTool. The system prompt tells the model to classify intent, look up the customer, check escalation and then generate the reply.apps/agent/src/agents/holds the four agent nodes andapps/agent/src/types/state.tsthe shared state.- The main UI is
apps/web/src/app/page.tsx. Edit it to change theme colours, add frontend actions or use shared state. - A GitHub Actions workflow (
smoke.yml) runs a smoke test on Ubuntu, Windows and macOS with Node 20 and 22.
- CopilotKit docs: the runtime, UI components and LangGraph integration.
- CopilotKit: the copilot framework used here.
- LangGraph docs: the agent workflow library.
- Next.js documentation: the frontend framework.
Released under the MIT License.
Built by Studio1, the technical content and DevRel partner for devtool teams. Made with CopilotKit.
Browse more open-source examples at github.com/Studio1HQ.
studio1hq.com · Technical content, docs, video and DevRel for devtools
