Skip to content

support tool nodes#52

Merged
pld merged 8 commits into
mainfrom
tool-calls
May 31, 2026
Merged

support tool nodes#52
pld merged 8 commits into
mainfrom
tool-calls

Conversation

@pld

@pld pld commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Adds first-class support for Retell's function (tool-call) nodes and branch (logic-router alias) nodes, then centralizes transition evaluation across every node type. Tool execution itself stays out of scope and is tracked at #51.

Summary

  • New NodeType.FUNCTION with importer (function → FUNCTION), exporter (FUNCTION → function), engine handler (warning + delegate, no HTTP call), and is_function_node() helper.
  • branch aliased to NodeType.LOGIC in the Retell importer. Previously fell through to NodeType.CONVERSATION silently — a real correctness bug on newer Retell CF exports.
  • Centralized _evaluate_transitions dispatcher in voicetest/engine/conversation.py. Every node type (logic / extract / function / conversation) routes through one method that dispatches per condition.type:
    • equation → deterministic via evaluate_equation
    • llm_prompt → fires when caller-supplied llm_decision.transition_to matches the target
    • tool_call → skipped with a per-transition warning (until Tool execution for function nodes (Retell CF function, etc.) #51)
    • always → fallback (conversation nodes opt out — always edges still fire post-response)
  • Conversation-node equation transitions are now evaluated deterministically instead of LLM-reasoned-as-text. The objectives_complete gate still applies to all transition types.
  • Broad comment cleanup. Stripped WHAT-explaining comments and multi-paragraph docstrings across 91 files (~1800 net lines removed). WHY comments preserved (DuckDB rationale, retry/idempotency contract, Retell field quirks, etc.). New "Add no comments by default" section in docs/development.md.
  • DRY fix in AgentService: load_graph and get_graph_with_etag shared a "linked-file vs DB" pattern — extracted to _load_graph_payload.

Behavior changes worth flagging

  • branch Retell nodes now route as LOGIC. Previously they silently became conversation nodes — anyone relying on that incorrect behavior will see a routing shift. Considered a bug fix, not a regression.
  • Conversation-node equation transitions on extracted variables now fire deterministically. Previously the LLM was asked to "reason about" the equation as text; in practice this was unreliable. Equation conditions on tool_result-style variables still fall through to else_edge (variable absent → equation evaluates False).
  • tool_call-typed transitions (Telnyx/LiveKit handoff shape) are now skipped with a warning instead of being silently dropped on logic/extract nodes or LLM-reasoned on conversation nodes.

Out of scope

Test coverage

  • New TestRetellImporterFunctionNode and TestRetellImporterNodeTypeAliases in tests/unit/importers/test_retell.py.
  • New TestFunctionNodeExport in tests/unit/exporters/test_retell_cf.py, with import → export → re-import round-trip.
  • New TestFunctionNodeHandling and TestCentralizedTransitionDispatch in tests/unit/engine/test_conversation.py. The dispatch tests cover: function-node equation routing on pre-existing variables, tool_call warning + fallthrough, conversation-node equation firing deterministically over LLM pick.
  • New NodeType.FUNCTION round-trip test in tests/unit/models/test_agent.py.
  • New tests/fixtures/retell/sample_config_function_node.json minimal CF fixture.

Stats

13 first-pass files + the centralization + the broad sweep:

  • +664 / −2482 across 91 files (mostly comment removal)
  • 1647 unit tests passing, ruff clean

Issues touched

@pld pld merged commit 46db942 into main May 31, 2026
12 checks passed
@pld pld deleted the tool-calls branch May 31, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant