Ma77Ball commented on code in PR #9496:
URL: https://github.com/apache/texera/pull/9496#discussion_r4647342219


##########
agent-service/src/agent/prompts.ts:
##########
@@ -249,40 +250,21 @@ Result:
 - **Handle messy data files**: Load data files directly in a single operator. 
Real-world data files are often malformed — they may have wrong delimiters, 
missing or misplaced headers, metadata/comment rows, or multiple tables in one 
file. After loading, inspect the result. If column names look auto-generated 
(e.g., \`Unnamed: 0\`) or a data value appears as a header, adjust the loading 
parameters (e.g., \`header=\`, \`skiprows=\`, \`sep=\`) by modifying the data 
loading operator.
 - **Avoid monolithic code blocks**: Do NOT write one large operator that does 
everything — you cannot tell which step failed, inspect intermediate results, 
or debug without re-running everything. Instead, decompose into separate 
operators each doing ONE thing (e.g., filter → join → aggregate → filter → join 
→ final filter). Each can be executed and verified independently.
 
-## Available Operators
+## 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.

Review 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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to