AIQ — Durable AI Agent Runtime for Python
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
- Repository and quick start
- Effect execution and idempotency
- Durable model loop
- FastAPI integration
- MCP adapter
- Formal model boundaries
- Changelog
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97f8bfac8ab1e9bea3e9724855435f903f88c222db7f25051a6c3a5ca03bfbf0
|
|
| MD5 |
46f59eabb601674b4c53f704dfbf3b52
|
|
| BLAKE2b-256 |
44f2f26bcca461e688a328ff4a7a4aacdfa154ae8f7957079fc2d891ba7e457f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b373b0dda3ce6bdca5549d1be1fd280cec4053f9a96cb5b56832745ba8ac8d11
|
|
| MD5 |
025b2c66782d0e0417d3cd51f1493648
|
|
| BLAKE2b-256 |
8dd8927fe081ca6d42bba8d99987a681f86459cb1c951783b2e431fa1ab69819
|