a0-development
Development guide for extending and building features for the Agent Zero AI framework. Covers architecture, tools, extensions, API endpoints, agent profiles, projects, prompts, and skills — with correct paths, imports, and patterns matching the current codebase.
Agent Zero Team · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add Gen-Verse/PAST-Bench --skill a0-development技能说明
name: a0-development description: Development guide for extending and building features for the Agent Zero AI framework. Covers architecture, tools, extensions, API endpoints, agent profiles, projects, prompts, and skills — with correct paths, imports, and patterns matching the current codebase. version: 1.0.0 author: Agent Zero Team tags: ["development", "framework", "agent-zero", "extending", "tools", "extensions", "skills", "api", "agents", "prompts"] trigger_patterns:
- "extend agent zero"
- "agent zero development"
- "build agent zero feature"
- "create agent zero tool"
- "add extension"
- "framework development"
- "agent zero architecture"
- "how does agent zero work"
- "create agent zero extension"
- "add api endpoint"
- "create agent profile"
- "agent zero internals"
- "how does the agent loop work"
- "extension hook points"
- "prompt system"
- "agent profile"
Agent Zero Development Guide
This skill provides comprehensive, accurate guidance for extending and building features for Agent Zero. Use it when you need to:
- Understand the architecture and project layout
- Create new Tools for agent capabilities
- Add Extensions to hook into the framework lifecycle
- Build API Endpoints for the Web UI
- Create Agent Profiles (subordinates) with custom prompts
- Understand and extend the Prompt System
- Create Skills (see the dedicated
create-skillskill for the full wizard) - Work with Projects and workspace configuration
Path convention: Throughout this guide,
/a0/refers to the framework root — this is/a0/inside Docker, or your local repository root in development. All paths are relative to this root.
[!IMPORTANT] Plugins are the primary way to extend Agent Zero. Most new tools, extensions, and prompts should be packaged as plugins. For all plugin tasks (create, review, manage, debug, contribute), load the
a0-plugin-routerskill which routes to the appropriate specialist. This guide covers the underlying framework patterns that plugins build upon.
Related skills: a0-plugin-router (plugin tasks) | create-skill (skill creation wizard) | a0-create-plugin | a0-review-plugin | a0-manage-plugin | a0-contribute-plugin | a0-debug-plugin
Architecture Overview
Project Layout
/a0/ # Framework root
├── agent.py # Core Agent + AgentContext + AgentConfig classes
├── initialize.py # Agent initialization logic
├── models.py # Model definitions
├── run_ui.py # Web UI entry point
│
├── tools/ # Core tools (search, response, browser, etc.)
├── extensions/
│ ├── python/ # Python lifecycle extensions
│ │ ├── <hook_point>/ # e.g., agent_init/, system_prompt/, etc.
│ │ │ └── _NN_name.py # Numbered extension files
│ │ └── _functions/ # Implicit @extensible decorator extensions
│ └── webui/ # JavaScript WebUI extensions
│ └── <hook_point>/ # e.g., json_api_call_before/
│ └── name.js
├── api/ # Flask API endpoint handlers
├── helpers/ # Framework utilities and base classes
│ ├── tool.py # Tool + Response base classes
│ ├── extension.py # Extension base class + @extensible decorator
│ ├── api.py # ApiHandler base class
│ ├── files.py # File operations + prompt reading
│ ├── plugins.py # Plugin system manager
│ ├── print_style.py # Console output formatting
│ └── ... # Many more utility modules
│
├── prompts/ # Core prompt fragments (system, tools, framework)
├── agents/ # Agent profiles (subordinate specializations)
│ ├── default/ # Base profile (inherited by others)
│ ├── agent0/ # Main user-facing agent
│ ├── developer/ # Developer subordinate
│ ├── hacker/ # Security subordinate
│ ├── researcher/ # Research subordinate
│ └── _example/ # Example profile with tool + extension samples
│
├── plugins/ # Core plugins (tools, extensions, prompts)
│ ├── _code_execution/ # Terminal/Python/Node.js execution
│ ├── _memory/ # Persistent memory system
│ ├── _text_editor/ # File read/write/patch
│ ├── _model_config/ # LLM model selection
│ ├── _infection_check/ # Prompt injection safety
│ └── ... # More core plugins
│
├── skills/ # Core skills (SKILL.md bundles)
├── knowledge/ # Knowledge base files
├── webui/ # Web UI frontend
├── docs/ # Documentation
│
└── usr/ # User-space (survives updates)
├── agents/ # User-created agent profiles
├── plugins/ # User-installed plugins
├── skills/ # User-created skills
├── knowledge/ # User knowledge base files
├── extensions/ # Standalone user extensions (created on demand; prefer plugins instead)
├── projects/ # Project workspaces (created on demand when user adds projects via UI)
└── workdir/ # Default working directory
Key Architecture Patterns
- Plugin-first design — Most capabilities (tools, extensions, prompts) are delivered via plugins in
/a0/plugins/(core) or/a0/usr/plugins/(user). - Extensions execute in numeric order — Files named
_10_*.py,_20_*.py, etc. run sequentially within each hook point. - Tools inherit from
Tool— All tools implement theexecute()method returning aResponse.