googleapis / googleapis/python-genai

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

Đang mở
#1,971 3 bình luận 1 reaction 1 người được giao Được giao cho @kkorpal Xem trên GitHub
api: gemini-api priority: p2 type: bug
Ngôn ngữ chính
Python
Star
4k
Fork
1k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
41

Mô tả

### 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

- **SDK:** python-genai
- **Auth:** Gemini Developer API (API key mode)
- `GOOGLE_API_KEY` set
- **Endpoint:** `https://generativelanguage.googleapis.com/v1beta`
- **Interactions:** background agent interaction
- **Docs reference:**
https://ai.google.dev/gemini-api/docs/interactions#python_2

---

### Minimal Reproduction (Python)

```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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.