Skip to main content

AIQ — Durable AI Agent Runtime for Python

PyPI Python License

AIQ is an event-sourced Python runtime for building durable AI agents and bounded LLM workflows. It keeps agent decisions, tool requests, validation results, checkpoints, retries, and terminal outcomes in an explicit, replayable history.

AIQ is designed for systems where a model can propose an action, but deterministic application code must decide whether that action is valid, execute it durably, and prove what was committed after a restart.

Core capabilities

  • Durable event log with optimistic stream versions and global ordering.
  • Restart, replay, subscription checkpoints, and causal traces.
  • Guarded model/tool loop with request and result validation.
  • Workflow invariants, goal-gated completion, cycle detection, retry, replan, abstain, and terminal-state protection.
  • Stable operation IDs and append-only physical attempt telemetry.
  • Coordinated multi-worker effect execution over one shared SQLite database.
  • Atomic lease claims, SQLite database-time expiry, fresh lease identities, monotonic fencing tokens, heartbeat renewal, and stale-worker rejection.
  • FastAPI embedding, Server-Sent Events, Ollama provider, and MCP tool adapter.
  • Bounded executable models, targeted semantic mutants, runtime refinement scenarios, and crash-window tests.

Installation

pip install aiq-runtime

Optional integrations:

pip install "aiq-runtime[fastapi]"
pip install "aiq-runtime[mcp]"
pip install "aiq-runtime[ollama]"

The PyPI distribution is aiq-runtime; the Python package and command-line entry point are both named aiq:

from aiq import Event, InMemoryEventStore

Execution model

model or provider proposal
→ schema and policy validation
→ guarded durable transition
→ tool/effect execution
→ normalized durable result
→ invariant and goal checks
→ committed terminal outcome

For SQLite multi-worker effects:

pending effect
→ atomic lease claim + attempt record
→ pre-handler ownership confirmation
→ handler with heartbeat renewal
→ fenced result/checkpoint commit

Guarantee boundary

AIQ prevents stale workers from committing durable outputs and preserves at most one committed result for the covered SQLite protocol. It does not guarantee exactly-once physical external I/O. A worker can perform an external effect and crash before committing its result, so integrations must use the stable operation_id as a downstream idempotency key or provide equivalent deduplication.

SQLite lease coordination currently assumes:

  • one shared SQLite file;
  • reliable filesystem locking;
  • WAL mode and short coordination transactions;
  • one canonical effect subscription;
  • cooperative heartbeat scheduling.

PostgreSQL lease claims, transactional outbox delivery, universal composition proofs, and production-scale capacity guarantees are not included.

Documentation

AIQ is alpha software. Its strongest current deployment contract is a controlled Python application using SQLite, explicit downstream idempotency, and the documented worker lifecycle.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiq_runtime-0.5.2.tar.gz (361.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiq_runtime-0.5.2-py3-none-any.whl (104.7 kB view details)

Uploaded Python 3

File details

Details for the file aiq_runtime-0.5.2.tar.gz.

File metadata

  • Download URL: aiq_runtime-0.5.2.tar.gz
  • Upload date:
  • Size: 361.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiq_runtime-0.5.2.tar.gz
Algorithm Hash digest
SHA256 97f8bfac8ab1e9bea3e9724855435f903f88c222db7f25051a6c3a5ca03bfbf0
MD5 46f59eabb601674b4c53f704dfbf3b52
BLAKE2b-256 44f2f26bcca461e688a328ff4a7a4aacdfa154ae8f7957079fc2d891ba7e457f

See more details on using hashes here.

File details

Details for the file aiq_runtime-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: aiq_runtime-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 104.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiq_runtime-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b373b0dda3ce6bdca5549d1be1fd280cec4053f9a96cb5b56832745ba8ac8d11
MD5 025b2c66782d0e0417d3cd51f1493648
BLAKE2b-256 8dd8927fe081ca6d42bba8d99987a681f86459cb1c951783b2e431fa1ab69819

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 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