feat(core): Add PromptSuspend for prompt pause/resume at tool call boundaries#174
Conversation
…ptions Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/572e69b6-be85-4ee7-a3e5-9c179468a7f4 Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
ClickerMonkey
left a comment
There was a problem hiding this comment.
Lets make sure the non suspended tool calls that came back with valid responses still get their tool call results added to the request messages. Anything that came in before suspend breaks the loop and returns needs to be on the request messages - we don't want to drop anything from the response just because of tool suspension.
packages/core/src/prompt.ts
Outdated
| // alongside the tool result messages. | ||
| // Returns undefined (not TOutput) — the prompt has not produced a final result yet. | ||
| if (suspended) { | ||
| yield emit({ type: 'suspend', messages: request.messages, request }); |
There was a problem hiding this comment.
Let's just emit request, doing messages is duplicitous
There was a problem hiding this comment.
Done in fb238b8 — the suspend event now only carries request. Use event.request.messages to access the saved state.
…es from suspend event Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/05b72ef8-96ec-4c3f-8866-9a77784d8189 Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Fixed in fb238b8. When any tool suspends, the loop now iterates all executors before breaking: completed/errored tools have their results added to |
Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/cc5a0ce5-7c4f-4bce-bdb6-648d5c6281e2 Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ClickerMonkey/aeye/sessions/cc5a0ce5-7c4f-4bce-bdb6-648d5c6281e2 Co-authored-by: ClickerMonkey <421233+ClickerMonkey@users.noreply.github.com>
toolCallId?: stringtoContexttype inpackages/core/src/types.tstoolCallIdfromtoolCall.idinto context beforetool.run()inpackages/core/src/prompt.tsanySuspendedloop into the single tool-result loop below it