Skip to content

Move off auto_functions for finer-grained ctrl-c cancellation #31

@evansenter

Description

@evansenter

Problem

Currently using create_stream_with_auto_functions() which handles tool execution internally. This means we can only check for ctrl-c cancellation between tool batches, not during individual tool execution.

If Gemini requests multiple tools at once, pressing ctrl-c won't take effect until the entire batch completes.

Proposed Solution

Switch to manual function calling:

  1. Get function call requests from the stream
  2. Check cancellation before each individual tool call
  3. Execute tools ourselves with cancellation checks
  4. Send results back and continue

This would allow:

  • Cancellation between individual tool calls (not just batches)
  • Potentially aborting long-running tools mid-execution
  • More control over tool execution flow

Current State

Basic ctrl-c handling is implemented using ctrlc crate + AtomicBool. It works for cancelling between batches, which is acceptable for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions