Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
name: Python SDK CI

on:
# Required checks must report a result for every pull request, whatever it touches.
pull_request:
paths:
- '**/*.md'
- 'typescript/src/types.ts'
- 'typescript/src/generated/**'
- 'python/**'
- 'openapi/**'
- 'pyproject.toml'
- 'uv.lock'
- '.github/workflows/python-ci.yml'
- '.github/workflows/publish-python-sdk.yml'
push:
branches: [main]
paths:
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/typescript-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
name: TypeScript SDK CI

on:
# Required checks must report a result for every pull request, whatever it touches.
pull_request:
paths:
- 'README.md'
- 'PUBLISHING.md'
- 'typescript/**'
- 'openapi/**'
- 'scripts/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'biome.json'
- 'vitest.config.ts'
- 'vitest.live.config.ts'
- '.changeset/**'
- '.github/workflows/typescript-ci.yml'
- '.github/workflows/publish-typescript-sdk.yml'
push:
branches: [main]
paths:
- 'README.md'
- 'PUBLISHING.md'
- 'RELEASING.md'
- 'typescript/**'
- 'openapi/**'
- 'scripts/**'
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 1.0.1 — Unreleased
## 1.0.1 — 2026-09-29

- Python: `StopReason` accepts `max_turns_reached`. When a session reaches
`max_turns`, `next()` returns `action: "stop"` with
Expand Down
118 changes: 0 additions & 118 deletions PUBLISHING.md

This file was deleted.

184 changes: 150 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,131 @@
# Zelinqa TypeScript SDK
<p align="center">
<a href="https://zelinqa.ai">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/hero-dark.svg">
<img src="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/hero-light.svg" alt="Zelinqa SDK" width="100%">
</picture>
</a>
</p>

<p align="center">
<a href="https://pypi.org/project/zelinqa/"><img src="https://img.shields.io/pypi/v/zelinqa?label=PyPI&color=6B5BD6" alt="PyPI version"></a>
<a href="https://www.npmjs.com/package/@zelinqa/sdk"><img src="https://img.shields.io/npm/v/%40zelinqa%2Fsdk?label=npm&color=6B5BD6" alt="npm version"></a>
<a href="https://github.com/Zelinqa/zelinqa-sdk/actions/workflows/python-ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Zelinqa/zelinqa-sdk/python-ci.yml?branch=main&label=Python%20CI" alt="Python CI"></a>
<a href="https://github.com/Zelinqa/zelinqa-sdk/actions/workflows/typescript-ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Zelinqa/zelinqa-sdk/typescript-ci.yml?branch=main&label=TypeScript%20CI" alt="TypeScript CI"></a>
<img src="https://img.shields.io/badge/python-3.11%2B-3776AB?logo=python&logoColor=white" alt="Python 3.11+">
<img src="https://img.shields.io/badge/node-22%2B-5FA04E?logo=node.js&logoColor=white" alt="Node.js 22+">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License Apache-2.0"></a>
</p>

<p align="center">
<a href="#install">Install</a> ·
<a href="#your-first-conversation">First conversation</a> ·
<a href="#what-you-can-do">What you can do</a> ·
<a href="#documentation">Documentation</a> ·
<a href="https://docs.zelinqa.ai">docs.zelinqa.ai</a>
</p>

---

**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.

## Fewer tokens, deterministic, explainable

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/stats-dark.svg">
<img src="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/stats-light.svg" alt="70 percent fewer tokens, measured on 700+ conversations; deterministic: the same state returns the same question and choosing never calls a model; explainable: every question says what it collects and progress is reported per dimension." width="100%">
</picture>

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](https://zelinqa.ai/en/blog/banc-essai-moteur-zelinqa). A scientific benchmark with shared data and code is planned before the end of 2026.

## Why

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/why-dark.svg">
<img src="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/why-light.svg" alt="Without Zelinqa, the model generates every question and decides with gaps. With Zelinqa, the engine runs the questioning phase from the published domain and the model decides once, with a complete typed state." width="100%">
</picture>

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.

## How it works

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/loop-dark.svg">
<img src="https://raw.githubusercontent.com/Zelinqa/zelinqa-sdk/main/assets/readme/loop-light.svg" alt="Your application sends each reply; the Zelinqa engine returns the next question or a stop, with progress per dimension." width="100%">
</picture>

1. **Configure once.** In [Zelinqa Studio](https://client.zelinqa.ai), 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.
2. **Open a session and send replies.** The engine reads each reply, updates what is known and measures the progress of every dimension.
3. **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.

The official TypeScript client for Zelinqa. Configure a domain in
[Zelinqa Studio](https://client.zelinqa.ai), publish it, and let the API select
the next useful question for each conversation.
## Install

Node.js 22+ · ESM and CommonJS · Typed responses · No runtime dependencies
<table>
<tr>
<th align="left">Python 3.11+</th>
<th align="left">TypeScript · Node.js 22+</th>
</tr>
<tr>
<td>

## Install
```bash
pip install zelinqa
```

</td>
<td>

```bash
npm install @zelinqa/sdk
```

## Set your API key
</td>
</tr>
<tr>
<td>Sync and async clients · typed responses</td>
<td>ESM and CommonJS · typed responses · no runtime dependencies</td>
</tr>
</table>

Create a runtime API key for your published domain in Studio and set it on
your backend:
Create a runtime API key for your published domain in Studio and set it on your backend:

```bash
export ZELINQA_API_KEY="YOUR_RUNTIME_API_KEY"
```

Keep API keys out of browser code, mobile apps, logs and source control.
Keep API keys out of browser code, mobile apps, logs and source control. A free [Developer edition](https://zelinqa.ai/en/pricing) account is enough to run every example below.

## Your first conversation

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**

```python
from zelinqa import ZelinqaClient

## Get a question and send the reply
with ZelinqaClient() as client:
session = client.start_session(client_reference="demo-001")
decision = session.next()

This small console example asks one question and submits the person's reply.
For choice questions, enter one of the displayed labels exactly.
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**

```ts
import { createInterface } from "node:readline/promises";
Expand Down Expand Up @@ -61,33 +160,50 @@ if (decision.action === "ask" && question !== undefined) {
}
```

The session handle supplies session, decision, question and choice IDs for you.
Each `answer()` records the reply and returns the next decision; do not call
`next()` again just to retrieve that question. Use a session sequentially and
store `session.id` in your backend if you need to resume after a restart.
A few rules the engine enforces:

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"`, or an empty reply with `outcome: "asked_no_answer"`.
Keep warnings visible and let your application decide when to finish. Once the
session reaches `max_turns`, the decision has `action: "stop"` and
`stop_reason: "max_turns_reached"`; later calls return the same stop.
- Each `answer()` records the reply **and** returns the next decision. Do not call `next()` 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 with `outcome: "asked_no_answer"`. Never invent an answer.
- Use a session sequentially and store `session.id` in your backend to resume after a restart.
- When the session reaches `max_turns`, the decision has `action: "stop"` and `stop_reason: "max_turns_reached"`; later calls return the same stop. Keep warnings visible and let your application decide when to finish.

## What you can do

- Run conversations, resume sessions, add context and record business feedback.
- Read questions, edit drafts and publish with `ZelinqaConfigurationClient`
and the corresponding configuration scopes.
- Handle typed errors, configure timeouts and retries, and cancel requests.
<table>
<tr>
<td width="33%" valign="top"><strong>Run conversations</strong><br>Start a session, send replies, read the next question and the progress of every dimension.</td>
<td width="33%" valign="top"><strong>Resume after a restart</strong><br>Store the session id and pick the conversation up where it stopped, with the same handle.</td>
<td width="33%" valign="top"><strong>Add what you already know</strong><br>Pass CRM data as confirmed information or a context summary, without asking the person again.</td>
</tr>
<tr>
<td valign="top"><strong>Record outcomes</strong><br>Submit the business result at the end so every conversation can be reviewed against what it produced.</td>
<td valign="top"><strong>Manage configuration</strong><br>Read questions, edit drafts and publish with the configuration client and its dedicated scopes.</td>
<td valign="top"><strong>Stay in control</strong><br>Typed errors, timeouts, retries, idempotency keys, request cancellation and a custom <code>fetch</code> in TypeScript.</td>
</tr>
</table>

## Documentation

| Resource | Where |
|---|---|
| Getting started, concepts and API reference | [docs.zelinqa.ai](https://docs.zelinqa.ai) |
| Python guide: sessions, async, configuration, errors | [`python/docs/usage.md`](python/docs/usage.md) |
| TypeScript guide: sessions, configuration, errors, compiler setup | [`typescript/docs/usage.md`](typescript/docs/usage.md) |
| REST API reference | [docs.zelinqa.ai/en/integrations/rest-api](https://docs.zelinqa.ai/en/integrations/rest-api) |
| OpenAPI contract used to generate the types | [`openapi/`](openapi/) |
| Changelog | [`CHANGELOG.md`](CHANGELOG.md) |
| Security policy | [`SECURITY.md`](SECURITY.md) |

## Related

- [**zelinqa-mcp**](https://github.com/Zelinqa/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**](https://client.zelinqa.ai): where domains are configured, published and measured.

## Learn more
## Contributing

- [Documentation and API reference](https://docs.zelinqa.ai)
- [TypeScript guide: choices, configuration, errors and compiler setup](https://github.com/Zelinqa/zelinqa-sdk/blob/main/typescript/docs/usage.md)
- [Python SDK](https://github.com/Zelinqa/zelinqa-sdk/blob/main/python/README.md) — `pip install zelinqa`
- [Changelog](https://github.com/Zelinqa/zelinqa-sdk/blob/main/CHANGELOG.md)
- [Report an issue](https://github.com/Zelinqa/zelinqa-sdk/issues)
Issues and pull requests are welcome at [github.com/Zelinqa/zelinqa-sdk](https://github.com/Zelinqa/zelinqa-sdk/issues). Release prerequisites are described in [`RELEASING.md`](RELEASING.md).

## License

Apache-2.0. See [LICENSE](https://github.com/Zelinqa/zelinqa-sdk/blob/main/LICENSE).
Apache-2.0. See [LICENSE](LICENSE).
Loading
Loading