Skip to main content

Pythonic SDK layer for Iron Cage agent protection with decorators and framework integrations

Project description

Iron SDK

Pythonic SDK layer for Iron Cage agent protection with decorators and framework integrations.

[!WARNING] Development Status: Initial scaffolding - Core features pending implementation

Installation

pip install iron-sdk

[!IMPORTANT] Requirements: Python 3.9+ (python --version)

About Dependencies:

The iron-cage package (containing the Rust runtime) is automatically installed as a dependency - you never need to install or interact with it directly.

Package Hierarchy:

What you install:  pip install iron-sdk
What you import:   from iron_sdk import protect_agent
Automatic (internal): iron-cage (Rust runtime, auto-installed)
Internal (never seen): iron_runtime (Rust crate)

Quick Start

from iron_sdk import protect_agent, BudgetConfig, SafetyConfig

@protect_agent(
  budget=BudgetConfig(max_usd=50.0),
  safety=SafetyConfig(pii_detection=True),
)
def my_agent(input: str) -> str:
  # Your agent code here
  return llm.generate(input)

Architecture

Iron Cage Architecture - Three-Boundary Model

Visual Guide:

  • Left (Developer Zone): Agent, iron_sdk, Runtime (Safety/Cost/Audit), Gateway - 100% local
  • Middle (Management Plane): Control Panel - NOT in data path
  • Right (Provider Zone): LLM provider receives only prompts with IP Token

See root readme for detailed architecture explanation.

Key Features

  • @protect_agent decorator for function-level protection
  • Context managers (with Budget(...), with Protection(...))
  • Framework integrations (LangChain, CrewAI, AutoGPT)
  • Typed configuration classes
  • Async/await support
Optional Dependencies
# LangChain integration
pip install iron-sdk[langchain]

# CrewAI integration
pip install iron-sdk[crewai]

# AutoGPT integration
pip install iron-sdk[autogpt]

# All integrations
pip install iron-sdk[all]
Examples

See examples/ directory for 20+ runnable examples:

  • examples/langchain/ - LangChain integration examples
  • examples/crewai/ - CrewAI integration examples
  • examples/autogpt/ - AutoGPT integration examples
  • examples/patterns/ - Protection pattern examples
  • examples/raw_api/ - Direct API usage examples

Run examples:

python examples/langchain/simple_chat.py
Development Status & Roadmap

Current Phase: Initial scaffolding

Pending Implementation:

  • Core decorator (@protect_agent)
  • Context managers (Budget, Protection)
  • Configuration classes
  • Framework integrations (LangChain, CrewAI, AutoGPT)
Scope & Boundaries

Responsibilities: Provides a clean, Pythonic API for protecting AI agents with budget tracking, PII detection, and reliability patterns. Wraps the low-level PyO3 bindings from iron_runtime with decorators, context managers, and typed configurations for ergonomic Python usage.

In Scope:

  • @protect_agent decorator for function-level protection
  • Context managers (with Budget(...), with Protection(...))
  • Typed configuration classes (BudgetConfig, SafetyConfig, ReliabilityConfig)
  • Framework integrations (LangChain, CrewAI, AutoGPT)
  • Async/await support for async agents
  • Error handling with Python exceptions

Out of Scope:

  • PyO3 FFI bindings (see iron_runtime)
  • Budget calculation logic (see iron_cost)
  • PII detection patterns (see iron_safety)
  • Circuit breaker implementation (see iron_reliability)

Documentation

  • Specification: See spec.md for complete technical requirements
  • API Reference: Coming soon
  • Examples: See examples/ directory for runnable examples

License

Apache-2.0 - See license file for details

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

iron_sdk-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

iron_sdk-0.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file iron_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: iron_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iron_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f12df12267508039879c1fe29b9b25c4f740d7afbbcd49be5717b2acdcea9210
MD5 3f6da1a3a2cd6a4f4f1099242bf84a77
BLAKE2b-256 9f2861658cdaa87a269d43a12ccce98678401394b5dccc9d020981e93227ca89

See more details on using hashes here.

File details

Details for the file iron_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: iron_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iron_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 967df1b1a9dbbdfc340385c1ec0ef88864159ca48d321395dcf29d5cb8d1db07
MD5 806fe4abb0b3b17d10168702d756f685
BLAKE2b-256 3948f5f4fdb218680ce1a5375c6b5331bf1a383d4b85ba10d9e1808eb8ad28d3

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