dify/api/tests/unit_tests
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
..
commands feat: add metrics to clean message and workflow-run task (#33143) 2026-03-17 13:55:28 +08:00
configs refactor: Unify NodeConfigDict.data and BaseNodeData (#32780) 2026-03-11 23:43:58 +08:00
controllers refactor: use sessionmaker in controllers, events, models, and tasks 1 (#34693) 2026-04-07 23:47:20 +00:00
core feat(api): add Agent V2 node and new Agent app type (Phase 1-3) 2026-04-08 12:31:23 +08:00
enterprise/telemetry feat: enterprise otel exporter (#33138) 2026-03-27 07:56:31 +00:00
events feat: enterprise otel exporter (#33138) 2026-03-27 07:56:31 +00:00
extensions fix: lighten the health checks for the Worker and Worker Beat services, and disable them by default (#34572) 2026-04-06 02:26:26 +00:00
factories chore: normalize frozenset literals and myscale typing (#34327) 2026-03-31 08:21:22 +00:00
fields refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
libs refactor(api): tighten login and wrapper typing (#34447) 2026-04-02 09:36:58 +00:00
models refactor: use EnumText for Provider.quota_type and consolidate ProviderQuotaType (#34299) 2026-03-31 00:29:57 +00:00
oss refactor(api): replace test fixture side-effect imports (#34421) 2026-04-02 04:55:15 +00:00
repositories refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
services refactor: use sessionmaker in controllers, events, models, and tasks 1 (#34693) 2026-04-07 23:47:20 +00:00
tasks refactor: migrate session.query to select API in small task files batch (#34684) 2026-04-07 22:58:23 +00:00
tools chore(api): align Python support with 3.12 (#34419) 2026-04-02 05:07:32 +00:00
utils refactor(api): use standalone graphon package (#34209) 2026-03-27 21:05:32 +00:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
.gitignore Enhance Code Consistency Across Repository with .editorconfig (#19023) 2025-04-29 18:04:33 +08:00
conftest.py refactor: select in service API wraps, file_preview, and site controllers (#34086) 2026-03-25 23:01:05 +09:00