Install · First conversation · What you can do · Documentation · docs.zelinqa.ai
Zelinqa chooses the next question. You describe once what a conversation must find out. Your application sends each reply from the person, and the engine returns the next useful question, or stops when the objective is met. Your assistant keeps the conversation and the wording; the SDK keeps track of session, decision, question and choice identifiers for you.
The engine chooses the questions, so the model stops generating them and stops re-asking: fewer tokens for the same dialogue. The choice itself is a selection over your published domain, not a generation: the same state always yields the same question, and each decision carries what the question collects, the progress of every dimension and an explicit stop reason, so a conversation can be audited after the fact. Token figures: internal test bench, September 2026: more than 700 conversations replayed twice with the same assistant, alone then steered by the Zelinqa engine, with simulated respondents replayed identically on both sides. Protocol, figures and limits: read the test bench report. A scientific benchmark with shared data and code is planned before the end of 2026.
Any agent that has to ask before it decides, for an interview, a qualification, an orientation, a triage or a recommendation, faces the same problem: the model that decides is also the one improvising the questions. Zelinqa takes the questioning phase. The model keeps the conversation and the final decision, with a complete, typed state instead of a transcript.
- Configure once. In Zelinqa Studio, describe a domain: the dimensions a conversation must cover, the questions available for each one, the information each question collects, and the objective. Publish it and create a runtime API key.
- Open a session and send replies. The engine reads each reply, updates what is known and measures the progress of every dimension.
- Ask what comes back. Each call returns the next question with its choices, or a stop with its reason. The question text comes from your published domain, in your words.
| Python 3.11+ | TypeScript · Node.js 22+ |
|---|---|
pip install zelinqa |
npm install @zelinqa/sdk |
| Sync and async clients · typed responses | ESM and CommonJS · typed responses · no runtime dependencies |
Create a runtime API key for your published domain in Studio and set it on your backend:
export ZELINQA_API_KEY="YOUR_RUNTIME_API_KEY"Keep API keys out of browser code, mobile apps, logs and source control. A free Developer edition account is enough to run every example below.
Both examples ask one question in the console, send the person's reply and read the next decision. For choice questions, enter one of the displayed labels exactly.
Python
from zelinqa import ZelinqaClient
with ZelinqaClient() as client:
session = client.start_session(client_reference="demo-001")
decision = session.next()
if decision.action == "ask":
question = decision.candidates[0]
print(question.text)
for choice in question.choices:
print(f"- {choice.label}")
reply = input("> ")
if not reply.strip():
decision = session.answer(outcome="asked_no_answer")
elif question.choices:
decision = session.answer(choice_labels=[reply])
else:
decision = session.answer(reply)
print(decision.action) # "ask" for another question, or "stop"TypeScript
import { createInterface } from "node:readline/promises";
import { stdin, stdout } from "node:process";
import { ZelinqaClient } from "@zelinqa/sdk";
const client = new ZelinqaClient({ apiKey: process.env.ZELINQA_API_KEY ?? "" });
const session = await client.startSession({ client_reference: "demo-001" });
let decision = await session.next();
const question = decision.candidates[0];
if (decision.action === "ask" && question !== undefined) {
console.log(question.text);
for (const choice of question.choices) {
console.log(`- ${choice.label}`);
}
const input = createInterface({ input: stdin, output: stdout });
try {
const reply = await input.question("> ");
if (!reply.trim()) {
decision = await session.answer({ outcome: "asked_no_answer" });
} else if (question.choices.length > 0) {
decision = await session.answer({ choiceLabels: [reply] });
} else {
decision = await session.answer({ userText: reply });
}
console.log(decision.action, decision.warnings);
} finally {
input.close();
}
}A few rules the engine enforces:
- Each
answer()records the reply and returns the next decision. Do not callnext()again just to read that question. - Open questions need the person's actual words. Choices alone need no model call; free text is analyzed by the engine.
- Report a real refusal with
outcome: "refused"and an empty reply withoutcome: "asked_no_answer". Never invent an answer. - Use a session sequentially and store
session.idin your backend to resume after a restart. - When the session reaches
max_turns, the decision hasaction: "stop"andstop_reason: "max_turns_reached"; later calls return the same stop. Keep warnings visible and let your application decide when to finish.
| Run conversations Start a session, send replies, read the next question and the progress of every dimension. |
Resume after a restart Store the session id and pick the conversation up where it stopped, with the same handle. |
Add what you already know Pass CRM data as confirmed information or a context summary, without asking the person again. |
| Record outcomes Submit the business result at the end so every conversation can be reviewed against what it produced. |
Manage configuration Read questions, edit drafts and publish with the configuration client and its dedicated scopes. |
Stay in control Typed errors, timeouts, retries, idempotency keys, request cancellation and a custom fetch in TypeScript. |
| Resource | Where |
|---|---|
| Getting started, concepts and API reference | docs.zelinqa.ai |
| Python guide: sessions, async, configuration, errors | python/docs/usage.md |
| TypeScript guide: sessions, configuration, errors, compiler setup | typescript/docs/usage.md |
| REST API reference | docs.zelinqa.ai/en/integrations/rest-api |
| OpenAPI contract used to generate the types | openapi/ |
| Changelog | CHANGELOG.md |
| Security policy | SECURITY.md |
- zelinqa-mcp: the same engine as an MCP server for Claude Desktop, Claude Code, Cursor, Codex and other MCP hosts, with no code to write.
- Zelinqa Studio: where domains are configured, published and measured.
Issues and pull requests are welcome at github.com/Zelinqa/zelinqa-sdk. Release prerequisites are described in RELEASING.md.
Apache-2.0. See LICENSE.