CopilotKit

Quickstart

Set up Agent Spec + AG‑UI and connect a CopilotKit UI. Includes per‑adapter install steps and a minimal endpoint.


Ship Agent Spec to production
Add persistent threads, observability, and the inspector with the Enterprise Intelligence Platform.
Create a free account

Prerequisites#

  • Node.js 20+
  • Python 3.10–3.13

Getting started#

Create a free account#

Sign up for a free developer account on our Enterprise Intelligence Platform to get a license key. You'll use it later to enable persistent threads, observability, and the inspector.

Choose your starting point#

You can either start fresh with our starter template or connect CopilotKit to an existing Agent Spec agent.

Tools and tool registry#

If your Agent Spec includes server-side tools that execute in the same environment as the agent, map them by name to Python callables in a dictionary tool_registry when loading AgentSpecAgent.

Bind backend tools by name
from __future__ import annotations
from fastapi import FastAPI
from ag_ui_agentspec.agent import AgentSpecAgent
from ag_ui_agentspec.endpoint import add_agentspec_fastapi_endpoint

def get_weather(city: str) -> Dict[str, Any]:
    return {"city": city, "temp_c": 22}

tool_registry = {"get_weather": get_weather}

app = FastAPI()
agent = AgentSpecAgent(
    agent_spec_config=<json/yaml string of your Agent Spec Agent>,
    runtime="langgraph",  # or "wayflow"
    tool_registry=tool_registry,
)
add_agentspec_fastapi_endpoint(app, agentspec_agent=agent, path="/")

Frontend tools (corresponding to Agent Spec ClientTool) run in the browser and don't need to be added to the tool registry — see Generative UI Frontend Tools for details.

What is happening under the hood#

Agent Spec, and the pyagentspec SDK, helps you define agents and workflows in a readable and portable config object/JSON file. The different adapters, LangGraph and WayFlow, loads your Agent Spec configs into framework-specific objects and executes them. In other words, Agent Spec is the "compiler", and the frameworks are the "runtimes". During this conversion process, the adapter configures the loaded object so that it would emit Agent Spec Tracing events. These are standardized across runtimes. Finally, the AG-UI Agent Spec integration listens to Agent Spec Tracing events and exports them to AG-UI events. These include agent execution, tool calls, messages being sent by the agent, etc. In other words, if the agent emits an event during execution (this is runtime-dependent), a corresponding AG-UI event will be created. In the frontend, CopilotKit converts and renders AG-UI events into the UI.

Next steps#

Follow per-adapter tutorials: LangGraph integration and WayFlow integration.

Learn more#