chore: move agent node back to core/workflows/nodes#33338
chore: move agent node back to core/workflows/nodes#33338fatelei wants to merge 1 commit intolanggenius:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on a significant refactoring effort to relocate the agent node's core implementation and related components within the project's directory structure. The primary goal is to enhance code maintainability and logical grouping by moving these files into the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Pyrefly DiffNo changes detected. |
There was a problem hiding this comment.
Code Review
The pull request refactors the project structure by relocating agent-related modules and classes, including AgentMaxIterationError, AgentNodeData, AgentOldVersionModelFeatures, ParamsAutoGenerated, and AgentNode, from the dify_graph.nodes.agent package to core.workflow.nodes.agent. This change involves updating import statements across multiple files such as cot_agent_runner.py, fc_agent_runner.py, agent_node.py, node.py, and test_mock_nodes.py to reflect the new module paths.
There was a problem hiding this comment.
Pull request overview
Refactors the workflow Agent node location by moving it back under core/workflow/nodes/agent and updating call sites/imports to use the new module path across runtime code and tests.
Changes:
- Update imports to reference
core.workflow.nodes.agent.AgentNodeinstead of the previousdify_graphlocation. - Add
core.workflow.nodes.agentpackage modules (agent_nodesupport types/exceptions and package export). - Update agent runners to import the relocated
AgentMaxIterationError.
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| api/tests/unit_tests/core/workflow/graph_engine/test_mock_nodes.py | Switches mock node test imports to the relocated AgentNode. |
| api/dify_graph/nodes/base/node.py | Updates AgentNode/AgentNodeData imports used when constructing node start events. |
| api/core/workflow/nodes/agent/exc.py | Introduces Agent-node-specific exception types under the new package. |
| api/core/workflow/nodes/agent/entities.py | Introduces Agent node Pydantic entities/types under the new package. |
| api/core/workflow/nodes/agent/agent_node.py | Updates imports to use the new in-package entities module. |
| api/core/workflow/nodes/agent/init.py | Exports AgentNode from the new package. |
| api/core/agent/fc_agent_runner.py | Updates AgentMaxIterationError import path. |
| api/core/agent/cot_agent_runner.py | Updates AgentMaxIterationError import path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pyrefly DiffNo changes detected. |
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-12 09:10:03.721269381 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-12 09:09:55.133274863 +0000
@@ -483,8 +483,10 @@
--> dify_graph/graph_engine/layers/execution_limits.py:141:81
ERROR Object of class `GraphExecutionProtocol` has no attribute `node_executions` [missing-attribute]
--> dify_graph/nodes/base/node.py:331:31
+ERROR Argument `Any | None` is not assignable to parameter `name` with type `bytearray | bytes | str` in function `dify_graph.entities.agent.AgentNodeStrategyInit.__init__` [bad-argument-type]
+ --> dify_graph/nodes/base/node.py:392:22
ERROR `str` is not assignable to attribute `id` with type `Never` [bad-assignment]
- --> dify_graph/nodes/base/node.py:414:32
+ --> dify_graph/nodes/base/node.py:413:32
ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
--> dify_graph/nodes/document_extractor/node.py:446:19
ERROR `+` is not supported between `list[Unknown]` and `str` [unsupported-operation]
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-12 09:13:38.146402071 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-12 09:13:28.061382214 +0000
@@ -484,7 +484,7 @@
ERROR Object of class `GraphExecutionProtocol` has no attribute `node_executions` [missing-attribute]
--> dify_graph/nodes/base/node.py:331:31
ERROR `str` is not assignable to attribute `id` with type `Never` [bad-assignment]
- --> dify_graph/nodes/base/node.py:414:32
+ --> dify_graph/nodes/base/node.py:413:32
ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
--> dify_graph/nodes/document_extractor/node.py:446:19
ERROR `+` is not supported between `list[Unknown]` and `str` [unsupported-operation]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-12 09:17:24.566171518 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-12 09:17:15.337101135 +0000
@@ -484,7 +484,7 @@
ERROR Object of class `GraphExecutionProtocol` has no attribute `node_executions` [missing-attribute]
--> dify_graph/nodes/base/node.py:331:31
ERROR `str` is not assignable to attribute `id` with type `Never` [bad-assignment]
- --> dify_graph/nodes/base/node.py:414:32
+ --> dify_graph/nodes/base/node.py:413:32
ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
--> dify_graph/nodes/document_extractor/node.py:446:19
ERROR `+` is not supported between `list[Unknown]` and `str` [unsupported-operation]
|
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-12 13:58:25.675503164 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-12 13:58:16.763482684 +0000
@@ -484,7 +484,7 @@
ERROR Object of class `GraphExecutionProtocol` has no attribute `node_executions` [missing-attribute]
--> dify_graph/nodes/base/node.py:331:31
ERROR `str` is not assignable to attribute `id` with type `Never` [bad-assignment]
- --> dify_graph/nodes/base/node.py:414:32
+ --> dify_graph/nodes/base/node.py:413:32
ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
--> dify_graph/nodes/document_extractor/node.py:446:19
ERROR `+` is not supported between `list[Unknown]` and `str` [unsupported-operation]
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Important
Fixes #<issue number>.Summary
fix #33335
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods