Skip to content

Interactions API: client.interactions.cancel returns 404 "Method not found" #1971

@prasadskarmarkar

Description

@prasadskarmarkar

Summary

client.interactions.cancel(...) consistently returns 404 "Method not found" when using the Gemini Developer API (API key mode).

The same behavior is observed via:

  • Python SDK (python-genai)
  • Direct REST calls as well

Environment


Minimal Reproduction (Python)

"""
Bug reproduction script for Interactions API cancel endpoint.

This script demonstrates that the cancel endpoint returns
404 "Method not found" for background agent interactions.

Usage (Gemini Developer API / API key mode):
    export GOOGLE_API_KEY=YOUR_API_KEY
 


"""
import time
from google import genai

client = genai.Client()

# Create background interaction
print("[CREATE] Creating background interaction...")
interaction = client.interactions.create(
    agent="deep-research-pro-preview-12-2025",
    input="Research quantum computing",
    background=True,
)
print(f"  Interaction ID: {interaction.id}")
print(f"  Status: {interaction.status}")

# Give the interaction some time to run
print("\n[SLEEP] Waiting 10 seconds...")
time.sleep(10)

# Attempt to cancel
print("\n[CANCEL] Attempting to cancel...")
try:
    cancelled = client.interactions.cancel(id=interaction.id)
    print(f"  Cancel SUCCESS! Status: {cancelled.status}")
except Exception as e:
    print(f"  Cancel FAILED: {e}")

# Wait and re-check status
print("\n[SLEEP] Waiting 5 seconds...")
time.sleep(5)

print("\n[GET] Getting status after cancel attempt...")
fetched = client.interactions.get(id=interaction.id)
print(f"  Status: {fetched.status}")

# Cleanup
print("\n[DELETE] Deleting interaction...")
try:
    client.interactions.delete(id=interaction.id)
    print("  Delete SUCCESS!")
except Exception as e:
    print(f"  Delete FAILED: {e}")

# Verify deletion
print("\n[VERIFY] Verifying deletion...")
try:
    client.interactions.get(id=interaction.id)
    print("  Interaction still exists (unexpected)")
except Exception as e:
    print(f"  Interaction deleted (expected): {e}")

print("\n[DONE] Test complete.")

Expected Behavior

  • client.interactions.cancel(id=...) should return the interaction with status cancelled

Actual Behavior

  • Returns 404 - Method not found
  • Status remains in_progress after cancel attempt

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions