Skip to content

Self-improving AI Employees for everyone

fix(agent_builder): canonical ToolNode shape so the node renders correctly

trohitg72fe5faba9dc
diff --git a/server/nodes/tool/agent_builder.py b/server/nodes/tool/agent_builder.py
index d6eeb57f..d747ce0a 100644
--- a/server/nodes/tool/agent_builder.py
+++ b/server/nodes/tool/agent_builder.py
@@ -39,7 +39,7 @@ from pydantic import BaseModel, ConfigDict, Field
from services import workflow_ops
from services.node_registry import registered_node_classes
-from services.plugin import ActionNode, NodeContext, Operation, TaskQueue
+from services.plugin import NodeContext, Operation, TaskQueue, ToolNode
logger = logging.getLogger(__name__)
@@ -251,7 +251,7 @@ class AgentBuilderOutput(BaseModel):
# ----------------------------------------------------------------------------
-class AgentBuilderNode(ActionNode):
+class AgentBuilderNode(ToolNode):
type = _AGENT_BUILDER_TYPE
display_name = "Agent Builder"
subtitle = "Runtime canvas-mutation tool"
@@ -264,12 +264,14 @@ class AgentBuilderNode(ActionNode):
)
component_kind = "tool"
handles = (
- {"name": "output-main", "kind": "output", "position": "right",
- "label": "Tool", "role": "main"},
+ {"name": "input-main", "kind": "input", "position": "left",
+ "label": "Input", "role": "main"},
+ {"name": "output-tool", "kind": "output", "position": "top",
+ "label": "Tool", "role": "tools"},
)
+ ui_hints = {"isToolPanel": True, "hideRunButton": True}
annotations = {"destructive": False, "readonly": False, "open_world": True}
task_queue = TaskQueue.DEFAULT
- usable_as_tool = True
Params = AgentBuilderParams
Output = AgentBuilderOutput
diff --git a/server/tests/nodes/test_agent_builder.py b/server/tests/nodes/test_agent_builder.py
index 198749ed..d5da61c5 100644
--- a/server/tests/nodes/test_agent_builder.py
+++ b/server/tests/nodes/test_agent_builder.py
@@ -91,15 +91,25 @@ class TestRegistration:
params = ab.AgentBuilderParams()
assert params.operation == "inspect_canvas"
- def test_usable_as_tool(self):
- assert ab.AgentBuilderNode.usable_as_tool is True
-
- def test_handle_topology_is_standard_tool_output(self):
+ def test_is_tool_node(self):
+ """agentBuilder is a tool-only plugin; subclasses ToolNode (not
+ ActionNode + usable_as_tool=True). The ToolNode base IS the
+ contract for nodes that exist solely to be invoked by an LLM
+ through an agent's input-tools handle."""
+ from services.plugin import ToolNode
+ assert issubclass(ab.AgentBuilderNode, ToolNode)
+
+ def test_handle_topology_matches_canonical_tool_shape(self):
+ """Canonical tool node: input-main left + output-tool top role=tools.
+ The output-tool shape is what wires into an agent's input-tools handle."""
handles = list(ab.AgentBuilderNode.handles)
- assert len(handles) == 1
- assert handles[0]["name"] == "output-main"
- assert handles[0]["kind"] == "output"
- assert handles[0]["position"] == "right"
+ assert len(handles) == 2
+ names = {h["name"] for h in handles}
+ assert names == {"input-main", "output-tool"}
+ out = next(h for h in handles if h["name"] == "output-tool")
+ assert out["kind"] == "output"
+ assert out["position"] == "top"
+ assert out["role"] == "tools"
def test_no_provided_tools_dict(self):
"""Sanity check: the tribal PROVIDED_TOOLS attr from the original