Repository navigation
feat(cuga-lite): native function-calling execution mode + step discipline #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
segevshlomovIBM
wants to merge
20
commits into
main
Choose a base branch
from
feature/native-function-calling-mode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,645
−46
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c8cad0d
feat(cuga-lite): native function-calling execution mode
segevshlomovIBM cafcca1
feat(cuga-lite): step discipline — one tool call per step, both modes
segevshlomovIBM dd3edea
fix(cuga-lite): function-calling review fixes — valid replay across t…
segevshlomovIBM 948350b
fix(cuga-lite): app catalogue in the FC prompt, real-path fail-closed…
segevshlomovIBM a66aca4
fix(cuga-lite): fail the function-calling approval guard closed on ve…
segevshlomovIBM da9a584
fix(cuga-lite): address haroldship's review — native transcript acros…
segevshlomovIBM b1d13d0
fix(cuga-lite): function-calling correction cap is per turn; fences o…
segevshlomovIBM b91abea
fix(cuga-lite): read WatsonX's reasoning key on the function-calling …
segevshlomovIBM a9ea3ec
fix(cuga-lite): provider-safe tool names for native tool binding
segevshlomovIBM e7a25c6
fix(cuga-lite): map tool aliases back at the decode boundary
segevshlomovIBM e653ea1
refactor(cuga-lite): trim provider-safe tool names to the two seams
segevshlomovIBM 2d86dc8
Merge remote-tracking branch 'origin/main' into fix/segevshlomov-prov…
segevshlomovIBM 9cfae1a
test(cuga-lite): record the feature-off CodeAct snapshot
segevshlomovIBM 1e9678b
feat(cuga-lite): run function-calling tool calls through the sandbox
segevshlomovIBM fd27513
test(cuga-lite): translator, sandbox-reply and equivalence tests for …
segevshlomovIBM dad9b38
docs(cuga-lite): function calling through the sandbox
segevshlomovIBM eb375ac
Merge remote-tracking branch 'origin/fix/segevshlomov-provider-safe-t…
segevshlomovIBM 5a285f1
feat(cuga-lite): aliases, find_tools and provider-error recovery in F…
segevshlomovIBM 5d102ee
fix(cuga-lite): record function-calling outcomes in a node-owned channel
segevshlomovIBM 43c97d8
fix(cuga-lite): CodeRabbit round on the sandbox path
segevshlomovIBM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Function calling through the sandbox | ||
|
|
||
| Status: implemented on the `feature/native-function-calling-mode` branch (PR #777), 2026-10-09. | ||
|
|
||
| ## Decision | ||
|
|
||
| `cuga_lite_execution_mode = "function_calling"` keeps native function calling on the | ||
| model side (tools via `bind_tools`, `tool_calls` in, one `ToolMessage` per call id out) | ||
| and executes the calls through the existing CodeAct sandbox instead of a separate | ||
| `tool_exec` runner. A native turn is translated into a short internal Python block, | ||
| the sandbox runs it, and the block's variables are read back into the replies. | ||
|
|
||
| Why: every CUGA guarantee already lives at the sandbox step — tool approval, the | ||
| pre-execute VERIFY gate, variables, output trimming, the block timeout, budgets, the | ||
| tracker, recovery. A second executor had to re-earn each one; after three review | ||
| rounds of #777 five gaps remained (approval refused to start, no recovery, no | ||
| variables, no observed shapes, no todos). One pipeline closes them at once. | ||
|
|
||
| ## Shape | ||
|
|
||
| - `adapter/fc_actions.py` — `plan_tool_calls` (calls → block + plan) and | ||
| `replies_from_execution` (variables → `ToolMessage`s). Rules that keep the tool side | ||
| identical to a direct call: identifier names are called as themselves (approval and | ||
| VERIFY see the real name), other names go through an injected `_fc_tools` lookup, | ||
| arguments are `**{...}` of JSON values only, one `try` per call, results kept through | ||
| `_fc_keep` so nothing is dropped, non-executable calls answered at planning time. | ||
| - `graph_adapter.execute_call_model_fc` — routes to the sandbox with the block as | ||
| `script` and the plan under `cuga_lite_metadata["fc_pending"]`; runs the CodeAct | ||
| approval check on the block first. | ||
| - `sandbox_node` — when a plan is pending: local executor, listing variables kept, | ||
| replies instead of the "Execution output:" message at every exit (VERIFY revise, | ||
| normal, failure), plan cleared on every exit, reflection skipped. | ||
| - Feature off: no branch above is reachable (gated on a pending plan a CodeAct turn | ||
| never writes); every new parameter defaults to the old behavior. Golden: | ||
| `tests/snapshots/codeact_feature_off.json`. | ||
|
|
||
| ## Deliberate differences from the direct runner | ||
|
|
||
| - Timeout is per block (whole batch), as for CodeAct; finished results are kept. | ||
| - Results persist as variables (`tool_result_<call id>`), visible to later turns and | ||
| in `InvokeResult.variables`. | ||
| - Approval follows CodeAct's check (text match on the block), including its | ||
| fail-open on infrastructure errors; the former refuse-to-start guard is gone. | ||
|
|
||
| ## Also in this round (Vakra readiness) | ||
|
|
||
| - Provider-safe aliases (#882, merged into this branch): the translator resolves an | ||
| alias to the real name before planning, so the block, approval and VERIFY see the | ||
| real tool while the reply keeps the alias the provider knows. 6 of 10 Vakra test | ||
| domains have a tool name over 64 characters. | ||
| - `find_tools` is bound in function-calling mode whenever prepare enabled it, since the | ||
| FC prompt advertises it; its listing is replied, never kept as a variable. | ||
| - The FC model call has the recovery CodeAct has, in native terms: a Groq | ||
| `failed_generation` becomes a real call, a retryable rejection is retried once, a | ||
| second failure ends the turn with a clear error, anything else propagates. | ||
|
|
||
| ## Follow-ups | ||
|
|
||
| 1. A `run_python` tool backed by the same sandbox for data-heavy steps. | ||
| 2. Per-thread dynamic binding: remember the shortlist and discovered tools, query on | ||
| the current task rather than the first message. | ||
| 3. Function-calling wording for VERIFY, reflection and the empty-reply nudge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.