Skip to main content
Create one session per conversation, not per question. It keeps state on the server and remains pinned to the domain version published when the session was created.

The SDK lifecycle

TypeScript calls use await. Python also offers AsyncZelinqaClient with async with and await. See the complete quickstart.

Resume after an interruption

Persist session.id in your backend when the session is created. These examples assume a configured client and a saved_session_id or savedSessionId variable read from your storage.
Present the pending question before sending a new answer. After a network interruption, check whether the previous answer was already recorded; do not replay it blindly. The SDK tracks state_version, decision_id, and question_id for business calls. The state version advances with the session: it is not the domain’s published version.
Use one handle sequentially. Concurrent writes to the same session may conflict; read state and reconcile the answer. SDKs do not hide business conflicts.

Continue or finish

  • action: "ask": a question is available.
  • warnings may contain objective_achieved: your application decides whether to conclude or continue.
  • action: "stop": the turn limit is reached (stop_reason: "max_turns_reached") or no question is available (no_question_available); do not expect a candidate.
Calculated progress is not the same as a real-world result. Record success feedback only when the business outcome has actually occurred.
With MCP, the same stages use the conversation tools. The API reference covers concurrency and idempotency for direct HTTP integrations.