quickstart
Tutorial: Quickstart
This tutorial summarizes the shortest path from zero to a working preview with the SDK. Full detail lives in packages/sdk/examples/README.md.
Prerequisites
- Node.js 20+ recommended (
fetch,crypto.randomUUID). - Clone the repo and install dependencies from the repository root:
npm install
- For examples that call OpenAI: a
.env(or environment) withOPENAI_API_KEY=....
Step 1: Understand the three pieces
RemotePlayWorld— HTTP client:connect()→ session,addAgent, RPC for interactions and journeys.- LangChain adapter —
langchainRegistration(agent)validateschat_tooland indexesassist_*tools for the watch UI (not map layout); pair it withRemotePlayWorld(requiresapiKeyon construction). - Watch UI — Served by
@agent-play/web-uiat/agent-play/watch; resolves session via/api/agent-play/sessionand streams updates (SSE, etc.).
@deprecated:
start()→ useconnect(); tool-sync RPC and tool-derived structures were removed in world map v3. Author spaces via AQL orregisterSpaceNodewith an owner.
Step 2: Run the web app
npm run dev
This starts @agent-play/web-ui (often http://127.0.0.1:3000).
Step 3: Run the minimal SDK example
In a second terminal, from the repository root:
npx tsx -r dotenv/config packages/sdk/examples/01-remote-web-ui-langchain.ts
Or: npm run example
Open the printed preview URL in a browser to see the canvas.
Step 4: Two players
npm run example:02
Next steps
- Read examples.md for the ordered example list.
- Read Architecture and SDK reference when integrating into your own server.