dify/api/core/workflow
Yansong Zhang 96641a93f6 feat(api): add Agent V2 node and new Agent app type (Phase 1-3)
Introduce a new unified Agent V2 workflow node that combines LLM capabilities
with agent tool-calling loops, along with a new AppMode.AGENT for standalone
agent apps backed by single-node workflows.

Phase 1 — Agent Patterns:
- Add core/agent/patterns/ module (AgentPattern, FunctionCallStrategy,
  ReActStrategy, StrategyFactory) ported from feat/support-agent-sandbox
- Add ExecutionContext, AgentLog, AgentResult entities
- Add Tool.to_prompt_message_tool() for LLM-consumable tool conversion

Phase 2 — Agent V2 Workflow Node:
- Add core/workflow/nodes/agent_v2/ (AgentV2Node, AgentV2NodeData,
  AgentV2ToolManager, AgentV2EventAdapter)
- Register agent-v2 node type in DifyNodeFactory
- No-tools path: single LLM call (LLM Node equivalent)
- Tools path: FC/ReAct loop via StrategyFactory

Phase 3 — Agent App Type:
- Add AppMode.AGENT to model enum
- Add WorkflowGraphFactory for auto-generating start->agent_v2->answer graphs
- AppService.create_app() creates workflow draft for AGENT mode
- AppGenerateService.generate() routes AGENT to AdvancedChatAppGenerator
- Console API and DSL import/export support AGENT mode
- Default app template for AGENT mode

Old agent/agent-chat/LLM node paths are fully preserved.
38 unit tests all passing.

Made-with: Cursor
2026-04-08 12:31:23 +08:00
..
nodes feat(api): add Agent V2 node and new Agent app type (Phase 1-3) 2026-04-08 12:31:23 +08:00
__init__.py refactor(api): move workflow knowledge nodes and trigger nodes (#33445) 2026-03-15 15:24:59 +08:00
file_reference.py refactor(api): continue decoupling dify_graph from API concerns (#33580) 2026-03-25 20:32:24 +08:00
human_input_compat.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
human_input_forms.py refactor(api): continue decoupling dify_graph from API concerns (#33580) 2026-03-25 20:32:24 +08:00
node_factory.py feat(api): add Agent V2 node and new Agent app type (Phase 1-3) 2026-04-08 12:31:23 +08:00
node_runtime.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
system_variables.py refactor(api): rename dify_graph to graphon (#34095) 2026-03-25 21:58:56 +08:00
template_rendering.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
variable_pool_initializer.py refactor(api): rename dify_graph to graphon (#34095) 2026-03-25 21:58:56 +08:00
variable_prefixes.py refactor(api): continue decoupling dify_graph from API concerns (#33580) 2026-03-25 20:32:24 +08:00
workflow_entry.py refactor(api): type single-node graph structure with TypedDicts in workflow_entry (#34671) 2026-04-07 13:18:00 +00:00
workflow_run_outputs.py refactor(api): rename dify_graph to graphon (#34095) 2026-03-25 21:58:56 +08:00