Repository navigation
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9496 +/- ##
============================================
- Coverage 91.68% 91.67% -0.02%
Complexity 5125 5125
============================================
Files 1305 1306 +1
Lines 58211 58124 -87
Branches 7594 7588 -6
============================================
- Hits 53371 53284 -87
Misses 2933 2933
Partials 1907 1907
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
576416c to
7fd7ae0
Compare
| */ | ||
| export function usableOperatorTypes(metadataStore: WorkflowSystemMetadata, allowed: string[]): string[] { | ||
| const known = Object.keys(metadataStore.getAllOperatorTypes()); | ||
| return allowed.length === 0 ? known : allowed.filter(type => known.includes(type)); |
There was a problem hiding this comment.
DEFAULT_AGENT_SETTINGS.allowedOperatorTypes in types/agent.ts still has the initial operators list, do you think all operator types would be exposed here?
There was a problem hiding this comment.
Yes. Users no longer choose which operator types an agent can use: the list of allowed types is removed, with its default, its setting and its toggle in the chat panel. The agent lists the types with list_operator_types and reads their properties with get_operator_schema. The PR is based on #9494, since the tools' results have to stay whole in the conversation.
|
|
||
| private createTools(): Record<string, any> { | ||
| // One list of operator types: what the prompt names and the lookup describes is what can be added. | ||
| const usableTypes = usableOperatorTypes(this.metadataStore, this.settings.allowedOperatorTypes); |
There was a problem hiding this comment.
Related to my other comment, With the default 18 type allowlist it should be more restrictive now? Can we also add test cases (a) to ensure an agent created with default settings can look up and add an operator that isn’t in the current 18-type default. This pins down the “all operators by default” behavior once the default changes. (b) a size check on the system prompt with every type listed, so the token savings can’t quietly regress. (c) An agent with an allowlist refuses addOperator for a type outside it (and accepts one inside). Right now only the lookup tool’s refusal is tested.
There was a problem hiding this comment.
All three are in, adjusted to there being no list any more:
- (a)
an agent with default settings lists the types, then looks up and adds any of themaddsSplit, which was outside the 18. - (b)
stays within its budget, so no list of types or schemas grows back into itholds the system prompt under 10 KB. It is 8.3 KB and takes no input, so it cannot grow with the types. - (c) With no list left to refuse by,
the lookup and the add tool refuse a type that does not existcovers the refusal, and (a) covers a type being accepted.
Ma77Ball
left a comment
There was a problem hiding this comment.
Review summary
This PR swaps the per-type schema dump in the system prompt for a one-line-per-type list plus a get_operator_schema lookup. It also makes the prompt, the lookup and addOperator share one list from usableOperatorTypes. The design is sound: the prompt stays small and stable even with all operator types allowed, which unblocks widening the default allowlist. addOperator now rejects types outside the allowed list, the prompt no longer points at a nonexistent getOperatorSchema, and the tools are rebuilt on every settings change, so the three cannot drift apart. The one gap is that the lookup tool can be disabled while the prompt still requires it. Clean, no blocking issues.
Action items: Nothing blocking; the P2 below is worth fixing before or soon after merge.
Findings
1 total: 0 P0, 0 P1, 1 P2, 0 P3.
Non-blocking (P2)
- Keep the prompt's lookup instruction in sync with
disabledTools-agent-service/src/agent/prompts.ts:255- see inline.
Verification
- Checked that
createTools()runs again insideupdateSettings(texera-agent.ts:407), so changingallowedOperatorTypesupdates the prompt, the lookup andaddOperatortogether. - Checked the unknown-type paths: the lookup throws, and the existing
tool-errorhandling (texera-agent.ts:609-618) records the throw as a failed tool result.addOperatorreturns an error that lists the usable types. - The new tests cover the shared list end to end (
texera-agent.spec.ts:738) and the lookup's output shape. I did not run the test suite.
| ## Operators | ||
|
|
||
| You have the following operators available: | ||
| These are the operator types you can use. Before you add operators of types you have not used yet, read their properties with \`get_operator_schema\`, once for all of them. |
There was a problem hiding this comment.
The system in this design always calls get_operator_schema before adding operators, but the tool can be switched off through settings.disabledTools. getEnabledTools() (texera-agent.ts:251) drops it while rebuildSystemPrompt() ignores disabledTools. If a client sets it through the settings API (disabledTools on create or PATCH /:id/settings, server.ts:244), the model is told to call a tool it does not have. Since this PR removed the schemas from the prompt, it then has no way to see an operator's properties, and it either calls the missing tool or guesses at addOperator properties until validation fails.
Suggested fix (manual, two spots): either leave TOOL_NAME_GET_OPERATOR_SCHEMA out of the set of tools that can be disabled, or pass whether it is enabled into buildSystemPrompt. In the second case, fall back to the old inline compact schemas when it is off, and call rebuildSystemPrompt() when disabledTools changes. The first is simpler, since without the lookup the agent cannot build valid operators.
There was a problem hiding this comment.
Thanks, fixed. The PR has two operator tools, list_operator_types and get_operator_schema, and disabledTools cannot switch either off (isToolEnabled in texera-agent.ts; the test is the two operator tools cannot be switched off). I also ran the case you describe with Claude Haiku 5.5: with the lookup off the request still finished, but 4 of 9 adds failed first and were retried from the schema in addOperator's error.
7fd7ae0 to
e71a251
Compare
e71a251 to
0c069f5
Compare
Before every model call, the agent dropped the SDK's messages and wrote one user message: a summary of the conversation followed by the current dataflow. A past tool call appeared as its name, its summary and the first line of its result. Each step now keeps the model messages it added: the user's message, or the assistant message with its tool calls and the tool results. The model reads these along the path to HEAD, so a branch HEAD has left stays out of sight. The current dataflow is one message at the end of every step's input, written again each time and never kept. The loop runs as the SDK's ToolLoopAgent, and the system prompt describes only the dataflow block. A tool call the SDK did not run, because its response was cut off, is kept with a failed result: the SDK refuses a conversation in which a call has no result, so every later turn would fail.
After addOperator or modifyOperator the service executed the operator itself, outside the tool call, and the result reached the model only through the dataflow block. That block is not kept, so on a later turn the agent found numbers in its own answers that no tool result showed, and told the user they were unverified. The two tools now execute the operator they changed and return the execution's result after their own line. A failed or stopped execution follows the change and does not turn it into a failure. The result is still filed under the step that made the change.
Every model call ended with a dataflow block that the service rebuilt for that call, so the last message changed on every call. A prompt cache point on the last message, which LiteLLM's automatic caching places, was never read back, and only the tool definitions and system prompt were reused. The block is gone: the model reads the SDK's own messages, so every call begins with the previous call's input. It reads the workflow with two new tools. getWorkflow lists each operator with its properties, schemas, compilation error and whether its result is there, outdated or failed, then the links. getOperatorResult returns an operator's latest result without executing anything, or says that it is outdated. Each result now records what it was computed from, so a change to the operator or to one it reads from makes the result outdated. disabledTools cannot switch the two tools off. The result formatter that only fed the block is removed.
getWorkflow and getOperatorResult become get_workflow and get_operator_result. New tools are named in snake_case; the four existing ones keep their names.
Users had to choose which operator types an agent could use: the agent only knew a list of allowed types, 18 by default, and any other type had to be switched on by hand in the chat panel. The list is removed. `list_operator_types` names every operator type and what it does, and `get_operator_schema` gives the properties of the types the agent picks, several in one call, so the system prompt describes no operator type. The `allowedOperatorTypes` setting, the `/:id/operator-types` route and the Operators tab of the chat panel's settings dialog are gone, and `disabledTools` cannot switch the two tools off.
0c069f5 to
620f257
Compare
Ma77Ball
left a comment
There was a problem hiding this comment.
Overall there are no blocking issues and it LGTM!
What changes were proposed in this PR?
Users had to choose which operator types an agent could use. The agent only knew a list of allowed types, 18 by default, and any other type had to be switched on by hand in the chat panel. This PR removes that list: the agent finds operator types itself with two tools and decides which to use.
list_operator_types: every type and what it doesget_operator_schema, for several types in one callThe
allowedOperatorTypessetting and the Operators tab of the agent's settings dialog are removed, anddisabledToolscannot switch the two tools off. The PR is based on #9494, which keeps each tool's result whole in the conversation. This is the first part of #9481;edit_workflowandexecute_workflowfollow.Any related issues, documentation, discussions?
Based on #9494; isolated diff: bobbai00/texera@feat/agent-native-messages...feat/agent-operator-lookup
Part of #9481
Part of #9453
How was this PR tested?
bun test(379 pass),bun run typecheckandbun run format:checkinagent-service; the test suite (7,411 pass), ESLint and Prettier infrontend.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5, Claude Fable 5.2