Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jackson57279/zapdev/llms.txt
Use this file to discover all available pages before exploring further.
AI Agent Orchestration
ZapDev’s AI agent orchestration system powers code generation through a hybrid architecture combining custom streaming agents with Inngest Agent Kit workflows. The system handles everything from model selection to subagent research, enabling intelligent code generation across multiple frameworks.System Overview
Architecture Layers
The agent system operates across three primary layers:- Entry Point (
/api/agent/run): Validates requests and dispatches Inngest events - Orchestration Layer (
src/inngest/functions): Manages long-running workflows via Inngest Agent Kit - Execution Layer (
src/agents): Handles model selection, tool execution, and subagent coordination
Execution Flow
Model Selection System
Available Models
ZapDev supports multiple AI models with different capabilities:Automatic Model Selection
The system automatically selects the optimal model based on task complexity:- Enterprise/Long Prompts (>2000 chars): Claude Haiku 4.5
- Default: Z-AI GLM 4.7 (speed-optimized with subagent support)
- User Requests: Honor explicit model mentions in prompts
Inngest Workflow System
Code Agent Kit Workflow
The primary code generation workflow runs entirely in-memory:In-Memory Tool System
Tools operate on an in-memory file system, avoiding sandbox overhead:Subagent Research System
Research Detection
The system automatically detects when prompts require external research:Subagent Execution
When research is needed, the system spawns a specialized Morph V3 Large subagent:Research Task Types
The subagent system supports three task types:- Research: General information lookup and best practices
- Documentation: API references and official docs
- Comparison: Side-by-side feature comparisons
Agent Tools & Capabilities
Tool Context Interface
Brave Search Tools
For models with research capabilities, ZapDev provides Brave Search integration:Stream Events
The agent system emits typed events for real-time UI updates:Error Fixing Workflow
The system includes an auto-fix workflow for correcting TypeScript and build errors:Best Practices
DO
✅ Always use Inngest for long-running agent workflows ✅ Leverage subagents for research tasks to improve quality ✅ Use in-memory tools for WebContainer-based execution ✅ Select appropriate models based on task complexity ✅ Emit stream events for real-time UI feedback ✅ Extract<task_summary> tags to capture agent outputs
DON’T
❌ Never block API routes with long-running agent work ❌ Don’t use sandboxes for in-memory workflows (use WebContainer) ❌ Don’t skip model selection logic—auto-detection improves UX ❌ Don’t ignore subagent research for documentation queries ❌ Don’t forget to sanitize database inputs from agent outputsRelated Documentation
- Sandbox Utilities - E2B sandbox operations
- Framework Prompts - Framework-specific system prompts
- Architecture - Overall system architecture
- Tech Stack - Inngest and AI SDK details