Files
cleveractors-core/features/graph_tool_node_execution.feature
CoreRasurae 2072bc3ad1
CI / lint (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 58s
CI / security (pull_request) Successful in 55s
CI / quality (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 3m14s
CI / integration_tests (pull_request) Successful in 1m13s
CI / build (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 3m16s
CI / status-check (pull_request) Successful in 3s
CI / lint (push) Successful in 38s
CI / typecheck (push) Successful in 53s
CI / security (push) Successful in 52s
CI / quality (push) Successful in 36s
CI / unit_tests (push) Successful in 3m12s
CI / integration_tests (push) Successful in 1m9s
CI / build (push) Successful in 37s
CI / coverage (push) Successful in 3m12s
CI / status-check (push) Successful in 4s
feat(langgraph): implement real type:tool graph node execution via ToolAgent dispatch
Wires NodeConfig.tool and NodeConfig.static_config through to
ToolAgent.invoke() so type: tool graph nodes execute real tool
calls instead of returning no-ops.

- NodeConfig: adds tool (str | None) and static_config (dict)
- Node._execute_tool: creates ToolAgent, invokes with static config
  merged with threaded previous output, returns ToolMessage
- runtime_dispatch: auto-creates ToolAgent for type: tool nodes
  without pre-registered agents
- pure_graph: parses tool:/config: YAML keys into NodeConfig
- BDD: 11 scenarios, 33 steps, all passing

Closes #75
2026-07-09 14:06:59 +00:00

60 lines
3.1 KiB
Gherkin

Feature: Graph Tool Node Execution (Issue #75)
As a developer
I want `type: tool` graph nodes to dispatch to ToolAgent via the `tool:` YAML key
So that graph-driven tool invocation actually calls real tool handlers
Scenario: NodeConfig accepts tool and static_config fields
Given a fresh graph tool node test context (gTN)
When I create a NodeConfig with tool and static_config fields (gTN)
Then the NodeConfig should have tool set and static_config preserved (gTN)
Scenario: tool: key parsed from raw node config in runtime_dispatch
Given a fresh graph tool node test context (gTN)
When I parse a node definition with a tool: key through execute_graph (gTN)
Then the resulting NodeConfig should have tool set and static_config populated (gTN)
Scenario: ToolAgent.invoke() calls _execute_tool with correct args
Given a fresh graph tool node test context (gTN)
When I call ToolAgent.invoke() with a known tool name (gTN)
Then the tool should execute and return the expected result (gTN)
Scenario: Node._execute_tool threads previous-node output as input
Given a fresh graph tool node test context (gTN)
When I execute a tool node with state containing previous messages (gTN)
Then the tool should receive the previous output threaded as input (gTN)
Scenario: Node._execute_tool merges static_config with dynamic input
Given a fresh graph tool node test context (gTN)
When I execute a tool node with static_config and previous output (gTN)
Then the tool args should contain both static config and threaded input (gTN)
Scenario: Node._execute_tool returns structured error when no agent found
Given a fresh graph tool node test context (gTN)
When I execute a tool node with no matching agent (gTN)
Then it should return metadata with tool_error (gTN)
Scenario: Node._execute_tool returns empty dict when tool is None
Given a fresh graph tool node test context (gTN)
When I execute a tool node without a tool: field (gTN)
Then it should return an empty dict (gTN)
Scenario: Node.execute dispatcher passes state to _execute_tool
Given a fresh graph tool node test context (gTN)
When I exercise execute() with type TOOL and state (gTN)
Then the result should include the tool execution response (gTN)
Scenario: Default behaviour preserved for type:tool nodes with tools: list and no tool: field
Given a fresh graph tool node test context (gTN)
When I execute a tool node with tools: list but no tool: field (gTN)
Then it should return metadata with tool_results (backward compatible) (gTN)
Scenario: Auto-created ToolAgent handles tool dispatch via invoke
Given a fresh graph tool node test context (gTN)
When I exercise a complete tool node pipeline with auto-created agent (gTN)
Then the tool should execute and return correct result (gTN)
Scenario: static_config blocks are preserved for tool nodes in YAML nodes processing
Given a fresh graph tool node test context (gTN)
When I create NodeConfig via create_pure_langgraph with config block (gTN)
Then the static_config should match the original config block (gTN)