English (this page) | 中文文档
nano_agent_team_selfevolve is a secondary development branch based on nano_agent_team, focused on an unattended self-evolution workflow driven by a multi-agent team.
For full framework documentation (architecture, TUI/CLI details, tool system), refer to the upstream README.
The self-evolution workflow enables the codebase to autonomously improve itself across rounds without human intervention. Each round runs a structured pipeline:
Phase 0 (Research) → Audit → Architect → Developer → Tester → Reviewer → Merge
A team of specialized agents collaborates on each round:
| Agent | Role |
|---|---|
| Architect | Decides what to build based on research and audit findings |
| Developer | Implements the feature or integration |
| Tester | Writes and runs tests, checks quality gate |
| Auditor | Scans the codebase for dead code, gaps, and opportunities |
| Reviewer | Final code review and approval before merge |
Supported LLM providers: Qwen, OpenAI, DeepSeek, Step, Moonshot, and any OpenAI-compatible endpoint.
| Parameter | Value |
|---|---|
| Evolution rounds | 5 |
| Model | ltcraft/claude-opus-4-6 |
| Run timestamp | 20260311_225548 |
| Session script | evolve_session.sh |
evolve_session.sh orchestrates a complete automated session:
- Clean — remove previous evolution artifacts
- Evolve — run N rounds via
evolve.sh - Record — capture screen recording via ffmpeg (macOS)
- Debug — analyze results and test new features via Claude Code CLI
- Document — write/update
README.mdandREADME_CN.md - Push — commit and push to GitHub
All 5 rounds passed in this session.
| Round | Timestamp | Type | Feature | Status |
|---|---|---|---|---|
| r1 | 2026-03-11 22:55 | FEATURE | DataAnalysisTool | PASS |
| r2 | 2026-03-12 00:40 | INTEGRATION | ArxivSearchTool wiring | PASS |
| r3 | 2026-03-12 01:44 | FEATURE | CodeAnalysisTool | PASS |
| r4 | 2026-03-12 02:01 | FEATURE | MarkdownExportTool | PASS |
| r5 | 2026-03-12 02:55 | FEATURE | TokenUsageTracker | PASS |
r1 — DataAnalysisTool (backend/tools/data_analysis.py)
Structured CSV/JSON data analysis with three operations: describe, query, and aggregate. Zero external dependencies (stdlib only). 38 unit tests, all passing.
r2 — ArxivSearchTool integration (backend/tools/arxiv_search.py)
Wired an existing but unregistered tool into tool_registry.py, main.py, and agent_bridge.py. Refactored to inherit from BaseTool. 11 integration tests, all passing.
r3 — CodeAnalysisTool (backend/tools/code_analysis.py)
AST-based Python code structure analysis using stdlib ast. Four operations: list_symbols, get_imports, get_structure, complexity_score. 15 unit tests, all passing.
r4 — MarkdownExportTool (backend/tools/markdown_export.py)
Agent-callable tool to write structured markdown files with configurable headers and sections. 16 unit tests, all passing.
r5 — TokenUsageTracker (backend/tools/token_usage_tracker.py, src/core/middlewares/token_tracking.py)
Singleton token/cost tracker + agent-callable query tool + StrategyMiddleware that intercepts LLM responses to accumulate usage stats per model and per session. 21 unit tests across 4 test classes, all passing.
backend/tools/— 5 new tool filessrc/core/middlewares/token_tracking.py— new middlewarebackend/llm/tool_registry.py— updated each roundmain.py— updated each roundsrc/tui/agent_bridge.py— updated each roundtests/— 6 new test files (101 tests total)docs/system_design.md— updated each round
Post-evolution analysis (evolve_session.sh Phase 3) examined each new tool and its wiring points.
Findings:
- All 5 tools are correctly registered in
tool_registry.pyand injected into both entry points (main.pyandagent_bridge.py). - Round 2 required a second iteration: the initial ArxivSearchTool implementation failed the
BaseToolinheritance check; fixed in the same round by Developer2. - Round 3 produced one non-blocking quality warning (false-positive self-match in CodeAnalysisTool); no action needed.
- No regressions detected across rounds.
Current feature availability:
| Tool | Available in CLI | Available in TUI |
|---|---|---|
| DataAnalysisTool | Yes | Yes |
| ArxivSearchTool | Yes | Yes |
| CodeAnalysisTool | Yes | Yes |
| MarkdownExportTool | Yes | Yes |
| TokenUsageTracker | Yes | Yes |
git clone https://github.com/<your-org>/nano_agent_team_selfevolve.git
cd nano_agent_team_selfevolve
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtEdit backend/llm_config.json to select a provider, then export the corresponding API key:
export OPENAI_API_KEY="your_key"
export DASHSCOPE_API_KEY="your_key"
# or other provider keys as neededOr pass a key file:
python main.py --keys /path/to/keys.jsonNormal agent mode:
python main.py "Your mission"Optional TUI:
python tui.py# Run 5 rounds with default model
bash evolve.sh 5
# Run 10 rounds with a specific model
bash evolve.sh 10 qwen/qwen-plus
# Stop after the current round completes
touch .evolution_stop.
├── backend/
│ ├── llm/ # Engine, providers, middleware chain, tool registry
│ └── tools/ # Tool implementations (DataAnalysis, CodeAnalysis, etc.)
├── docs/
│ └── system_design.md # Architecture reference
├── evolution_reports/ # Per-round markdown reports
├── src/
│ ├── core/
│ │ └── middlewares/ # StrategyMiddleware implementations
│ ├── prompts/ # Agent prompt protocols
│ └── tui/ # Terminal UI and agent bridge
├── tests/ # Unit and integration tests
├── evolve.sh # Round-based evolution loop
├── evolve_session.sh # Full automated session (record + debug + doc + push)
├── evolution_history.jsonl # Append-only round history
├── evolution_state.json # Current evolution state snapshot
├── main.py # CLI entry point
└── tui.py # TUI entry point
MIT — see LICENSE.