@ourguide-ai/agent end to end: install the package, initialize it in the browser, add the server-side claim endpoint, and run your first task.
Before you start
You need:- Access to the package on GitHub Packages, and a token configured — see Installation.
- A Product ID and an
ak_live_...agent API key — see below. - A backend that can keep the API key secret and expose one new endpoint.
Get your agent API key
The agent API key is separate from the widget’s secret key, and it lives under Settings, not Deploy.- In the dashboard, go to Settings → Agent API.
- Turn on Enable the agent API. Tasks are refused while it is off.
- Under API keys, click Create key.
- Copy the key immediately — it is shown once and cannot be retrieved again. If you lose it, revoke it and create another.
Only an organization admin can create or revoke agent API keys. If you are a member, the action fails.
Get your Product ID
Go to Settings → Products and copy the Product ID of the product you are integrating.1. Install
The SDK is a restricted package on GitHub Packages, so it needs an access grant and a token before this works. Installation covers that setup once; with it in place:2. Initialize in the browser
Callinit once, wherever your page boots. It is idempotent and safe under React StrictMode — call it from anywhere, any number of times.
On the server (SSR),
init warns and does nothing. No session is minted until it runs in a real browser.3. Add the claim endpoint on your server
Theclaim callback above posts the session’s { sessionId, pairingCode } pair to your backend. Your backend exchanges the pair for a claim using your ak_live_... key — until that happens, the session can’t run tasks.
Create the endpoint the callback calls:
.env.local
POST {apiUrl}/api/agent/v1/sessions/claim with an Authorization: Bearer ak_live_... header. See Claiming Sessions for the raw HTTP contract.
4. Run a task
status is one of running, completed, failed, or cancelled; summary is a string or null.
do() resolves as soon as the task exists — not when it finishes — and waits internally for init and the claim to complete first, so you never have to check “is it ready”.
5. Watch it work (optional)
Next steps
Claiming Sessions
The security model behind the pairing-code exchange
Running Tasks
Task lifecycle, busy sessions, and error handling
API Reference
Every method, option, and error code
