Documentation
Agent Play — developer documentation
For project vision and community framing, read the repository README.
Agent Play is a Spatial AI Playground — walk a live multiverse where you and AI agents share one map. The TypeScript SDK plus browser client visualize agent runs on a 2D world: agents and MCP servers sit on a shared grid (worldMap.occupants), journeys draw paths, and SSE delivers live updates.
Where the code lives
The repository uses npm workspaces. packages/sdk is the Node.js package @agent-play/sdk: RemotePlayWorld, LangChain adapter, and tests. packages/play-ui is the Vite application @agent-play/play-ui (Pixi.js canvas, chat UI, settings), vendored into packages/web-ui for the Next.js app. packages/geography-mesh is @agent-play/geography-mesh (AOI + Yjs geography helpers). packages/cli builds the agent-play CLI (create / delete agents and API keys). packages/sdk/examples holds runnable scripts that demonstrate registration and streaming.
Documentation map
| Document | Contents |
|---|---|
| Development guide | Local setup, env templates, running the stack, troubleshooting |
| World map v3 | Snapshot/RPC: occupants-only map, getWorldSnapshot, getPlayerChainNode, fanout playerChainNotify, 100-occupant cap |
| Occupant Model v1 | Occupant taxonomy (human, agent, mcp), interaction policy, and the end-to-end fanout + player-chain convergence story across SDK/web-ui clients |
| Occupancy Protocol v1 (OpenAPI) | Swagger/OpenAPI host contract for page-origin world clients (occupancy-v1.openapi.yaml); API base https://agent-play.com/api/agent-play |
| Kubernetes deployment | Index; k8s/ (startup, deployment, Redis, server) |
| Notes / runbooks | World model + player chain (deep dive), k8s debugging (runbook) |
| Geography mesh | @agent-play/geography-mesh — AOI neighbor selection, Yjs pose helpers, Zod wire schemas, how host/client use it |
| npm & CI | @agent-play/sdk, @agent-play/cli, @agent-play/play-ui, @agent-play/geography-mesh, publish workflow, TypeDoc / GitHub Pages |
| API reference (generated) | How HTML docs are built and deployed |
| Pending feature backlog | Remaining roadmap: card payments, developer dashboard, custom avatars |
| Space platform | /platform — purchase KPIs, amenities, space wallet, embedded AQL |
| Agent Play Scanner | /scanner — public ledger, nodes, analytics, tx detail |
| Maple Ave. Arcade | Built-in arcade cabinets (replaces deprecated public MCP amenities) |
| Overview | How the SDK and UI relate, and why they are separate deployables |
| Monorepo | Workspaces, build order, root scripts |
| Release 3.1.1 | World switch, amenity stages, wallet, sold state, AQL extensions — overworld → space yard → amenity stage controller, bookstore / supermarket / car-wash stages, $70 wallet seed, ADD SHOP ITEM/ADD SUPERMARKET ITEM/ADD CARWASH CAR, Esc + exit-door exits |
| Payments, wallets & talk billing | Per-node wallets (legacy), amenity purchase atomicity, power-ups, realtime talk billing |
| x402 + Solana payments | Production payment series: x402, Solana USDC, wallet linking, settlement, migration — plan |
| Release 3.1.0 | npm intercom package, TypeDoc fixes, Docker/agents, play-ui and SDK highlights since 3.0.x |
| AQL | Agent Query Language: playground scripting, language reference, integration. Public pages: /agent-playground and /aql (occupancy https://agent-play.com; world1.v0peer.org is a disposable alias) |
| SDK | RemotePlayWorld, player-chain incremental sync (getPlayerChainNode, subscribeWorldState, merge helpers), LangChain adapter |
| Play UI | Static build, same-origin vs split deployment, VITE_PLAY_API_BASE |
| Multiplayer | Human movement, proximity, A/C/Z/Y actions |
| Redis / repository | AgentRepository, Redis key layout, no agent position streams |
| CLI | agent-play create / delete |
| Initialize agent server and template | End-to-end guide for agent-play initialize, node bootstrap, env hydration, and running generated LangChain starter |
| API keys | Issuing keys, SDK usage, rotation |
| MCP registration | PlayWorld.registerMCP and snapshot |
| P2A implementation architecture | Peer to Agent audio architecture: assist-background execution, response processor, ringer play rooms, and canvas UX controls |
| Assist tools as world background runtime | Defines assist tools as the primary world background execution model and its role in P2A delivery flow |
| Intercom-address architecture | Core P2A addressing model for Agent Ringer: shareable intercom-address://{channelKey}, open inbound text/audio/media delivery, and / page display behavior |
| P2A realtime hub | OpenAI Realtime via SDK initAudio() + client secrets (enableP2a on addAgent), no LiveKit |
In-browser docs (/doc) |
How docs/ is copied into web-ui, App Router layout, Docker |
Older topic-specific pages such as Architecture, Core features, and Events, SSE, and remote API may still describe paths as play-sdk/; treat packages/sdk and packages/play-ui as the current locations.
Run examples from the repo root with npm run example (see root package.json) or npm run example -w @agent-play/sdk.
When web-ui is running, developer docs under docs/ are copied into the app at build/dev time and browsed at /doc. See In-browser documentation for URLs, copy pipeline, and implementation details. The watch canvas links to /doc from the bottom-left.