Skip to content

Feature Request: Allow Agent node to use workflow nodes as tools (Knowledge Base, HTTP Request, Code, etc.) #35529

@ForeignKeyCN

Description

@ForeignKeyCN

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

The Agent node currently can only use external tools (plugins, built-in tools, MCP). It cannot use Dify's own workflow nodes — Knowledge Base, HTTP Request, Code, etc. — as tools.

This means if a user wants their agent to decide when to search a knowledge base or when to make an HTTP request (rather than always doing it), they have to publish a separate workflow-as-tool, which is cumbersome and breaks the single-workflow experience.

Users should be able to select any node in the same workflow as an agent tool directly from the agent's settings panel.

2. Additional context or comments

UI: A "Node Tools" dropdown in the agent node settings panel, listing other nodes in the same workflow. The user selects which nodes the agent can call as tools.

Tool description for LLM: Auto-generated from the node's type and configuration, combined with a user-provided description. For example, a Knowledge Base node becomes: "Search the product documentation knowledge base. Use this when the user asks about product features or troubleshooting."

Parameter mapping: Dynamically generated based on how the user configured each node. For example:

Knowledge Base node → tool parameter: query (string)
HTTP Request node → tool parameters based on template variables in URL/body
Code node → tool parameters from user-defined input variables
Execution: When the agent's LLM calls a node-tool, the agent executes that node using the existing create_child_engine() pattern (same mechanism iteration/loop nodes use), gets the result, and returns it to the LLM for continued reasoning.

Supported node types (phased):

Phase Node Types
Phase 1 Knowledge Retrieval, HTTP Request
Phase 2 Code, Template Transform, LLM
Phase 3 Tool (plugin), Document Extractor, Parameter Extractor, Question Classifier

Not supported: Start, End, IF/ELSE, Iteration, Loop (flow control nodes don't make sense as callable tools).

Technical Approach
The agent node already receives tools via AgentToolEntity. This feature would:

Add a "node_tools" field to agent node config — list of node IDs in the same workflow
At runtime, for each selected node, auto-generate an AgentToolEntity from the node's input/output schema
When the agent calls a node-tool, execute it via child engine (like iteration nodes do) and return the output
Combine auto-generated tool description with user's custom description for LLM function-calling

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions