Skip to main content

haikeilabs-agentware

Policy enforcement and audit middleware for LLM agent tool calls.

haikeilabs-agentware sits between an agent (the LLM orchestrator) and tool execution. Every tool call is checked against policy (allow, deny, or filter with redacted arguments, rate limits, caller-context conditions) and every decision is audited. It is the Python implementation of agentware, which also ships Go and TypeScript implementations with the same behaviour.

Install

pip install haikeilabs-agentware
from haikeilabs.agentware.middleware import AuditedToolClient
import haikeilabs.agentware.kei

The distribution is haikeilabs-agentware (like the npm package @haikeilabs/agentware); the import package is haikeilabs.agentware, under the haikeilabs namespace. Python 3.10 or later.

Quick start

from haikeilabs.agentware.middleware import (
    Action,
    AuditedToolClient,
    CallerContext,
    Policy,
    Rule,
    SimplePolicyEvaluator,
)

policy = Policy(rules=[
    Rule(name="no-repo-deletes", tools=["github.delete_repo"], action=Action.DENY),
    Rule(name="default", tools=["*"], action=Action.ALLOW),
])
evaluator = SimplePolicyEvaluator(policy)

# The human who started the request. Trusted defaults to False (fail closed).
caller = CallerContext(user_id="ada", invoking_subject="ada")
decision = evaluator.evaluate("github.delete_repo", {"repo": "pipeline"}, caller)
assert decision.action is Action.DENY

# AuditedToolClient enforces the decision and records it, allow or deny.
client = AuditedToolClient(evaluator=evaluator)

When an agent delegates to a subagent, CallerContext.delegate() carries the invoking subject unchanged and records the parent span and delegation depth, so the audit trail always leads back to the human who authorized the request.

What's in the package

  • haikeilabs.agentware.middleware: the policy evaluator, rules and conditions, rate limits, auditors, AuditedToolClient, and agent-loop guardrails.
  • haikeilabs.agentware.kei: Kei integration. KeiProxyEvaluator is a policy evaluator backed by kei-proxy that fails closed on everything except an explicit allow. The harness contract and manifest loading also live here.
  • haikeilabs.agentware.toolformat: tool-call formatting and parsing for open models without native tool-call APIs (Llama, Mistral, Qwen, Nemotron and others).
  • haikeilabs.agentware.llm, haikeilabs.agentware.llmcontext: token counting, context-window accounting and conversation compaction.
  • haikeilabs.agentware.tools, executor, jobs, prompts: the tool registry, dispatch, background jobs and system-prompt generation.

Migrating from pedro_agentware

The import package used to be pedro_agentware. It still works as a deprecated alias: import pedro_agentware.kei.evaluator gives you the same module object as haikeilabs.agentware.kei.evaluator, and emits a DeprecationWarning. Replace pedro_agentware with haikeilabs.agentware in your imports; the alias will be removed in a future release.

Documentation

License

Apache-2.0. See LICENSE.

Metadata

Release files for haikeilabs-agentware 0.1.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 haikeilabs-agentware 0.1.0
File Size Uploaded Provenance
haikeilabs_agentware-0.1.0.tar.gz 184.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for haikeilabs-agentware 0.1.0
File Interpreter ABI Platform
haikeilabs_agentware-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 299.3 kB

Release files / haikeilabs_agentware-0.1.0.tar.gz

Download URL haikeilabs_agentware-0.1.0.tar.gz
Size 184.5 kB
Tags Source
SHA-256 checksum
How to use checksums
68d46e91834e14270dc0eb57f37b2ea48ac9937bd70cbb9085b127391f1569cc
BLAKE2b-256 checksum
How to use checksums
748f1cfc844b1969efafa551bf3e1f2357433fec185b0274f7d8fd586b7bf3e6
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 13, 2026.

Transparency log

Release files / haikeilabs_agentware-0.1.0-py3-none-any.whl

Download URL haikeilabs_agentware-0.1.0-py3-none-any.whl
Size 114.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a20cfe93252f4281204f99f001c78c422c137a196fafd439e5b57531f145d232
BLAKE2b-256 checksum
How to use checksums
5b1915bd2c55d14d317ef52f7ba014575b5d3947f8e4286fcd8374068b33bcdf
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 13, 2026.

Transparency log

Security for haikeilabs-agentware 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for haikeilabs_agentware-0.1.0.tar.gz

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 13, 2026.

Transparency log

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.

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