Implement real type: tool graph node execution by wiring NodeConfig.tool to ToolAgent._execute_tool #75
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#77 Epic: LLM Agent Runtime Stabilization — reliability, resource enforcement & correctness hardening
cleveragents/cleveractors-core
#81 feat(langgraph): implement real type:tool graph node execution via ToolAgent dispatch
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Metadata
Commit Message:
feat(langgraph): implement real type:tool graph node execution via ToolAgent dispatchBranch:
feature/m1-graph-tool-node-executionBackground
The library supports two distinct tool-calling code paths. Only one of them works.
Path A — LLM-driven tool calling (working): An
agentnode contains anLLMAgentwith tools in itsconfig.toolslist. The LLM decides when to call a tool;LLMAgent._execute_tool_loop()dispatches each call to aToolAgent, which looks up the handler inself.builtin_toolsand calls it with(tool_args, context). This path was fully implemented in issues #59 and #67.Path B — Graph tool nodes (stub): A
type: toolnode in the graph topology represents a deterministic, graph-driven tool invocation — the graph calls the tool, not the LLM. This path hitsNode._execute_tool(), which is a non-functional stub:Two blockers prevent Path B from working.
Blocker 1 —
_execute_tool()takes nostateargument and performs no dispatch. Every other node handler (_execute_agent,_execute_conditional, etc.) receivesGraphState. Without it, the method cannot read the previous node's output to pass as tool input. There is no registry lookup and no handler call — a fabricated string is returned unconditionally for every tool name, including non-existent ones. Atype: toolgraph node withtool: cleverthis/json-transformtoday silently returns"Executed cleverthis/json-transform"with no actual execution.Blocker 2 — Two YAML parsing gaps. First, the spec uses a singular
tool:key inside atype: toolgraph node (e.g.tool: cleverthis/json-transform).runtime_dispatch._execute_graph()readsnode_def.get("tools", [])(plural), so the tool name never reachesNodeConfig.NodeConfigitself only hastools: List[str]; there is notool: str | Nonefield for the single-tool case. Second, the static configuration block under a tool node (e.g.config: {expression: "$.x", language: jsonpath}) is not captured anywhere.runtime_dispatchstoresnode_def.get("metadata", {})but not theconfig:sub-key, so there is currently no way for_execute_tool()to know the static arguments the YAML author declared.These gaps mean Path B is entirely inert today. The spec's Minimal Actor Subset table marks
type: toolgraph nodes as a supported MVP feature, so this is a spec/implementation gap.Proposed Solution
Path B should be wired to the same
ToolAgent._execute_tool(tool_name, tool_args, context)kernel that Path A already uses. That method already handlesbuiltin_toolsdispatch (the hookPlatformAwareToolAgentincleveragents-webappuses to register platform handlers) and the Python-sandbox path for inline tools. No new handler registry is needed inPureLangGraph.A — Add
tool: str | Noneandstatic_config: dicttoNodeConfigB — Fix
runtime_dispatch._execute_graph()to parsetool:andconfig:The same fix must be applied to the second
_execute_graphcall site at line ~1139.C — Auto-create a
ToolAgentfor eachtype: toolnode in_execute_graphAfter the existing agent-creation loop, add a pass for tool nodes:
This reuses the existing
ToolAgentclass directly. Once issue #73 (tool_agent_classparameter) is resolved,ToolAgent(...)becomestool_agent_class(...), which is the clean upgrade path — but #73 is not a blocking dependency: the existingPlatformAwareToolAgentmonkey-patch incleveragents-webappalready patches theToolAgentreference incleveractors.langgraph.nodes, so the auto-created instance inheritsPlatformAwareToolAgent'sbuiltin_toolsregistration.D — Add
ToolAgent.invoke()as a clean programmatic entry pointprocess_message()is designed for LLM-driven calling and parses a string message to extract tool name and args. For graph-driven calling we already know both — a direct programmatic entry point avoids the parsing overhead and avoids coupling graph-node dispatch to message-format conventions:E — Implement real
_execute_tool(self, state: GraphState)F — Update
Node.execute()dispatcherRelationship to Issue #73
Issue #73 (
tool_agent_classparameter forAgentFactoryandcreate_executor) is complementary but not blocking. After #73 lands, theToolAgent(...)call in step C above becomestool_agent_class(...), eliminating the need for thecleveragents-webappmonkey-patch entirely. This issue can ship before or after #73 without conflict; the two changes compose cleanly.Acceptance Criteria
NodeConfighastool: str | Noneandstatic_config: dict[str, Any]fields.runtime_dispatch._execute_graph()(both call sites) readsnode_def.get("tool")andnode_def.get("config", {})and populates the newNodeConfigfields.ToolAgent(or the activeToolAgentsubclass) is auto-created for eachtype: toolnode with a non-emptytool:field and stored in theagentsdict under the node's ID.ToolAgent.invoke(tool_name, tool_args, context)exists as a public method that calls_execute_tool()directly without message parsing.Node._execute_tool(state)dispatches toagent.invoke()with the previous node's output threaded asinputmerged with the node'sstatic_config.Node._execute_tool(state)returns a structured{"metadata": {"tool_error": ...}}dict (no exception raised) when no agent is found or the tool name is empty.Node.execute()passesstateto_execute_tool(state).type: toolnodes withtools: [...]and notool:field) is identical to the current behaviour — no regression.tool:key parsed from raw node config;config:block stored asstatic_config;ToolAgent.invoke()calls_execute_tool()with correct args;Node._execute_tool(state)threads previous-node output asinput; structured error returned when no agent found.CHANGELOG.mdupdated with one entry for this commit.cleveragents-webappteam notified (comment on this issue) once PR is merged with the release tag or commit SHA.Subtasks
Node.__init__already stores theagentsdict as an instance attribute (check before coding — avoids an unplanned change).tool: str | Noneandstatic_config: dict[str, Any]toNodeConfig; update all construction sites inruntime_dispatchandpure_graph.ToolAgent.invoke()public method.ToolAgentauto-creation pass in_execute_graph()(both call sites).Node._execute_tool(state)with dispatch, input threading, and error path.Node.execute()dispatcher to passstate.CHANGELOG.md.cleveragents-webappteam via issue comment once PR is merged.Definition of Done
type: toolgraph nodes with atool:field dispatch to the named tool handler viaToolAgent.invoke(), with the previous node's output threaded asinputand the node'sconfig:block merged in as static arguments.ToolAgent._execute_tool()kernel (and thereforePlatformAwareToolAgent'sbuiltin_toolsregistration) is exercised by Path B, mirroring Path A.cleveractors-corequality gates pass (noxsuite green, coverage ≥ threshold, Pyright strict clean).master.cleveragents-webappteam notified with the new release tag or commit SHA.