# Agent

The agent-interop gem: the boot-free poetry-agent MCP server for coding agents, and the WebMCP runtime that registers rendered components' declared tools with the user's browser agent.

poetry-agent is the agent-interop gem - the surfaces through which agents reach the component contract built once in the registry. Five surfaces ship (the AG-UI relay `Poetry::Agent::AGUI` - a Rails-side client folding an agent's event stream into chat-shaped messages relayed as versioned Turbo Streams, with a component's declared tools advertised as the agent's frontend tools and executed in the browser - and the A2UI catalog `Poetry::Agent::A2UI::Catalog`, the registry projected as an A2UI v1.0 catalog served at /a2ui/catalog.json, and the A2UI renderer - `Session`, `Renderer`, `Streams`, `Functions` - rendering surfaces on the server as forms delivered as morphing versioned Turbo Streams, with the catalog's functions and checks run on the server and again in the browser, join the two below): `Poetry::Agent::MCP::Server`, the boot-free `bundle exec poetry-agent` stdio MCP server (ten read-only tools: compose, build_page, list_components, describe_component, check, list_blocks, describe_block, list_recipes, get_skill, guidance) that coding agents in Claude Code, Cursor, VS Code, Zed, and RubyMine use to query and verify against what your app actually ships; and the WebMCP runtime, `registerPoetryAgent(application)`, whose registrar controller registers an opted-in component instance's declared tools with the browser's `document.modelContext` for the user's own agent, plus the declarative-form controller (agent-invoked submits answer through `SubmitEvent.respondWith`) and the `Poetry::Agent::WebMCP::OriginTrial` middleware that serves origin-trial tokens. Install: `gem "poetry-agent"`; the engine registers its controllers manifest with poetry-core and pins `@poetry/agent` in the importmap.
