CopilotKit / Intelligence Runtime GuideFive languages · One runner

Developer guide / ui

A2UI and MCP Apps

UI middleware changes agent inputs and events before Intelligence stores them. It does not replace the runner.

Draft · The release review is in progress.

A2UI input

A2UI can add a render tool and component schema. A string in injectA2UITool selects a custom tool name.

The agents configuration limits A2UI to named agents. An explicit enabled: false overrides a browser catalog flag.

A browser action becomes assistant and tool history through log_a2ui_event. The next agent run can use that action as context.

A2UI output

The middleware waits for a complete component array before it sends a surface snapshot. It rejects duplicate IDs, missing children, and cycles.

The data.items array can update as complete items arrive. The component tree remains atomic.

Building, retrying, and failed activities use a stable surface message ID. A rendered tool result precedes the final run event.

The agent adapter owns model retries. The middleware validates retry output and reports its state.

MCP tools

The middleware initializes an MCP session and lists tools. Only tools with a UI resource enter the agent tool list.

After the agent requests a UI tool, the middleware calls the MCP server. It emits a tool result and an mcp-apps activity.

The activity contains the resource, server identity, tool input, and result. The middleware sends it before the final run event.

Iframe requests

An iframe can call a tool or read a resource through a configured server. These requests bypass the agent.

The allowlist contains tools/call, resources/read, notifications/message, and ping. Unknown servers and blocked methods must not trigger a connection.

Server IDs and agent scope determine access. Browser URL and header fields cannot override trusted configuration.

Connect an MCP server

MCP Apps connects to Streamable HTTP servers. Configure the server URL and authentication headers in your application.

Your server keeps these headers private. The runtime initializes each MCP session and closes it after use.

The libraries accept JSON and SSE responses from Streamable HTTP servers.

Read the source packages