AI and Agent System
Relevant source files
Warp is an AI-native terminal that integrates large language models directly into the command-line experience. The AI system is built around a sophisticated agent architecture that allows for both interactive conversations and autonomous task execution. This system leverages the Model Context Protocol (MCP) to interact with the local file system and external tools, supported by a robust Skills System and a cloud-based execution platform known as Oz.
System Architecture Overview
The AI capabilities in Warp are distributed across several layers, from the UI conversation model to the low-level protocol integrations.
Title: AI System Component Interaction
Sources: app/src/ai/agent/mod.rs, app/src/ai/skills/mod.rs, app/src/ai/mcp/mod.rs
Agent Conversations and Task Execution
The core of Warp's AI is the Agent system located in app/src/ai/agent/. This subsystem manages the lifecycle of an AI interaction, from the initial user prompt to the final execution of terminal commands or file edits.
- Conversation Model: Managed via
AIConversationId, the system maintains a linearized history of agent steps, including thought processes, tool calls, and outputs. - Task Store: Tracks the state of long-running autonomous tasks and their execution progress.
- Ambient Agents: Located in
app/src/ai/ambient_agents/, these agents provide "always-on" assistance, such as proactive command suggestions or error explanations, without requiring a dedicated chat session. - Execution Profiles: Define the constraints and capabilities of an agent session (e.g., local vs. cloud execution).
- Computer Use & Voice: Integrates screenshot-based automation via the
computer_usecrate and voice transcription inapp/src/ai/voice/.
For details, see Agent Conversations and Task Execution.
Sources: app/src/ai/agent/mod.rs, app/src/ai/ambient_agents/mod.rs
MCP (Model Context Protocol) Integration
Warp implements the Model Context Protocol (MCP) to provide a standardized way for AI agents to access tools and data. The integration in app/src/ai/mcp/ allows Warp to act as an MCP host.
- MCP Server Manager: Handles the lifecycle of MCP servers, including file-based watchers that detect new server configurations.
- Tool Exposure: Automatically discovers tools provided by MCP servers and exposes them as executable "skills" to the AI agent.
- Reconnecting Peer Logic: Ensures robust connections to external MCP servers.
- Bundled Skills: Warp includes several pre-configured MCP skills in
resources/bundled/mcp_skills/for common terminal operations. - External Config: External MCP servers can be configured via
.mcp.jsonat the project root .mcp.json1-12
For details, see MCP (Model Context Protocol) Integration.
Sources: app/src/ai/mcp/mod.rs, crates/warp_cli/src/mcp.rs, .mcp.json1-12
Skills System and Bundled Resources
The Skills System in app/src/ai/skills/ is the extensibility layer for Warp's AI. A "Skill" is a discrete capability that an agent can invoke to perform an action.
- Skill Resolution: The
SkillManagerresolves natural language intents to specific executable logic or MCP tools. - Bundled Skills: Located in
resources/bundled/skills/, these include built-in capabilities likeadd-mcp-server,modify-settings,oz-platform, andcreate-skill. - Agentic Development: Warp uses internal skills like
add-telemetryto assist developers in instrumenting the codebase .agents/skills/add-telemetry/SKILL.md2-4 - Channel Gating: Skills can be restricted to specific release channels (e.g., Dev or Preview) to allow for safe testing of new AI features.
For details, see Skills System and Bundled Resources.
Sources: app/src/ai/skills/mod.rs, .agents/skills/add-telemetry/SKILL.md1-50
Telemetry System
Warp uses a trait-based telemetry framework to monitor the performance and usage of AI features while respecting user privacy. This system ensures that instrumentation is domain-specific and follows strict data-handling rules.
- TelemetryEvent Trait: Defined in
warp_core, this trait ensures all events have a name, payload, and description .agents/skills/add-telemetry/SKILL.md32-34 - UGC Filtering: The system explicitly checks for User Generated Content (UGC) via the
contains_ugc()method to ensure sensitive data is not accidentally logged .agents/skills/add-telemetry/SKILL.md81-87 - Enablement States: Events can be gated by
FeatureFlagorChannelusing theEnablementStateenum .agents/skills/add-telemetry/SKILL.md49-54 - Registration: Events are registered via the
register_telemetry_event!macro and dispatched usingsend_telemetry_from_ctx!.agents/skills/add-telemetry/SKILL.md127-147
Title: Telemetry Data Flow and Code Entities
Sources: .agents/skills/add-telemetry/SKILL.md10-120 .agents/skills/add-telemetry/SKILL.md127-147
For details, see Telemetry System.