Dosu LogoDosu Logo
Ask
Join our Discord
Organization avatar
difyPublic
Dify
Documentsdify
Agent API Routes
Agent API Routes
Type
Topic
Status
Published
Created
Aug 2, 2026
Updated
Aug 2, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Agent API Routes#

Dify's console agent API routes live under /console/api/agent (singular) and are split across two controller files in api/controllers/console/agent/:

  • roster.py — CRUD and lifecycle operations for roster agents (list, create, get, update, delete, publish, draft management, API keys, logs, statistics, versions)
  • composer.py — Agent composition endpoints used by both standalone agents (/agent/<agent_id>/composer) and inline workflow-node agents (/apps/<app_id>/workflows/draft/nodes/<node_id>/agent-composer)

A thin helper module, app_helpers.py, provides resolve_agent_app_model() and resolve_agent_runtime_app_model() to translate the public agent_id UUID to the internal App model via AgentRosterService.


v1.16.0 Plural → Singular Unification (PR #37465)#

PR #37465 (merged ~June 2026) executed a hard rename of every agent route from the old plural namespace to singular:

Old (plural)New (singular)
GET/POST /console/api/agentsGET/POST /console/api/agent
/agents/<agent_id>/versions/agent/<agent_id>/versions
/agents/invite-options/agent/invite-options
/apps/<app_id>/agent-composer/agent/<agent_id>/composer
/apps/<app_id>/agent-composer/validate/agent/<agent_id>/composer/validate
/apps/<app_id>/agent-composer/candidates/agent/<agent_id>/composer/candidates

The refactor also changed the primary addressing key: instead of the internal app_id, callers now use the public agent_id. Internal resolution still maps through AgentRosterService.get_agent_app_model() .


Known Bugs from the Refactor#

404 on Agent Creation in Dev Mode (Issue #38646)#

After the unification, the frontend in dev mode was still calling POST /console/api/agents (plural). The backend no longer registered that path, so every agent creation attempt returned 404 . Fix: update frontend calls to POST /console/api/agent (singular).

500 on Agents Configure Page — Custom API Tool Providers (Issue #39169)#

The Agents configure page's credential schema fetch unconditionally used the builtin provider URL template (/tool-provider/builtin/<provider>/credential/...) regardless of providerType. For custom API tools whose tool.id is a UUID (not a plugin identifier), the plugin daemon received a request for langgenius/<UUID> and raised PluginNotFoundError, surfacing as a 500 . Fix (PR #39206): gate both useGetApi and CredentialStatus on providerType !== 'builtin' to short-circuit non-builtin providers before making the request .


Current Route Map (roster.py)#

Key endpoints defined in roster.py:

MethodPathPurpose
GET/POST/agentList / create agent apps
GET/PUT/DELETE/agent/<agent_id>Get / update / delete agent
POST/agent/<agent_id>/publishPublish draft
GET/PUT/DELETE/agent/<agent_id>/build-draftDraft management
POST/agent/<agent_id>/build-draft/checkoutCheckout build draft
POST/agent/<agent_id>/build-draft/applyApply build draft
POST/agent/<agent_id>/copyCopy agent
GET/POST/agent/<agent_id>/api-keysManage service API keys
GET/agent/<agent_id>/logsConversation logs
GET/agent/<agent_id>/statistics/summaryUsage statistics
GET/agent/<agent_id>/versionsVersion history
POST/agent/<agent_id>/versions/<version_id>/restoreRestore version

Agent V2 Backend Plumbing (PR #38162)#

PR #38162 synced Agent V2 daily changes, wiring new services and controllers:

  • New services: api/services/agent_config_service.py, api/services/agent_tool_inner_service.py, api/services/agent/config_skill_normalize_service.py
  • Inner API controllers: api/controllers/inner_api/agent/tools.py, api/controllers/inner_api/plugin/agent_config.py
  • Inspector endpoint: api/controllers/console/app/agent_config_inspector.py for inspecting agent configuration
  • Config layer rename: The "drive" concept was renamed to "config" throughout the runtime stack — DifyDriveLayerConfig → DifyConfigLayerConfig; build_drive_layer_config() → build_config_layer_config()

The Agent V2 runtime node itself lives in api/core/workflow/nodes/agent_v2/ and is separate from the console route layer .


API Contract Schemas (PR #37210)#

PR #37210 tightened OpenAPI contract schemas for Agent V2:

  • Replaced dict[str, Any] fields in api/models/agent_config_entities.py with typed models (AgentPermissionConfig, AgentCliToolConfig, etc.)
  • Added json_schema_extra={"x-dify-opaque": True} to fields that remain intentionally loose at runtime
  • Removed "inaccurate" deprecation markers from generated packages/contracts/generated/api/console/agents/orpc.gen.ts to unblock client migration
Documents
Account Activity Tracking
Agent API Routes
Agent App Architecture
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent App Event Architecture
Agent App Input Variables
Agent Cost and Usage Tracking
Agent File Handling
Agent File Upload Configuration
Agent Icon Data Model
Agent Log Event Pipeline
Agent Message History
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent Model Settings
Agent Node Data Models
Agent Response Schema
Agent Runtime
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent Runtime Backend Initialization
Agent Runtime Layer Provider Registration
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent Sandbox SSRF Allowlisting
Agent Shell Layer
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent Strategy Plugin Architecture
Agent V2 Architecture
Dify Agent Server 模块分析 (Commit 55f95dbc)
Agent V2 Configure Interface
Agent V2 Feature Flags
Agent V2 File and Vision Handling
Agent V2 Publish Validation
Agent V2 Variable System
Agent Workflow Node Variable References
API Documentation Pipeline
App Mode Configuration
App Publishing and Embedding
Audio to Text API
Auth Route Architecture
Automatic Rule Generation
Avatar Management
Branding Customization
Browser Tab and State Management
Builtin Tool Provider Credentials
Celery Task Resilience
Chat Action Bar Mobile Visibility
Chat Avatar Rendering
Chatbot Conversation State Recovery
Chatbot Widget Embedding
Collaborative Workflow Editing
Console API DELETE Request Handling
Console Authentication
Conversation Deep-Linking
Credential Encryption and Secret Management
CSV Data Ingestion
Custom Tool Authentication
Custom Tool HTTP Timeout Configuration
Custom Tool OpenAPI Integration
Data Export
Database Migration System
Database Session Management
Database Transaction Isolation
Dataset Batch Import
Dataset Deletion
Dataset Permission Model
Dataset Segmentation Configuration
Dependency Injection and Testability
Dify Agent Server 模块分析 (Commit 55f95dbc)
Dify Agent Monorepo Structure
Dify Agent Server 模块分析 (Commit 55f95dbc)
Dify Cloud Billing
Dify OpenAPI
difyctl CLI
Docker Container Security
Docker Deployment and Upgrades
Docker Frontend Configuration
Docker Image Publishing
Docker Networking
Docker Storage and Permissions
Document Indexing Operations
DocumentSegment Position Assignment
Draft Variable Storage Cleanup
E2B Sandbox Integration
Edition-Based Feature Gating
Elasticsearch Integration
Embedding Cache Integrity
Excel Extractor
External Knowledge Integration
Extractor Encoding Fallback
File Access Control
File Array Handling
File Download Architecture
File Download Security
File Storage Synchronization
File Upload and Download Integrity
File Upload Configuration
File Upload Processing
File URL Resolution
Flask Application Architecture
Flask Blueprint and Route Registration
Graph Streaming Infrastructure
Home Directory Management
HTTP Request Node
HTTP Request Node Key-Value Editor
HTTP Request Node Size Constraints
httpx and Gevent Compatibility
Human Input Node
Hybrid Search
Icon URL Resolution
Iframe Embedding Security
Internationalization and Locale Management
Jina Reranker Integration
JSON-in-Markdown Parsing
JWT Authentication
Keyboard Shortcut Management
Keyword Moderation
Knowledge Base API
Knowledge Base Document Processing
Knowledge Base Metadata Filtering
Knowledge Base Summarization Pipeline
Langfuse Integration
Lexical Editor Integration
LLM Provider Message Validation
LLM Structured Output
Local Development Configuration
Local Embedding Model Deployment
Log Filtering
Markdown Extractor Heading Parsing
Markdown Rendering
Marketplace Plugin Filtering
MCP Client Transport and Connectivity
MCP OAuth Integration
MCP Protocol Integration
MCP Protocol Integration for Dify Workflows
MCP Provider Architecture
MCP Tool Content Processing
MCP Tool Integration
MCP Tool Parameter Binding
MCP Tool Provider Management
Messaging Platform Integration
Milvus Integration
Model Provider Error Handling
Monaco Editor Integration
Multi-Tenant Context Propagation
Multimodal Knowledge Base Support
Multimodal Prompt Delivery
N+1 Query Optimization
Next.js Routing and Redirects
Next.js SSR Authentication
Nginx Reverse Proxy Configuration
Notion Extractor Table Parsing
NumPy CPU Compatibility
OAuth Login Flow
Observability and Tracing
OpenAI-Compatible Server Integration
OpenAPI Spec Accuracy
OpenDAL Storage Backend
Ops Trace Data Models
Oracle Database Connectivity
Parallel Workflow Execution
Parent-Child Retrieval Architecture
Plugin API Key Configuration
Plugin Architecture
Plugin Credential Management
Plugin Daemon Architecture
Plugin Daemon Communication
Plugin Daemon Model Parameter Handling
Plugin Database Integrity
Plugin Error Handling
Plugin File Handling
Plugin Lifecycle Management
Plugin Marketplace Connectivity
Plugin Model Caching
Plugin Permissions
Plugin Storage Configuration
Plugin System Timeouts
Plugin Taxonomy and Validation
Plugin Trigger OAuth Refresh
Private Address Detection
Provider Model & Credential Management
Pyrefly Type Checker
RAG Web Crawling Providers
Rate Limiting and Concurrency Control
RBAC Initialization
RBAC Permission Key Lookup
Reasoning Model Integration
Reasoning Tag Filtering
Redis Connection Management
Redis Streaming Resilience
Release Breaking Changes
Remote File Fetching
Remote File Handling and Validation
Retrieval Filtering and Scoring
RTL Locale Support
Sandbox Code Execution
Sandbox Network Isolation
Segment Update and Attachment Lifecycle
Server Deployment Configuration
Service API Error Handling
Service API Pagination
Shell Provider Lifecycle
Snippet Variable Handling
SQLite Test Infrastructure
SSE Stream Lifecycle
SSE Stream Terminal Event Delivery
SSR Data Fetching
SSRF Proxy
Suggested Questions After Answer
Summary Index
Tenant-Isolated Document Indexing Queue
Test Doubles and In-Memory Repositories
TiDB Vector Full-Text Search
Time Tools
Timestamp Management
Tool File URL Signing
Tool Node Input Validation
Tool OAuth Authorization
Tool Provider Authorization
Trace Task Pipeline
User and Tenant Context Propagation
Dify Agent Server 模块分析 (Commit 55f95dbc)
User Roles and Permissions
Variable Pool Falsy Value Handling
Variable Resolution and Template Substitution
Vector Database Plugin Architecture
Vector Store Integration
Weaviate Vector Store
Web Container Docker Configuration
Webhook Trigger System
WebSocket Service Architecture
Word Document Extraction
Workflow Agent Node Configuration
Workflow and Agent Composition
Workflow Conditional Branching
Workflow Container Nodes
Workflow Conversation State Management
Workflow Draft Synchronization
Workflow Execution Dispatch
Dify Agent Server 模块分析 (Commit 55f95dbc)
Workflow Execution Persistence
Workflow Fail Branch Architecture
Workflow File Handling
Workflow Graph Validation
Workflow Iteration Node Execution
Workflow LLM Node Configuration
Workflow Memory Management
Workflow Node Canvas Summary Rendering
Workflow Node Versioning
Workflow Pause-Resume State Management
Workflow Resume Architecture
Workflow Run State Management
Workflow Schedule Triggers
Workflow Test Run Execution
Workflow Timeout and Execution Limits
Workflow Tool Visibility and Access Control
Workflow Trigger Log Lifecycle
Workflow Variable Size Management