Skip to main content

diteko (Python)

Generate, export and run tests for Amazon Connect contact flows, from Python. It is the testing counterpart to cxblueprint: build or export a flow, then let Diteko derive its grammar, evolve a test suite with Grammatical Evolution, export it, and run it on Connect's native testing.

The SDK is a client: it talks to a running Diteko deployment over its REST API, so you need one to point it at. If that deployment requires API keys, set DITEKO_API_KEY (or pass api_key=); otherwise point the SDK only at a deployment inside your network or behind your VPN.

pip install diteko               # SDK
pip install "diteko[mcp]"        # + MCP server for Claude Desktop / Cursor / VS Code
pip install "diteko[cxblueprint]"

The pipeline

from diteko import Diteko

dk = Diteko("http://localhost:8888")

project = dk.projects.from_json("claims.json")          # Connect export or cxblueprint output
project.grammar.generate()                              # derive, store and validate the grammar
run = project.evolve(preset="standard", focus="balanced").wait()
suite = run.suite(top=30, selection="coverage")         # or selection="fitness"

for test in suite:
    print(test.test_id, test.keys, test.fitness)

suite.export_xlsx("claims-tests.xlsx")                  # manual test script (ISO/IEC/IEEE 29119-3)
suite.export_native("claims-native.json")               # Amazon Connect native test cases
result = suite.publish_to_connect(dry_run=True)         # dry run unless you say otherwise
print(result.passed, result.failed, result.verdicts)

Straight from cxblueprint

from cxblueprint import Flow
from diteko import Diteko

flow = Flow.build("Burger Order")
menu = flow.get_input("Press 1 for Classic or 2 for Veggie", timeout=10)
# ... build the flow as usual ...

project = Diteko().projects.from_cxblueprint(flow)      # compiles locally, uploads the JSON

Other ways in

dk.projects.import_from_connect("08e145dc-d959-4094-9021-6f10d8590be2")   # from the instance
dk.projects.list()                                      # every project and its next step
dk.projects.get(21601).suite(top=10).export_xlsx()

Grammars as BNF or JSON

The two forms are exact reflections of each other. Both are validated by the same parser, and both keep comments.

g = project.grammar.latest()
spec = g.to_json()                    # {"format": "diteko-grammar/v1", "start": ..., "rules": [...]}
g.replace(spec, format="json").save() # edit as JSON, store as canonical BNF
dk.convert_grammar(bnf_text, "bnf", "json")

Presets

preset calls × generations
quick 40 × 15
standard 100 × 50
thorough 200 × 120
focus favours
balanced blocks and branches, plus happy paths and recoveries
coverage visiting as much of the flow as possible
errors timeouts and wrong keys that still end properly
transfers calls that reach an agent queue

Pass population=, generations=, weights={"state_coverage": 1.0} or seed= to go beyond them.

API keys

dk = Diteko("https://diteko.internal", api_key="dk_...")   # or set DITEKO_API_KEY
dk.whoami()   # {"name": "nightly CI", "prefix": "dk_...", "scope": "WRITE", ...}; None if keys are off

A key carries one scope: READ (see and export), WRITE (also create, run and dry-run), PUBLISH_LIVE (also run on Connect for real, which is billed) or ADMIN (also manage keys). Keys are created in the console under Settings, API keys.

MCP server

DITEKO_URL=http://localhost:8888 DITEKO_API_KEY=dk_... diteko-mcp   # the key only if the server requires one
{ "mcpServers": { "diteko": { "command": "diteko-mcp", "env": { "DITEKO_URL": "http://localhost:8888", "DITEKO_API_KEY": "dk_..." } } } }
Tool Does
list_projects every flow under test and its next step
import_flow register a flow from JSON text, a file path, or a Connect flow id
generate_grammar derive, store and validate a flow's grammar
convert_grammar BNF ⇄ JSON
start_evolution start a run (size, focus, seed)
get_run a run's progress
export_suite xlsx, json or native to a file
publish_suite run on Connect; dry_run defaults to true, since a live run bills the AWS account

Each tool carries MCP annotations: read-only tools say so, and publish_suite is marked as reaching an external system. Works with mcp 1.x and 2.x.

Versioning

The package follows Semantic Versioning. See the changelog for what each release changed.

The server reports an API version, MAJOR.MINOR, at GET /api/version. A minor bump only adds endpoints or fields. A major bump changes something an existing client relies on. Each SDK release speaks one API major version, currently 1. On its first call the SDK checks the server's version:

Server What happens
API 1.x Works.
Another major DitekoError, saying whether to upgrade the SDK or the server
Too old to report a version A warning, then it carries on

Diteko(url, check_version=False) skips the check, and dk.version() returns what the server reports.

Development

cd clients/python
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev,mcp]"
pytest                                   # against an in-memory fake of the API
DITEKO_URL=http://localhost:8888 pytest  # also runs the live and contract tests against a local stack

Changelog

All notable changes to the diteko Python package. The format follows Keep a Changelog, and versions follow Semantic Versioning as described under “Versioning” in the README.

0.2.0 - 2026-10-11

Added

  • The first call checks that the server speaks this SDK's API major version (GET /api/version, API 1.x). A server on another major is refused with an error that says which side to upgrade; a server that predates version reporting gets a warning, not a failure. Diteko(..., check_version=False) skips the check.
  • Diteko.version() returns the server's API version and build.
  • API keys: the SDK and diteko-mcp send DITEKO_API_KEY (or Diteko(api_key=...)) to servers that require keys (API 1.1). A missing key, a refused key and a key without permission each raise a DitekoError that says which. Diteko.whoami() returns the key in use.

Fixed

  • Moving a record to another parent with a partial update (for example a grammar to another flow) no longer fails on the server (fixed server-side, Diteko API 1.0).

0.1.0 - 2026-10-10

Added

  • First release: projects from Connect exports, cxblueprint flows or a Connect instance; grammars as BNF or JSON; evolution with size and focus presets; suites exported as an Excel test script (ISO/IEC/IEEE 29119-3), JSON or Connect native tests; publishing to Connect, dry run by default.
  • diteko-mcp, an MCP server exposing the same pipeline as eight tools, on mcp 1.x or 2.x.

Metadata

Release files for diteko 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diteko 0.2.0
File Size Uploaded
diteko-0.2.0.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diteko 0.2.0
File Interpreter ABI Platform
diteko-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.9 kB

Release files / diteko-0.2.0.tar.gz

Download URL diteko-0.2.0.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
aff1d720ca5e0a8ff876eba5aa71610f37be28600ecfd0d279a91ad0b49751d3
BLAKE2b-256 checksum
How to use checksums
850eb809e9b54bf05f2e560c14a74b7825f40c65395c69529b9d15780478a653
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / diteko-0.2.0-py3-none-any.whl

Download URL diteko-0.2.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b677224bd0bf0ae3658f02b7eb40326320764428dff79457f9629add66701de
BLAKE2b-256 checksum
How to use checksums
091a9ef2d0160a2630b05ac02c652fa969803a9592a26d3cca607f9ce0f21759
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page