Auto-Dev Architecture
System architecture diagrams, component interactions, data flow, and security boundaries for the Auto-Dev self-evolving agent system.
**Version:** 1.0.0
**Last Updated:** 2026-04-10
---
Table of Contents
- System Components
- Data Flow Diagrams
- Component Interactions
- Database Schema
- Security Boundaries
- Extension Points
---
System Components
Core Components
┌─────────────────────────────────────────────────────────────────┐
│ Auto-Dev System │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────────┐ ┌────────────────┐ │
│ │ EventBus │ │ BaseLearningEngine│ │ FitnessService│ │
│ │ │ │ (Abstract) │ │ │ │
│ │ - on_task_ │ └────────┬─────────┘ │ - evaluate_* │ │
│ │ fail │ │ │ - get_top_* │ │
│ │ - on_task_ │ │ └────────────────┘ │
│ │ success │ │ │
│ │ - on_skill_ │ │ │
│ │ execution │ │ │
│ └──────┬───────┘ │ │
│ │ │ │
│ │ ┌─────────┴─────────┐ │
│ │ │ │ │
│ │ ┌──────▼──────┐ ┌──────▼──────┐ │
│ │ │MementoEngine│ │AlphaEvolver │ │
│ │ │ │ │Engine │ │
│ │ │ - generate_ │ │ - generate_ │ │
│ │ │ skill_* │ │ mutation_│ │
│ │ │ - validate_*│ │ - sandbox_* │ │
│ │ │ - promote_* │ │ - run_* │ │
│ │ └─────────────┘ └─────────────┘ │
│ │ │
│ ┌──────▼──────────┐ ┌──────────────────┐ ┌──────────┐ │
│ │ReflectionEngine │ │ EvolutionEngine │ │AdvisorSvc│ │
│ │ │ │ │ │ │ │
│ │ - process_ │ │ - process_ │ │ - gener- │ │
│ │ failure │ │ execution │ │ ate_ │ │
│ │ - _trigger_ │ │ - _trigger_ │ │ guid- │ │
│ │ memento │ │ alpha_evolver │ │ ance │ │
│ └─────────────────┘ └──────────────────┘ └──────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ AutoDevCapabilityService │ │
│ │ │ │
│ │ - can_use(agent_id, capability, settings) │ │
│ │ - record_usage(agent_id, capability, success) │ │
│ │ - check_daily_limits(agent_id, capability) │ │
│ │ - notify_capability_unlocked(agent_id, capability) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ ContainerSandbox │ │
│ │ │ │
│ │ - execute_raw_python(code, inputs, timeout) │ │
│ │ - Docker-based isolation (network:none, read-only) │ │
│ │ - Fallback: subprocess isolation │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘Component Descriptions
EventBus
**Purpose:** Pub-sub event system for lifecycle communication
**Responsibilities:**
- Emit task failure/success events
- Emit skill execution events
- Dispatch to registered handlers
- Exception isolation in handlers
**Key Methods:**
emit_task_fail(TaskEvent)emit_task_success(TaskEvent)emit_skill_execution(SkillExecutionEvent)
BaseLearningEngine
**Purpose:** Abstract interface for learning engines
**Responsibilities:**
- Define lifecycle interface
- Provide LLM service accessor
- Provide sandbox accessor
- Strip markdown fences from LLM output
**Lifecycle Methods:**
analyze_episode(episode_id)- Extract signalspropose_code_change(context)- Generate modificationsvalidate_change(code, test_inputs, tenant_id)- Test in sandbox
MementoEngine
**Purpose:** Generate new skills from failures
**Inherits:** BaseLearningEngine
**Responsibilities:**
- Analyze failed episodes
- Generate skill code via LLM
- Validate in sandbox
- Promote to skill registry
**Key Methods:**
generate_skill_candidate()validate_candidate()promote_skill()
AlphaEvolverEngine
**Purpose:** Optimize existing skills via mutation
**Inherits:** BaseLearningEngine
**Responsibilities:**
- Analyze successful episodes
- Generate code mutations
- Execute in sandbox
- Run research experiments
**Key Methods:**
generate_tool_mutation()sandbox_execute_mutation()spawn_workflow_variant()run_research_experiment()
FitnessService
**Purpose:** Multi-stage fitness evaluation
**Responsibilities:**
- Evaluate proxy signals (immediate)
- Process external signals (delayed)
- Track top variants
- Calculate fitness scores
**Key Methods:**
evaluate_initial_proxy()evaluate_delayed_webhook()get_top_variants()
AutoDevCapabilityService
**Purpose:** Maturity-based capability gating
**Responsibilities:**
- Check agent maturity
- Enforce daily limits
- Record usage for graduation
- Notify on capability unlock
**Key Methods:**
can_use(agent_id, capability, settings)record_usage(agent_id, capability, success)check_daily_limits(agent_id, capability)
ReflectionEngine
**Purpose:** Monitor failures and trigger Memento
**Responsibilities:**
- Subscribe to task_fail events
- Detect recurring failure patterns
- Trigger MementoEngine when threshold exceeded
**Key Methods:**
process_failure(TaskEvent)_trigger_memento(...)_find_similar_failures(...)
EvolutionEngine
**Purpose:** Monitor skill performance and trigger AlphaEvolver
**Responsibilities:**
- Subscribe to skill_execution events
- Detect optimization opportunities
- Trigger AlphaEvolver for AUTONOMOUS agents
**Key Methods:**
process_execution(SkillExecutionEvent)_trigger_alpha_evolver(...)_check_optimization_triggers(...)
AdvisorService
**Purpose:** AI-powered guidance for evolution
**Responsibilities:**
- Analyze mutation/fitness data
- Generate human-readable guidance
- Detect risks (high failure rates, plateaus)
**Key Methods:**
generate_guidance(tenant_id, agent_id)_generate_ai_guidance(...)_generate_heuristic_guidance(...)
ContainerSandbox
**Purpose:** Isolated code execution
**Responsibilities:**
- Execute Python code in Docker containers
- Enforce resource limits (memory, timeout)
- Provide subprocess fallback
- Return execution results
**Key Methods:**
execute_raw_python(code, inputs, timeout)_execute_docker(...)_execute_subprocess(...)
---
Data Flow Diagrams
Memento-Skills Learning Loop
┌────────────────────────────────────────────────────────────────┐
│ Memento-Skills Learning Loop │
└────────────────────────────────────────────────────────────────┘
Agent Task Fails
│
▼
┌──────────────────┐
│ EpisodeService │
│ Records Failure │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ event_bus.emit_ │
│ task_fail() │
└────────┬─────────┘
│
▼
┌──────────────────────────────────┐
│ ReflectionEngine.process_failure │
│ - Buffers failures │
│ - Detects patterns │
│ - Checks threshold (2+) │
└────────┬─────────────────────────┘
│
▼ (Pattern detected)
┌──────────────────────────────────┐
│ MementoEngine.generate_skill_ │
│ candidate() │
│ - analyze_episode() │
│ - Extract failure pattern │
│ - propose_code_change() │
│ - LLM generates skill code │
│ - Create SkillCandidate record │
└────────┬─────────────────────────┘
│
▼
┌──────────────────────────────────┐
│ MementoEngine.validate_candidate │
│ - Execute in ContainerSandbox │
│ - Test with sample inputs │
│ - Update validation_status │
└────────┬─────────────────────────┘
│
▼ (Validation passed)
┌──────────────────────────────────┐
│ User Reviews Candidate │
│ - View generated code │
│ - Check validation results │
│ - Approve or reject │
└────────┬─────────────────────────┘
│
▼ (Approved)
┌──────────────────────────────────┐
│ MementoEngine.promote_skill() │
│ - SkillBuilderService.create_ │
│ skill_package() │
│ - Register to skill catalog │
│ - Update promoted_at timestamp │
└─────────────────────────────────┘
│
▼
┌──────────────────────────────────┐
│ Skill Available to Agents │
│ - All agents in workspace │
│ - Version controlled (v1.0.0) │
│ - Tracked in skill registry │
└─────────────────────────────────┘AlphaEvolver Learning Loop
┌────────────────────────────────────────────────────────────────┐
│ AlphaEvolver Learning Loop │
└────────────────────────────────────────────────────────────────┘
Skill Executes (High Latency)
│
▼
┌──────────────────┐
│ SandboxExecutor │
│ Emits Event │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ event_bus.emit_ │
│ skill_execution │
└────────┬─────────┘
│
▼
┌──────────────────────────────────┐
│ EvolutionEngine.process_ │
│ execution() │
│ - Check agent maturity (>=SUPER │
│ VISED) │
│ - Check workspace opt-in │
│ - Check triggers: │
│ - latency > 5s │
│ - tokens > 5000 │
│ - execution failed │
└────────┬─────────────────────────┘
│
▼ (Trigger detected)
┌──────────────────────────────────┐
│ AlphaEvolverEngine.generate_ │
│ tool_mutation() │
│ - analyze_episode() │
│ - Extract performance signals │
│ - propose_code_change() │
│ - LLM generates mutated code │
│ - Create ToolMutation record │
└────────┬─────────────────────────┘
│
▼
┌──────────────────────────────────┐
│ AlphaEvolverEngine.sandbox_ │
│ execute_mutation() │
│ - Execute in ContainerSandbox │
│ - Capture proxy signals │
│ - Update sandbox_status │
└────────┬─────────────────────────┘
│
▼ (Execution passed)
┌──────────────────────────────────┐
│ FitnessService.evaluate_ │
│ initial_proxy() │
│ - Calculate fitness score │
│ - Syntax check: +0.2 │
│ - Execution: +0.3 │
│ - User approval: +0.5 │
│ - Update WorkflowVariant │
└────────┬─────────────────────────┘
│
▼ (External signals arrive)
┌──────────────────────────────────┐
│ FitnessService.evaluate_ │
│ delayed_webhook() │
│ - Process webhook signals │
│ - invoice_created: +0.4 │
│ - crm_conversion: +0.5 │
│ - conversion_value: scaled │
│ - Adjust fitness score │
└────────┬─────────────────────────┘
│
▼
┌──────────────────────────────────┐
│ Compare Variants │
│ - Original vs. Mutated │
│ - Select higher fitness │
└────────┬─────────────────────────┘
│
▼ (Mutated wins)
┌──────────────────────────────────┐
│ User Reviews Mutation │
│ - View code comparison │
│ - Check fitness delta │
│ - Approve or reject │
└────────┬─────────────────────────┘
│
▼ (Approved)
┌──────────────────────────────────┐
│ Promote Mutated Skill │
│ - Replace original code │
│ - Track lineage (parent_id) │
│ - Update skill version │
└─────────────────────────────────┘Event Flow
┌────────────────────────────────────────────────────────────────┐
│ Event Flow │
└────────────────────────────────────────────────────────────────┘
EpisodeService EventBus Handlers
│ │ │
│ emit_task_fail() │ │
├─────────────────────────>│ │
│ │ │
│ │ dispatch() │
│ ├─────────────────────> ReflectionEngine
│ │ │
│ │ dispatch() │
│ ├─────────────────────> AnalyticsHandler
│ │ │
│ │ dispatch() │
│ ├─────────────────────> CustomHandler
│ │ │
│ │ (exception in handler) │
│ ├─────────────────────X FailingHandler
│ │ │
│ │ (continue dispatch) │
│ ├─────────────────────> AnotherHandler
│ │ │
SandboxExecutor EventBus Handlers
│ │ │
│ emit_skill_execution() │ │
├─────────────────────────>│ │
│ │ │
│ │ dispatch() │
│ ├─────────────────────> EvolutionEngine
│ │ │
│ │ dispatch() │
│ ├─────────────────────> PerformanceTracker
│ │ │
│ │ dispatch() │
│ ├─────────────────────> CustomHandler
│ │ │Fitness Evaluation Flow
┌────────────────────────────────────────────────────────────────┐
│ Fitness Evaluation Flow │
└────────────────────────────────────────────────────────────────┘
Mutation Created
│
▼
┌────────────────────────┐
│ Sandbox Execution │
│ - Run mutated code │
│ - Capture output │
│ - Measure latency │
└────────┬───────────────┘
│
▼
┌────────────────────────────────┐
│ FitnessService.evaluate_ │
│ initial_proxy() │
│ │
│ Proxy Signals: │
│ - syntax_error: bool │
│ - execution_success: bool │
│ - execution_latency_ms: float │
│ - user_approved: bool │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ Calculate Proxy Score │
│ │
│ score = 0.0 │
│ if not syntax_error: │
│ score += 0.2 │
│ if execution_success: │
│ score += 0.3 │
│ if user_approved: │
│ score += 0.5 │
│ │
│ final_score = clamp(score, │
│ 0.0, 1.0) │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ Store Initial Score │
│ - variant.fitness_score │
│ - variant.fitness_signals │
│ - variant.evaluation_status │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ Wait for External Signals │
│ (webhook, API call) │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ FitnessService.evaluate_ │
│ delayed_webhook() │
│ │
│ External Signals: │
│ - invoice_created: bool │
│ - crm_conversion: bool │
│ - conversion_success: bool │
│ - conversion_value: float │
│ - email_bounce: bool │
│ - error_signal: bool │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ Adjust Fitness Score │
│ │
│ adjustment = 0.0 │
│ if invoice_created: │
│ adjustment += 0.4 │
│ if crm_conversion: │
│ adjustment += 0.5 │
│ if conversion_value: │
│ adjustment += min(0.5, │
│ value/1000)│
│ │
│ final_score = clamp(current + │
│ adjustment, │
│ 0.0, 1.0) │
└────────┬─────────────────────┘
│
▼
┌────────────────────────────────┐
│ Update Final Score │
│ - variant.fitness_score │
│ - variant.fitness_signals │
│ - variant.evaluation_status │
│ = 'evaluated' │
└──────────────────────────────┘---
Component Interactions
EventBus → MementoEngine
EventBus ReflectionEngine MementoEngine
│ │ │
│ on_task_fail() │ │
├───────────────────────────>│ │
│ │ │
│ │ process_failure() │
│ ├───────────────────────────>│
│ │ │
│ │ │ generate_skill_candidate()
│ │ ├───────────────────────────> DB
│ │ │
│ │ │ SkillCandidate created
│ │<───────────────────────────┤EventBus → AlphaEvolverEngine
EventBus EvolutionEngine AlphaEvolverEngine
│ │ │
│ on_skill_execution() │ │
├──────────────────────────>│ │
│ │ │
│ │ process_execution() │
│ ├───────────────────────────>│
│ │ │
│ │ │ generate_tool_mutation()
│ │ ├───────────────────────────> DB
│ │ │
│ │ │ ToolMutation created
│ │<───────────────────────────┤MementoEngine → ContainerSandbox
MementoEngine ContainerSandbox Docker/Subprocess
│ │ │
│ execute_raw_python() │ │
├───────────────────────>│ │
│ │ │
│ │ docker run / python3 │
│ ├─────────────────────────>│
│ │ │
│ │ execution result │
│ │<─────────────────────────┤
│ │ │
│ result │ │
│<───────────────────────┤ │AlphaEvolverEngine → FitnessService
AlphaEvolverEngine FitnessService Database
│ │ │
│ evaluate_ │ │
│ initial_proxy() │ │
├───────────────────────>│ │
│ │ │
│ │ Query variant │
│ ├────────────────────>│
│ │ │
│ │<─────────────────────┤
│ │ │
│ │ Update fitness │
│ ├────────────────────>│
│ │ │
│ fitness_score │ │
│<───────────────────────┤ │AutoDevCapabilityService → All Engines
AutoDevCapabilityService MementoEngine AlphaEvolverEngine
│ │ │
│ can_use( │ │
│ memento_skills) │ │
├───────────────────────>│ │
│ │ │
│ True/False │ │
│<───────────────────────┤ │
│ │ │
│ can_use( │ │
│ alpha_evolver) │ │
├───────────────────────────────────────────────>│
│ │ │
│ True/False │
│<──────────────────────────────────────────────┤---
Database Schema
ToolMutation Table
CREATE TABLE tool_mutations (
id VARCHAR(36) PRIMARY KEY,
tenant_id VARCHAR(36) NOT NULL,
parent_tool_id VARCHAR(36),
tool_name VARCHAR(255) NOT NULL,
mutated_code TEXT NOT NULL,
sandbox_status VARCHAR(50) DEFAULT 'pending',
execution_error TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
INDEX ix_tool_mutations_tenant_id (tenant_id),
INDEX ix_tool_mutations_parent_tool_id (parent_tool_id)
);**Relationships:**
parent_tool_id→tool_mutations.id(self-referential, lineage tracking)
WorkflowVariant Table
CREATE TABLE workflow_variants (
id VARCHAR(36) PRIMARY KEY,
tenant_id VARCHAR(36) NOT NULL,
parent_variant_id VARCHAR(36),
agent_id VARCHAR(36),
workflow_definition JSONB NOT NULL,
fitness_score FLOAT,
fitness_signals JSONB,
evaluation_status VARCHAR(50) DEFAULT 'pending',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
last_evaluated_at TIMESTAMP WITH TIME ZONE,
INDEX ix_workflow_variants_tenant_id (tenant_id),
INDEX ix_workflow_variants_parent_variant_id (parent_variant_id),
INDEX ix_workflow_variants_agent_id (agent_id)
);**Relationships:**
parent_variant_id→workflow_variants.id(self-referential, lineage tracking)agent_id→agents.id(foreign key to agents table)
SkillCandidate Table
CREATE TABLE skill_candidates (
id VARCHAR(36) PRIMARY KEY,
tenant_id VARCHAR(36) NOT NULL,
agent_id VARCHAR(36),
source_episode_id VARCHAR(36),
skill_name VARCHAR(255) NOT NULL,
skill_description TEXT,
generated_code TEXT NOT NULL,
failure_pattern JSONB,
validation_status VARCHAR(50) DEFAULT 'pending',
validation_result JSONB,
fitness_score FLOAT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
validated_at TIMESTAMP WITH TIME ZONE,
promoted_at TIMESTAMP WITH TIME ZONE,
INDEX ix_skill_candidates_tenant_id (tenant_id),
INDEX ix_skill_candidates_agent_id (agent_id),
INDEX ix_skill_candidates_source_episode_id (source_episode_id),
INDEX ix_skill_candidates_tenant_status (tenant_id, validation_status)
);**Relationships:**
agent_id→agents.id(foreign key to agents table)source_episode_id→episodes.id(foreign key to episodes table)
Query Patterns
**Lineage Traversal:**
-- Trace mutation lineage
WITH RECURSIVE lineage AS (
SELECT id, parent_tool_id, tool_name, 0 as depth
FROM tool_mutations
WHERE id = 'mutation-123'
UNION ALL
SELECT m.id, m.parent_tool_id, m.tool_name, l.depth + 1
FROM tool_mutations m
JOIN lineage l ON m.id = l.parent_tool_id
)
SELECT * FROM lineage;**Top Variants:**
-- Get top variants by fitness
SELECT id, agent_id, fitness_score
FROM workflow_variants
WHERE tenant_id = 'tenant-123'
AND fitness_score IS NOT NULL
AND fitness_score > 0.0
ORDER BY fitness_score DESC
LIMIT 5;**Pending Candidates:**
-- Get pending skill candidates
SELECT id, skill_name, created_at
FROM skill_candidates
WHERE tenant_id = 'tenant-123'
AND validation_status = 'pending'
ORDER BY created_at DESC;---
Security Boundaries
Sandbox Isolation
┌────────────────────────────────────────────────────────────┐
│ ContainerSandbox │
├────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Docker Container Isolation │ │
│ │ │ │
│ │ Security Constraints: │ │
│ │ - network: none (no network access) │ │
│ │ - read-only filesystem (except /tmp) │ │
│ │ - memory: 256m limit │ │
│ │ - cpus: 1 limit │ │
│ │ - cap-drop: ALL (drop Linux capabilities) │ │
│ │ - tmpfs: /tmp (rw,noexec,nosuid,size=64m) │ │
│ │ │ │
│ │ Code Execution: │ │
│ │ ┌────────────────────────────────────────┐ │ │
│ │ │ User Python Code │ │ │
│ │ │ - No network access │ │ │
│ │ │ - No filesystem write (except /tmp) │ │ │
│ │ │ - Memory limited │ │ │
│ │ │ - Timeout enforced │ │ │
│ │ └────────────────────────────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Fallback (if Docker unavailable): │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Subprocess Isolation (Weaker) │ │
│ │ - Basic timeout enforcement │ │
│ │ - No resource limits │ │
│ │ - No network isolation │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘Tenant Isolation
┌────────────────────────────────────────────────────────────┐
│ Tenant Isolation │
├────────────────────────────────────────────────────────────┤
│ │
│ Application Layer: │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ All queries MUST include tenant_id filter │ │
│ │ │ │
│ │ ✅ GOOD: │ │
│ │ mutations = db.query(ToolMutation) │ │
│ │ .filter(ToolMutation.tenant_id == tenant_id) │ │
│ │ │ │
│ │ ❌ BAD: │ │
│ │ mutations = db.query(ToolMutation).all() │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Database Layer: │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Row-Level Security (RLS) - Optional │ │
│ │ │ │
│ │ ALTER TABLE tool_mutations ENABLE ROW LEVEL │ │
│ │ SECURITY; │ │
│ │ │ │
│ │ CREATE POLICY tenant_isolation ON tool_mutations │ │
│ │ FOR ALL USING (tenant_id = current_tenant()); │ │
│ │ │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ Sandbox Layer: │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ ContainerSandbox tenant_id parameter │ │
│ │ - Used for tracking and logging │ │
│ │ - Isolates execution by tenant │ │
│ │ - No cross-tenant data access │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘Maturity Gates
┌────────────────────────────────────────────────────────────┐
│ Maturity-Based Access │
├────────────────────────────────────────────────────────────┤
│ │
│ AutoDevCapabilityService.can_use() Checks: │
│ │
│ 1. Workspace Settings: │
│ ┌──────────────────────────────────────────────────┐ │
│ │ auto_dev.enabled = true │ │
│ │ auto_dev.memento_skills = true │ │
│ │ auto_dev.alpha_evolver = true │ │
│ └──────────────────────────────────────────────────┘ │
│ │
│ 2. Agent Maturity Level: │
│ ┌──────────────────────────────────────────────────┐ │
│ │ Capability Required Maturity │ │
│ │ ──────────────────────────────────────────── │ │
│ │ auto_dev.memento_skills INTERN │ │
│ │ auto_dev.alpha_evolver SUPERVISED │ │
│ │ auto_dev.background_evolution AUTONOMOUS │ │
│ └──────────────────────────────────────────────────┘ │
│ │
│ 3. Daily Limits: │
│ ┌──────────────────────────────────────────────────┐ │
│ │ max_mutations_per_day: 10 │ │
│ │ max_skill_candidates_per_day: 5 │ │
│ └──────────────────────────────────────────────────┘ │
│ │
│ Access Decision Matrix: │
│ ┌────────────┬─────────┬───────────────┬─────────────────┐ │
│ │ Maturity │ Setting │ Daily Limit │ Can Use? │ │
│ ├────────────┼─────────┼───────────────┼─────────────────┤ │
│ │ STUDENT │ true │ Within limit │ ❌ No │ │
│ │ INTERN │ true │ Within limit │ ✅ Memento only │ │
│ │ SUPERVISED │ true │ Within limit │ ✅ Memento + │ │
│ │ │ │ │ AlphaEvolver │ │
│ │ AUTONOMOUS │ true │ Within limit │ ✅ All │ │
│ │ ANY │ false │ N/A │ ❌ No │ │
│ │ ANY │ true │ Exceeded │ ❌ No │ │
│ └────────────┴─────────┴───────────────┴─────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘Daily Limits Protection
┌────────────────────────────────────────────────────────────┐
│ Resource Exhaustion Prevention │
├────────────────────────────────────────────────────────────┤
│ │
│ AutoDevCapabilityService.check_daily_limits(): │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Count Today's Usage: │ │
│ │ │ │
│ │ today_start = today 00:00:00 UTC │ │
│ │ │ │
│ │ mutations_today = │ │
│ │ SELECT COUNT(*) FROM tool_mutations │ │
│ │ WHERE tenant_id = ? │ │
│ │ AND created_at >= today_start │ │
│ │ │ │
│ │ candidates_today = │ │
│ │ SELECT COUNT(*) FROM skill_candidates │ │
│ │ WHERE agent_id = ? │ │
│ │ AND created_at >= today_start │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Compare to Limits: │
│ ┌────────────────────────────────────────────────────┐ │
│ │ if mutations_today >= max_mutations_per_day: │ │
│ │ return False # Block mutation │ │
│ │ │ │
│ │ if candidates_today >= max_skill_candidates: │ │
│ │ return False # Block candidate │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Reset Time: Midnight UTC │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Daily limits automatically reset at 00:00:00 UTC │ │
│ │ No manual intervention required │ │
│ └────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘---
Extension Points
Custom Learning Engines
Extend BaseLearningEngine to create custom learning loops:
from core.auto_dev.base_engine import BaseLearningEngine
class CustomLearningEngine(BaseLearningEngine):
"""Custom learning engine for domain-specific self-improvement."""
async def analyze_episode(self, episode_id: str, **kwargs):
"""Extract domain-specific signals."""
pass
async def propose_code_change(self, context: dict, **kwargs):
"""Generate domain-specific modifications."""
pass
async def validate_change(self, code: str, test_inputs: list, tenant_id: str):
"""Validate with domain-specific tests."""
passCustom Event Handlers
Subscribe to EventBus for custom behavior:
from core.auto_dev.event_hooks import event_bus, TaskEvent
@event_bus.on_task_fail
async def custom_failure_handler(event: TaskEvent):
"""Custom failure processing."""
# Your logic here
passCustom Fitness Functions
Extend FitnessService for domain-specific fitness:
from core.auto_dev.fitness_service import FitnessService
class DomainFitnessService(FitnessService):
"""Custom fitness evaluation."""
def evaluate_business_value(self, variant_id, tenant_id, metrics):
"""Evaluate business impact."""
passCustom Sandbox Backends
Implement SandboxProtocol for custom isolation:
from core.auto_dev.base_engine import SandboxProtocol
class CustomSandbox(SandboxProtocol):
"""Custom sandbox implementation."""
async def execute_raw_python(self, tenant_id, code, inputs, **kwargs):
"""Execute in custom environment."""
passCustom Capability Gates
Extend AutoDevCapabilityService for custom gating:
from core.auto_dev.capability_gate import AutoDevCapabilityService
class CustomCapabilityService(AutoDevCapabilityService):
"""Custom capability gating."""
CAPABILITY_GATES = {
**AutoDevCapabilityService.CAPABILITY_GATES,
"auto_dev.custom_feature": "SUPERVISED",
}
def can_use_custom_feature(self, agent_id, custom_condition):
"""Check custom capability."""
pass---
See Also
- AUTO_DEV_API_REFERENCE.md - Complete API documentation
- AUTO_DEV_USER_GUIDE.md - End-user guide
- AUTO_DEV_DEVELOPER_GUIDE.md - Developer guide
- AUTO_DEV_EVENT_PROTOCOL.md - Event protocol
- AUTO_DEV_INTEGRATION_GUIDE.md - Deployment and monitoring