Antigravity Has No Task Queue: Meet @trigger, Its Real Async Primitive
When engineers inspect the Google Antigravity Python SDK (pinned to google-antigravity==0.1.6), one early question comes up repeatedly: where is the task queue? The omission is intentional. Rather than shipping a rigid broker abstraction, Antigravity builds on native Python asyncio and exposes a compact triggers module as its async primitive.
Why Omit a Built-In Task Queue
A generic task queue hardcodes assumptions around retries, dead-letter policies, concurrency bounds, and cancellation semantics. In multi-agent workflows calling the Gemini API and Vertex AI, those policies vary sharply between interactive background jobs, webhook responders, and periodic maintenance runs.
Composing Coordination Patterns with @trigger
- Bounded Worker Queues: Pair an
asyncio.Queue(maxsize=...)with anasyncio.Semaphoreinside a@triggerhandler to cap simultaneous model invocations and protect rate limits. - Cron-Style Schedules: Drive recurring sweeps through an async loop that respects graceful cancellation signals instead of spawning orphaned background threads.
- Webhook Listeners: Bridge inbound HTTP payloads directly into typed trigger events while preserving backpressure when downstream tool execution slows down.
Lifecycle and Operational Edge Cases
Background agents fail silently when unhandled exceptions detach from the event loop or when shutdown handlers drop in-flight state. Always retain task references, attach explicit error callbacks, and drain pending triggers before process termination.
Original Publication
Read the full code walkthrough and benchmark notes on Medium.
