GitHub user Ma77Ball added a comment to the discussion: Texera Agent: issues to 
prioritize for the release 1.4

I checked the items against the agent-service code on `main` (7f9bdf3). The 
list is accurate, and two of the items already have open PRs. Notes by item:

**2. Other users' agents / lost on restart**
- Confirmed. Agents live in a process-local `Map` 
(`agent-service/src/server.ts:46`), so a restart drops them. `GET /` returns 
every entry with no user filter (`server.ts:171`).
- The creator's uid is already known when an agent is created (`server.ts:100`, 
`delegateConfig.userInfo.uid`), so filtering the list by uid is a small change.
- Worth adding to the scope: `GET /:id`, `/:id/stop`, `DELETE /:id` and the 
`/:id/react` websocket look agents up by id alone. Once the list is filtered, 
someone who knows another user's agent id can still read, stop or delete that 
agent. The ownership check should go on those routes as well, not only on the 
list.
- This probably explains part of item 1: the locked tabs are other users' 
agents, so fixing item 2 makes some of item 1 go away.

**3. Loops, Stop, cost**
- Deleting an agent does not stop its run. `DELETE /:id` calls 
`agent.destroy()` (`server.ts:269`), and `destroy()` (`texera-agent.ts:853`) 
never aborts the in-flight `generateText`; only `stop()` does 
(`texera-agent.ts:763`). A running agent keeps calling the model after it is 
deleted. The fix is to call `stop()` inside `destroy()`. Closing the tab 
probably needs the same treatment when the last websocket client disconnects.
- The only limit is `stopWhen: stepCountIs(maxSteps)`, with a default 
`maxSteps` of 100 (`types/agent.ts:88`). That is high for one prompt, and there 
is no wall-clock or token/cost limit. A lower default (around 20 to 30), plus a 
per-request time limit and a token budget, would cover the "sensible limit" 
goal. Hitting any of them should emit a status event to the user rather than 
ending silently.
- The cache problem comes from `prepareStep`, which rebuilds the whole context 
every step (`texera-agent.ts:548`), so the prompt prefix changes on every call. 
#9494 already fixes this: it keeps the SDK's own message history and puts the 
dataflow in one message at the end. It would be good to get it reviewed and 
merged for this release.
- After every successful add/modify the agent automatically runs the operator 
(`EXECUTE_AFTER_TOOLS`, around `texera-agent.ts:645`). Skipping this when the 
operator's properties and upstream operators are unchanged, or making it 
opt-in, would remove much of the repeated execution cost.

**4. Limited operators**
- This is already in progress in #9496 (part of #9481). Simply widening the 
default allowlist (`types/agent.ts:89`) would push the system prompt from about 
19 KB to about 189 KB on every call. #9496 avoids that by listing each operator 
in one line and adding a `get_operator_schema` tool. It also makes 
`addOperator` respect the allowed list, which it currently ignores. Once it 
lands, the default list can be widened safely.

**5. Models without restart**
- Agreed it is optional. A cheap part worth doing even if the rest slips: 
validate the chosen model against the gateway's `/api/models` when an agent is 
created, so a bad model fails right away instead of mid-conversation.

**Suggested order for the 10 days:** get #9494 and #9496 reviewed and merged 
first, since the other agent-service changes will conflict with them. Then the 
item 2 list filter and route ownership checks, the item 3 Stop/delete fix and 
limits, and the item 1 UX. Item 5 last.

I didn't verify the item 1 model-card click bug in the frontend; it may be 
worth a separate issue with repro steps.


GitHub link: 
https://github.com/apache/texera/discussions/9568#discussioncomment-19783486

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to