Test your embed
Verify real replies, identity isolation, token lifecycle and refusal paths.
Before going live, verify conversations and refusal paths in your actual host website. These are acceptance scenarios to execute. A visible component or praxis.ready proves mounting, not successful authentication or a model reply.
Prepare the test environment
Use an isolated service agent, available model and environment, saved embed policy, and an integrated host page. Allow that page's actual origin and set an affordable budget. Prepare host test accounts A and B with distinct external_user_id values derived from authenticated server sessions.
First select a version and send a question in Service agents → Select agent → Integration and configuration → Playground (试用调试). This checks configuration. Then test the host below. Dashboard simulation does not test host login, domains or token endpoints, and does not enter customer operations statistics.
Run acceptance scenarios
| Input or action | Expected result and verification |
|---|---|
| A logs in and asks about a course | An actual reply appears; Operations → Sessions contains the same message, user and source |
| Call your host token endpoint while logged out | The host refuses issuance and returns no embed token |
| Load from an origin outside the allowlist | Access fails; an API response can report EMBED_ORIGIN_NOT_ALLOWED (403). Browser framing policy can block an iframe first |
Issue with ttl_seconds: 59 | INVALID_PARAMS (400), with no usable token |
Submit agent_override while host overrides are disabled | EMBED_FIELD_NOT_ALLOWED (400); browser input cannot change trusted instructions |
| Issue for a blocked user | EMBED_USER_BLOCKED (403) |
| Create a session at the active-session limit | EMBED_RATE_LIMITED (429); wait for runs to finish rather than deleting idle history |
| Create at the monthly cap with “Stop new sessions” | EMBED_MONTHLY_CAP_REACHED (402); do not manufacture this condition on an agent serving real users |
| Invoke a declared client tool | The intended page effect and result occur; unknown tools, invalid arguments or missing business permissions fail. A confirmation card alone is insufficient |
Use this standalone script to check the TTL minimum. On your server, set PRAXIS_API_BASE (API origin), PRAXIS_API_KEY (organization API Key), and PRAXIS_AGENT (real agent_… ID). Save it as test-token-limit.mjs and run node test-token-limit.mjs with Node.js supporting native fetch. Configure the policy first; otherwise missing configuration fails before TTL validation.
import assert from 'node:assert/strict';
const { PRAXIS_API_BASE, PRAXIS_API_KEY, PRAXIS_AGENT } = process.env;
assert(PRAXIS_API_BASE && PRAXIS_API_KEY && PRAXIS_AGENT, 'Set the three environment variables');
assert(PRAXIS_AGENT.startsWith('agent_'), 'Use the public agent ID');
const response = await fetch(`${PRAXIS_API_BASE.replace(/\/$/, '')}/agent/v1/embed_tokens`, {
method: 'POST',
headers: { Authorization: `Bearer ${PRAXIS_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ agent: PRAXIS_AGENT, external_user_id: 'docs_test_a', ttl_seconds: 59 }),
});
assert.equal(response.status, 400, 'Invalid TTL must be rejected');
console.log({ status: response.status, requestId: response.headers.get('X-Request-Id') });Expected: Exit successfully with status: 400. This checks refusal status only; separately inspect the error body for INVALID_PARAMS and the TTL field message. The script prints no credentials and does not replace successful issuance and reply tests.
Verify identity and lifecycle
- After A starts a session, log out and destroy A's component. Log in as B with a new component. A's sessions must be absent from history, and reading A's session with B's token must fail. Clearing the interface alone does not switch identity.
- Keep A logged in through token refresh. Confirm
getToken(current)rechecks host identity and subsequent messages still belong to A. Separately, an expired-token request must returnEMBED_TOKEN_EXPIRED(401). - Revoke A's current token under Operations → Issuance records (签发记录). Old access must fail without automatic refresh bypassing revocation. Test user-wide revocation, blocking and unblocking with Manage end users.
- For anonymous access, use separate browser storage for two visitors. Reload one visitor's page to check continuity. Never share
visitor_secretbetween visitors. - For Hosted, test exchange after 60 seconds, repeated exchange, and token expiry in an open page. The first two fail. The open page does not refresh its token automatically; obtain a new link from the host.
Diagnose and clean up
Record time, environment, component version, expected and actual results, plus failed responses' X-Request-Id, status and error code. An error event may contain only message; inspect browser network responses for details. Exclude Keys, tokens and visitor credentials.
Revoke test tokens, archive unused test sessions, and restore temporary limits and blocked states. Archiving retains records. Run one successful conversation with normal configuration afterward to confirm cleanup left no access problems.
Next: Go-live checklist · Limits and errors · Agent API