Skip to main content
Run a complete first exchange with the SDK, from your backend. For a host such as Claude Desktop or Cursor, use Connect the MCP server instead.

1. Prepare your domain

You need a published domain and an API key with the runtime permission. If you already have both, skip to installation.
Keep the key on your server. Never put it in a browser, mobile application, public repository, or prompt.

2. Install and run

Choose your language. The program displays the first question, waits for your answer, then displays the next decision and dimension statuses. For this terminal demo, enter text for an open question or one exact label for a choice.
Python 3.11 or later. With uv, work in your project directory; if it is not initialized yet, run uv init --python 3.11. If you prefer pip, use an activated virtual environment.
Then set the key in your terminal:
Save the code as demo.py, then run uv run python demo.py (or python demo.py with pip, in the activated environment). The Python client reads the environment variable automatically.

3. Understand the result

  • The first question comes from your published domain: its wording depends on your configuration.
  • answer(...) records the answer and already returns the next decision. Do not call next() again to get that same continuation.
  • progress.dimensions contains each dimension’s status, such as in_progress or covered.
  • warnings can report a reached turn limit or successful qualification. Your application decides whether to continue.
  • action: "stop" means no question is available. Do not access the first candidate in that case.
The SDK tracks question IDs, decision IDs, and the state version. Your business logic does not need to construct them. Persist session.id in your backend to resume after a restart.

Next steps

A complete conversation

Run a terminal chatbot and hand confirmed information to your application.

Answers and context

Multiple choices, semi-open answers, refusals, and already-known data.

Progress and qualification

Understand dimensions and Essential, Balanced, and Deep qualification.

SDK reference

Clients, permissions, methods, and advanced configuration.