Skip to main content

Policy-enforced runtime for autonomous AI agents

Project description

Antraft

The Immune System for Agentic AI.

Antraft is an enterprise-grade runtime governance framework for AI agents. It serves as the Governance Layer that makes autonomous agents safe for production deployment.

Antraft acts as a middleware between your agent's "Brain" (LLM) and its "Hands" (Tools), enforcing specific policies, logging actions, and ensuring compliance. It is designed to be framework-agnostic, working seamlessly with LangChain, AutoGen, CrewAI, and custom implementations.

Antraft is the reference implementation of the MI9 Agent Intelligence Protocol.


Key Capabilities

1. Robust Governance

Secure your agents with deterministic rules.

  • Policy Enforcement: Approve, deny, or pause every action before execution.
  • Stateful Control: Enforce prerequisites (e.g., "Must authenticate before reading data").
  • Rich Logic Rules: define complex constraints like amount > 1000 and not user_verified.
  • Path Confinement: Restrict file access to specific directories.

2. Deep Observability

Complete visibility into agent behavior.

  • Session Recording: Capture full execution traces (Inputs, Thoughts, Actions, Outputs) for replay debugging.
  • PII Redaction: Automatically scrub sensitive data (Emails, SSNs) from logs.
  • Cognitive Telemetry: Log the agent's reasoning process, not just its actions.
  • Drift Detection: Identify anomalous behavior patterns (loops, spikes) in real-time.

4. Distributed Control

Manage fleets of agents at scale.

  • Swarm Protocol: Control thousands of agents across different servers from a central API.
  • Human-in-the-Loop: Pause high-risk actions and wait for human approval via API.
  • Dynamic Policies: Update agent permissions on-the-fly without restarting.

5. Universal Compatibility (MCP)

Antraft runs as a Model Context Protocol (MCP) server, making it instantly compatible with:

  • Claude Desktop
  • Cursor / Windsurf IDEs
  • Any MCP-compliant client

Installation

pip install antraft

Quick Start ("Fluent" SDK)

The Antraft SDK provides a fluent interface to secure ANY python agent in seconds.

import asyncio
from antraft import Antraft

# 1. Define your Agent & Tools
agent = MyAgent()
tools = {
    "search": google_search_tool,
    "shell": run_shell_tool
}

async def main():
    # 2. Wrap & Secure
    await Antraft.guard(agent, tools) \
        .allow(["search"]) \
        .deny(["shell"]) \
        .record_session("logs/session_01.jsonl", redact_pii=True) \
        .run()

if __name__ == "__main__":
    asyncio.run(main())

Advanced Usage

Defining Complex Policies (YAML)

For enterprise use cases, load policies from file.

# policy.yaml
allow:
  - read_file
rules:
  - trigger: "action:transfer_money"
    checks:
      - "amount > 10000"
    enforce: "pause"
    message: "High value transfer requires approval."
await Antraft.guard(agent, tools) \
    .load_policy("policy.yaml") \
    .run()

Swarm Mode (Remote Control)

Connect an agent to a central Control Plane.

1. Start the Server:

python -m antraft.cli.main serve

2. connect Agents:

await Antraft.guard(agent, tools) \
    .connect_swarm("http://localhost:8000") \
    .run()

Documentation

  • User Guide: Comprehensive "How-To".
  • Architecture: System design and components.
  • Threat Model: Security analysis.
  • Syntax Guide: Configuration reference.

Example Project

  • python examples/refund_agent/app.py: realistic support-refund workflow with HITL approval and session recording.

Development

python -m pytest -q

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

MIT License

Project details


Download files

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

Source Distribution

antraft-1.2.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

antraft-1.2.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file antraft-1.2.0.tar.gz.

File metadata

  • Download URL: antraft-1.2.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for antraft-1.2.0.tar.gz
Algorithm Hash digest
SHA256 306a4731922b940014ba20239e540c4380ffdc86f0075abbbf4d2f283208f0f9
MD5 aed830e9793dce53800cef33944711ae
BLAKE2b-256 64c3dd03e827520b3bb728c7c27c0499f93a2a0936ada517a8405217c639d1a2

See more details on using hashes here.

File details

Details for the file antraft-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: antraft-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for antraft-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d50fdb7ec2d3e949336b824c12d1b606e4ccf65c1250895bad8e70de1f83f1d
MD5 2183ca68fee2eaf89898263b9e0b50fb
BLAKE2b-256 7b8c17c19e26b9d11a54720060830b9a92a879506594aaff64f2e4b5dcc1665e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page