Skip to content

feat: wire up abort_signal for cooperative query cancellation#1

Open
cgycorey wants to merge 1 commit intocodeany-ai:mainfrom
cgycorey:feat/abort-signal
Open

feat: wire up abort_signal for cooperative query cancellation#1
cgycorey wants to merge 1 commit intocodeany-ai:mainfrom
cgycorey:feat/abort-signal

Conversation

@cgycorey
Copy link
Copy Markdown

The abort_signal field existed on QueryEngineConfig, AgentOptions, ToolContext, and with_retry but was never forwarded, read, or checked. This connects the pieces so that setting the signal actually stops the agentic loop, retries, and makes the signal available to tools.

  • Agent.query() now forwards opts.abort_signal to QueryEngineConfig
  • QueryEngine.submit_message() checks abort_signal at the top of each agentic turn and returns early if set
  • _call_api() passes abort_signal to with_retry()
  • with_retry() checks abort_signal before each retry attempt
  • _execute_tools() passes abort_signal to ToolContext
  • Agent.interrupt() sets the event (was a stub: pass)

The abort_signal field existed on QueryEngineConfig, AgentOptions,
ToolContext, and with_retry but was never forwarded, read, or checked.
This connects the pieces so that setting the signal actually stops
the agentic loop, retries, and makes the signal available to tools.

- Agent.query() now forwards opts.abort_signal to QueryEngineConfig
- QueryEngine.submit_message() checks abort_signal at the top of each
  agentic turn and returns early if set
- _call_api() passes abort_signal to with_retry()
- with_retry() checks abort_signal before each retry attempt
- _execute_tools() passes abort_signal to ToolContext
- Agent.interrupt() sets the event (was a stub: pass)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant