Skip to main content

Keel

Python library for long-running LLM agents: task contracts, transcript merge, tiered context compression, and YAML policy (tools and outbound text). Runs in-process beside your provider SDK.

PyPI distribution: keel-agent. Import name: keel (import keel).

Optional CloudClient syncs audit-style events when KEEL_API_KEY is set; the hosted dashboard is a separate product.

Install

pip install keel-agent
pip install 'keel-agent[cloud]'   # httpx for CloudClient

From a checkout:

pip install -e .
pip install -e ".[dev]"    # tests + ruff

Example

import asyncio
from keel import AgentSession, TaskContract

async def main():
    contract = TaskContract(
        objective="Ship the fix",
        hard_constraints="No secrets in logs.",
        done_criteria="Tests pass.",
        version=1,
        created_at="2026-01-01T00:00:00Z",
        updated_by="app",
    )
    session = AgentSession(contract=contract, transcript=[])
    prep = await session.prepare_turn([{"role": "user", "content": "Next step?"}])
    # prep.messages_for_model -> your LLM API
    # await session.check_tool_or_raise(name, args) before each tool call
    # session.finish_turn(prep.merged_transcript_base, assistant_dict)

asyncio.run(main())

Cloud sync

from keel import CloudClient

client = CloudClient()  # KEEL_API_KEY, KEEL_CLOUD_BASE_URL from env
info = client.verify_subscription()
if info.active:
    client.push_audit_batch([{"type": "compression", "tokens_saved": 42}])

See docs/CLOUD.md in the repository for behavior and endpoints. Base URL is env-driven.

Configuration

Environment variables use the KEEL_ prefix (e.g. KEEL_VERBATIM_USER_TURNS, KEEL_POLICY_FILE). Defaults and types are in keel/config.py.

Tests

pip install -e ".[dev]"
pytest -q tests/

Documentation

Guides and OpenAPI for the cloud API live under docs/ in the source tree. On PyPI, open the project’s repository and browse that folder (the published sdist is code-only).

Modules

Module Role
keel.runtime AgentSession, PreparedTurn
keel.context_assembly merge + assemble_messages
keel.compressor tiered compression
keel.policy_yaml YAML policy loading
keel.cloud optional authenticated sync
keel.grading deterministic rubrics for tests / evals

Metadata

Release files for keel-agent 0.3.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 keel-agent 0.3.0
File Size Uploaded Provenance
keel_agent-0.3.0.tar.gz 14.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for keel-agent 0.3.0
File Interpreter ABI Platform
keel_agent-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / keel_agent-0.3.0.tar.gz

Download URL keel_agent-0.3.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ca52608df4826e7c6f77aa8ef23a7860a8163b571f08d265dc8117237343cdb5
BLAKE2b-256 checksum
How to use checksums
cac70523fec94b5382e2deccd5982603856df1136ec8bc9bb25652bc8cc44224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / keel_agent-0.3.0-py3-none-any.whl

Download URL keel_agent-0.3.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4f9a8eee4f30c5748ab5980022be22448bc3d6575a7baa79f2cc055ca6a1c4c
BLAKE2b-256 checksum
How to use checksums
9997f9c7464b5c015c24be3980a1c8b87d89a03c8aac4a870a3d0ee57f60c6b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for keel-agent 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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