ImitatorT - Multi-Agent Company Simulation Framework
A lightweight, production-ready multi-agent framework that simulates real company operations with autonomous AI agents. Built with Rust for performance and reliability, featuring a clean layered architecture and out-of-the-box functionality.
🚀 Features
- Self-Organizing Agents: Agents autonomously decide to create groups, initiate private chats, and execute tasks
- Built-in Web Service: Integrated web server with REST API and WebSocket support
- Hierarchical Organization: Support for departments and reporting structures
- Message-Driven Architecture: Agent collaboration through realistic communication patterns
- Spring Boot Inspired: Convention over configuration, auto-configuration capabilities
- Production Ready: Designed for stability, performance, and maintainability
📋 Prerequisites
- Rust 1.85 or higher
- An OpenAI-compatible API key (OpenAI, Azure OpenAI, or compatible providers)
🚀 Quick Start
Method 1: Quick Start (Recommended)
use quick_start;
async
Method 2: Manual Configuration
use ;
async
Method 3: Custom Configuration
use ;
async
⚙️ Configuration
Environment Variables
# Database path
DB_PATH=imitatort.db
# Web server binding address
WEB_BIND=0.0.0.0:8080
# Output mode (cli or web)
OUTPUT_MODE=web
# Whether to run agent autonomous loops
RUN_AGENT_LOOPS=true
# Default API base URL
DEFAULT_API_BASE_URL=https://api.openai.com/v1
# Default model name
DEFAULT_MODEL=gpt-4o-mini
# Log level
LOG_LEVEL=info
Company Configuration (YAML)
Create company_config.yaml in your project root:
name: "AI Research Company"
organization:
departments:
- id: "research"
name: "Research Department"
- id: "engineering"
name: "Engineering Department"
parent_id: "research"
- id: "marketing"
name: "Marketing Department"
agents:
- id: "ceo"
name: "CEO"
role:
title: "Chief Executive Officer"
responsibilities:
- "Strategic decision making"
- "Company direction"
expertise:
- "Business strategy"
- "Leadership"
system_prompt: |
You are the CEO of an AI research company. Your role is to make strategic decisions,
guide the company direction, and coordinate between departments. You should be decisive
yet collaborative, considering input from various team members.
llm_config:
model: "gpt-4o-mini"
api_key: "${OPENAI_API_KEY}" # Will be loaded from environment
base_url: "https://api.openai.com/v1"
mode: "passive" # Options: "passive" or "active"
- id: "cto"
name: "CTO"
role:
title: "Chief Technology Officer"
responsibilities:
- "Technical architecture"
- "Development oversight"
expertise:
- "Software architecture"
- "AI/ML systems"
system_prompt: |
You are the CTO responsible for technical decisions and development oversight.
Coordinate with the engineering team and report to the CEO on technical matters.
llm_config:
model: "gpt-4o-mini"
api_key: "${OPENAI_API_KEY}"
base_url: "https://api.openai.com/v1"
mode: "passive"
🏗️ Architecture
The framework follows a clean, layered architecture based on Domain-Driven Design principles:
imitatort/
├── src/
│ ├── domain/ # Domain entities (Agent, Message, Organization, Tool, Capability)
│ │ ├── agent.rs # Agent entity and related types
│ │ ├── message.rs # Message entity and communication types
│ │ ├── org.rs # Organization structure
│ │ ├── user.rs # User management
│ │ ├── tool.rs # Tool definitions
│ │ ├── capability.rs # Capability definitions
│ │ └── skill.rs # Skill definitions
│ ├── core/ # Core capabilities (AgentRuntime, Messaging, Store, Tool/Capability Registries)
│ │ ├── agent.rs # Agent runtime and decision-making (now uses structured JSON responses)
│ │ ├── messaging.rs # Message bus and communication
│ │ ├── store/ # Storage abstractions
│ │ ├── tool.rs # Tool registry and management
│ │ ├── capability.rs # Capability registry and management
│ │ ├── skill.rs # Skill management
│ │ ├── config.rs # Company configuration
│ │ ├── watchdog/ # Watchdog monitoring system
│ │ └── ... # Other core modules
│ ├── application/ # Application logic (VirtualCompany, AutonomousAgent)
│ │ ├── autonomous/ # Autonomous agent implementation
│ │ ├── company_runtime.rs # Company runtime components
│ │ ├── framework.rs # Main framework API (VirtualCompany)
│ │ └── organization.rs # Organization management
│ ├── infrastructure/ # External integrations (LLM, Web, Storage, Auth)
│ │ ├── llm.rs # LLM client implementations
│ │ ├── web/ # HTTP API and WebSocket server
│ │ ├── store/ # Storage implementations (SQLite, etc.)
│ │ ├── tool/ # Tool execution system
│ │ ├── capability/ # Capability execution system
│ │ ├── auth.rs # Authentication system
│ │ └── logger.rs # Logging setup
│ ├── bootstrap.rs # Auto-configuration module
│ ├── config.rs # Application configuration management
│ ├── errors.rs # Error types and handling
│ └── lib.rs # Public API exports
├── tests/ # Integration and unit tests
├── examples/ # Usage examples
├── frontend/ # Web interface (React + TypeScript)
├── Cargo.toml # Dependencies and project metadata
├── README.md # Project documentation
└── LICENSE # Apache 2.0 License
Key Components
- Domain Layer: Pure business entities without external dependencies, defining the core concepts of the system
- Core Layer: Essential runtime capabilities, business logic, and service abstractions
- Application Layer: Business logic orchestration and main framework APIs
- Infrastructure Layer: External system integrations (LLMs, databases, web services, authentication)
Advanced Features
- Tool System: Extensible framework for adding custom tools that agents can use
- Capability System: Advanced functionality accessible through MCP protocol
- Skill System: Higher-level composite behaviors built from tools and capabilities
- Watchdog System: Monitoring and triggering system for automated responses
- Structured Decision Making: JSON-based communication between agents and LLMs for more reliable parsing
🔧 Running the Framework
Development Mode
# Install dependencies
# Run with web interface
# Or run with custom configuration
OUTPUT_MODE=web WEB_BIND=0.0.0.0:8080
Production Mode
# Build for release
# Run production binary
🧪 Testing
Run all tests:
# Run unit and integration tests
# Run tests with specific filters
# Run with specific features
📦 Usage as Dependency
Add to your Cargo.toml:
[]
= "0.2.0"
= { = "1", = ["full"] }
= "1"
= { = "1", = ["derive"] }
Or install via cargo:
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Run the test suite (
cargo test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙏 Acknowledgments
- Inspired by Spring Boot's auto-configuration philosophy
- Built with the amazing Rust ecosystem
- Special thanks to the AI research community
🐛 Issues
If you encounter any issues, please file them in our Issue Tracker.
Made with ❤️ using Rust