An Alita-inspired autonomous agent using Claude Sonnet 4 for minimal predefinition and maximal self-evolution capabilities through dynamic Model Context Protocol (MCP) generation and management.
Key Innovation: Instead of pre-building hundreds of tools, Samus starts with pure reasoning and generates specialized capabilities (MCPs) only when needed. This follows the Alita research principle of minimal predefinition and maximal self-evolution.
Samus begins every task with direct reasoning using Claude Sonnet 4. It analyzes the problem, breaks it down, and provides comprehensive solutions using its core intelligence.
When a task requires specialized tools that don't exist, Samus:
- Identifies gaps in its current capabilities
- Generates MCP specifications describing exactly what's needed
- Creates executable code using AI to implement the capability
- Validates and executes the new MCP in an isolated process
- Stores capabilities for future reuse and evolution
Each MCP becomes a complete, runnable server stored in ~/.samus/mcps/:
βββ server.py # Complete MCP server implementation
βββ specification.json # Metadata and performance metrics
βββ requirements.txt # Python dependencies
βββ start.sh # Startup script
βββ logs/ # Execution logs
samus "What is 2+2?"
samus "Explain how TCP works"
samus "Write a Python function to sort a list"β Provides direct reasoning-based answers
samus "Fetch the current weather in New York using a real API"
samus "Calculate RSI and MACD indicators for Apple stock"
samus "Process this CSV file and generate statistical analysis"β Generates specialized MCPs, executes them, integrates results
samus --interactive
samus> Analyze the sentiment of recent Tesla tweets
samus> Now visualize the sentiment trends over time
samus> Export the results to a CSV fileβ Builds capabilities progressively as conversation evolves
- Python 3.11+
- uv package manager
- OpenRouter API key
# Clone and install
git clone <repository-url>
cd samus-agent-stem
uv pip install -e .
# Set up API key
echo "OPENROUTER_API_KEY=your_key_here" > .env
# Test installation
samus "Hello, what can you help me with?"samus "Create a technical analysis MCP for Bitcoin price data with RSI, MACD, and Bollinger Bands"samus "I need to fetch weather data from OpenWeatherMap and create visualizations"samus "Process this Excel file and generate summary statistics with charts"samus "Execute mathematical calculations using symbolic math libraries"samus [OPTIONS] [PROMPT]
Options:
-f, --file PATH Read prompt from file
-i, --interactive Start interactive session
-c, --config PATH Path to config file
-v, --verbose Enable verbose output with reasoning traces
--version Show version information
--help Show help message- Starts with reasoning, adds tools only when needed
- Each interaction makes the agent more capable
- Learns optimal model assignments for different tasks
- Generated MCPs run in isolated processes
- Code validation prevents malicious patterns
- Sandboxed execution environment
- Monitors MCP execution metrics
- Optimizes model selection based on performance
- Tracks cost and efficiency over time
- MCPs improve through usage feedback
- Capability distillation for knowledge transfer
- Automatic optimization of model routing
- Uses appropriate models for task complexity
- Lightweight models for simple tasks
- Expert models only when needed
Set custom models in configuration:
supervisor_model = "anthropic/claude-sonnet-4" # Reasoning & coordination
lightweight_model = "anthropic/claude-3.5-haiku" # Simple tasks
expert_model = "anthropic/claude-opus-4" # Complex reasoningMCPs are stored in ~/.samus/mcps/ and can be:
- Shared across agent instances
- Backed up and restored
- Manually inspected and modified
samus --verbose "Your complex task here"
# Shows:
# - MCPs generated and used
# - Execution time breakdown
# - Model assignments and reasoning- Traditional: Pre-built tools, static capabilities, manual integration
- Samus: Dynamic generation, self-evolving, reasoning-first approach
- Tool-Heavy: Hundreds of predefined functions, complex orchestration
- Samus: Minimal core, generates capabilities on-demand, cleaner architecture
- Static: Fixed capabilities, can't extend beyond training
- Samus: Continuously evolving, adapts to new requirements, learns from usage
# Check if API key is set
echo $OPENROUTER_API_KEY
# Verify in .env file
cat .env# Check MCP directory
ls ~/.samus/mcps/
# View logs
cat ~/.samus/mcps/*/logs/mcp_server.log- Use
--verboseto see execution breakdown - Check model assignments in MCP specifications
- Monitor API usage and rate limits
This implementation follows the Samus research paper principles:
- Minimal predefinition - Start simple, evolve as needed
- Maximal self-evolution - Capabilities emerge from usage
- Dynamic capability acquisition - Generate tools on-demand
- Performance-based optimization - Learn from execution metrics
MIT License - See LICENSE file for details