limit-agent
Agent runtime for AI applications with tool registry and Docker sandbox.
Build autonomous AI agents that can execute tools, run code in isolated containers, and maintain state across conversations.
Part of the Limit ecosystem.
Why This Exists
Building AI agents requires a flexible tool execution system that's both powerful and safe. limit-agent provides a production-ready runtime with Docker sandboxing, parallel execution, and persistent state—so you can focus on your agent's logic, not infrastructure.
Features
- Tool Registry: Define, register, and execute tools dynamically with async/await
- Docker Sandbox: Isolated execution environment for untrusted code
- Parallel Execution: Run multiple tools concurrently for better performance
- Event-driven: Subscribe to agent lifecycle events for logging and monitoring
- State Management: Persist and restore agent state across sessions
- LLM Integration: Works seamlessly with
limit-llm
Installation
Add to your Cargo.toml:
[]
= "0.0.27"
Requirements: Rust 1.70+, tokio runtime, Docker (optional, for sandbox)
Quick Start
Define a Custom Tool
use async_trait;
use ;
use ;
;
Register and Execute
use ToolRegistry;
# use async_trait;
# use ;
# use ;
# ;
#
#
async
Parallel Execution
Execute multiple tools concurrently for better performance:
# use ToolRegistry;
# use json;
#
# async
Docker Sandbox
Run untrusted code in isolated Docker containers:
use ;
async
Sandbox Security Features
| Feature | Description |
|---|---|
| Network isolation | Container has no network access |
| Memory limit | Configurable memory ceiling (default: 256MB) |
| Timeout | Execution time limit (default: 30s) |
| Read-only mount | Project directory mounted read-only |
| Non-root user | Container runs as unprivileged user |
Event System
Subscribe to agent lifecycle events for logging, monitoring, or debugging:
use ;
let events = new;
events.subscribe;
State Management
Persist and restore agent state across sessions:
use StateManager;
let state = new?;
// Save current state
state.save?;
// Restore state later
let restored = state.load?;
Core Types
| Type | Description |
|---|---|
Tool |
Trait for defining executable tools |
ToolRegistry |
Registry for managing and executing tools |
DockerSandbox |
Isolated execution environment |
StateManager |
Persist/restore agent state |
EventBus |
Event subscription system |
Built-in Tools
EchoTool— Simple echo for testing the tool pipeline
API Reference
See docs.rs/limit-agent for full API documentation.
Examples
# Run examples
License
MIT © Mário Idival