iron-core
iron-core is the core embedding crate for AgentIron.
It provides:
- the stream-first
IronAgent/AgentConnection/AgentSessionfacade - durable messages, timeline entries, and tool-call records
- tool registration with JSON Schema argument validation
- approval-gated tool execution
- ACP-native transports for in-process, stdio, and TCP integrations
- context compaction, active-context accounting, and handoff export/import
- layered prompt composition with repository instruction loading and runtime context injection
- optional embedded Python execution via the
embedded-pythonfeature - WASM integration plugins via Extism with install lifecycle, manifest extraction, session-scoped enablement, auth-gated tool availability, and a 30-second execution timeout
The facade/runtime API is the supported integration surface.
Requirements
- Rust 1.95+
- Tokio for async embedding code
Install
Use the git dependency for now:
[]
= { = "https://github.com/AgentIron/iron-core", = "main" }
= "0.2.2"
= "1"
= { = "1", = ["rt-multi-thread", "macros"] }
iron-core is not ready for crates.io publication yet because the optional embedded-python feature depends on monty from git until a usable crates.io release exists.
If you need the built-in python_exec tool, enable the feature explicitly:
[]
= { = "https://github.com/AgentIron/iron-core", = "main", = ["embedded-python"] }
= "0.2.2"
= "1"
= { = "1", = ["rt-multi-thread", "macros"] }
Quick Start
use ;
use ;
use json;
async
The canonical interaction model is stream-first:
- call
session.prompt_stream(...) - consume
PromptEvents as they arrive - use
PromptHandleto approve, deny, or cancel an active prompt
Built-In Tools
iron-core can register built-in read, write, edit, glob, grep, and webfetch tools, plus bash or powershell when a shell is available.
Use BuiltinToolConfig to scope filesystem access, disable specific tools, and tune limits such as command timeouts and output caps.
MCP Servers
iron-core supports session-scoped MCP (Model Context Protocol) servers as a tool source alongside built-in and custom tools. The full implementation covers:
- Runtime-local MCP server inventory with per-server configuration
- Session-scoped enablement governed by a single runtime-default policy
- Canonical session-effective tool catalog with precise unavailable-tool diagnostics
- Approval strategy enforcement for MCP tool calls
- Transport clients for stdio, HTTP, and HTTP+SSE
- Connection lifecycle management with single-flight connect guarding
- Handoff exclusion — MCP state is runtime-local and not portable
Integration Plugins
iron-core includes a WASM-based integration-plugin surface powered by Extism. Plugins are a third tool source alongside built-in tools and MCP servers.
The plugin system is fully implemented:
- Install lifecycle — fetch (local or HTTPS+checksum), cache, manifest extraction from WASM binaries, identity validation, and Extism-backed WASM host loading
- WASM execution — tools are invoked via
tool_{name}exports with a JSON request/response envelope and a 30-second timeout - Session-scoped enablement — runtime-level defaults materialised at session creation, with per-session overrides
- Canonical tool availability — single-source-of-truth
compute_tool_availability()gates tools on health, auth requirements, and scope satisfaction - Auth model — runtime-governed auth state, credential bindings, and per-tool scope checks
- Tool diagnostics — structured
UnavailableReasonvariants for actionable error messages - Network policy — allowlist, blocklist, and wildcard policies declared in plugin manifests
Development
Install the security tooling if you want to run the same audit check CI reports:
Configure the repository pre-commit hook after cloning:
The pre-commit hook runs cargo fmt --manifest-path Cargo.toml -- --check when staged Rust files are present. Before opening or updating a pull request, run the same checks CI validates:
The local invoke tasks in tasks.py are a convenience layer over these checks:
The Pull Request workflow runs build, format, lint, and test checks on every PR to main. It also runs cargo audit as a non-blocking audit and posts the output as a PR comment.
Merges to main trigger an automatic patch release that bumps Cargo.toml, creates a vX.Y.Z tag, and creates a GitHub release. Publishing to crates.io is skipped until monty is available from crates.io because crates.io rejects manifests containing git dependencies.
Documentation
- Architecture Overview
- Getting Started
- Integration Plugins
- Prompt Composition
- Architecture Cleanup Checklist
Build the API docs locally with:
License
Licensed under the Apache License, Version 2.0. See LICENSE.