dify/api/tests/unit_tests/core
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
..
agent refactor: core/tools, agent, callback_handler, encrypter, llm_generator, plugin, inner_api (#34205) 2026-03-28 10:14:43 +00:00
app refactor(api): tighten types for Tenant.custom_config_dict and MCPToolProvider.headers (#34698) 2026-04-08 01:36:42 +00:00
base refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
callback_handler refactor: core/tools, agent, callback_handler, encrypter, llm_generator, plugin, inner_api (#34205) 2026-03-28 10:14:43 +00:00
datasource refactor: migrate session.query to select API in core misc modules (#34608) 2026-04-07 04:08:34 +00:00
entities refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
extension test: add test for core extension, external_data_tool and llm generator (#32468) 2026-03-12 11:44:38 +08:00
external_data_tool test: add test for core extension, external_data_tool and llm generator (#32468) 2026-03-12 11:44:38 +08:00
file refactor(api): rename dify_graph to graphon (#34095) 2026-03-25 21:58:56 +08:00
helper refactor(api): tighten types for Tenant.custom_config_dict and MCPToolProvider.headers (#34698) 2026-04-08 01:36:42 +00:00
llm_generator refactor: migrate session.query to select API in core misc modules (#34608) 2026-04-07 04:08:34 +00:00
logging test: added for core logging and core mcp (#32478) 2026-03-12 11:44:56 +08:00
mcp fix: map checkbox and json_object types in MCP schema publishing (#34226) 2026-03-30 15:05:57 +00:00
memory refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
model_runtime refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
moderation refactor(api): continue decoupling dify_graph from API concerns (#33580) 2026-03-25 20:32:24 +08:00
ops refactor: migrate session.query to select API in core misc modules (#34608) 2026-04-07 04:08:34 +00:00
plugin perf: use global httpx client instead of per request create new one (#34311) 2026-04-01 01:19:32 +00:00
prompt refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
rag refactor(api): remove duplicated RAG entities from services layer (#34689) 2026-04-07 23:36:59 +00:00
repositories refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
schemas test: added for core module moderation, repositories, schemas (#32514) 2026-03-22 23:57:12 +08:00
telemetry feat: enterprise otel exporter (#33138) 2026-03-27 07:56:31 +00:00
tools refactor: core/tools, agent, callback_handler, encrypter, llm_generator, plugin, inner_api (#34205) 2026-03-28 10:14:43 +00:00
trigger refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
variables refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
workflow feat(api): add Agent V2 node and new Agent app type (Phase 1-3) 2026-04-08 12:31:23 +08:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
test_file.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
test_model_manager.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
test_provider_configuration.py refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
test_provider_manager.py refactor: use EnumText for model_type in provider models (#34300) 2026-03-31 00:31:33 +00:00
test_trigger_debug_event_selectors.py refactor(api): move workflow knowledge nodes and trigger nodes (#33445) 2026-03-15 15:24:59 +08:00