Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Sidecars, Daemons, and Schedulers in AI Coding Agents

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Modern AI coding agents (such as Google Antigravity / Jetski and Anthropic Claude Code) have transitioned from simple conversational REPLs into autonomous engineering systems capable of executing recurring maintenance tasks, reacting to real-time events, and operating in headless background environments.

Accomplishing these workflows requires understanding three distinct execution models:

  1. Scheduled Cron Tasks (ephemeral batch executions)

  2. Continuous Background Daemons (long-running sidecar processes)

  3. Headless System-Level Schedulers (Linux cron / systemd timers)

This article breaks down their architectural underpinnings, examines the Go-based Sidecar implementation in Antigravity, contrasts Anthropic’s cloud and desktop execution models, and provides practical guidance on orchestrating autonomous agents reliably.


1. Scheduled Cron Tasks vs. Continuous Background Processes

When designing automated workflows for AI agents, developers frequently conflate continuous background processes with scheduled tasks. While both operate without interactive human intervention, their lifecycle models and resource profiles differ fundamentally.

Ephemeral Scheduled Batch Jobs (builtin: schedule)

Scheduled tasks are discrete, time-triggered batch jobs:

Continuous Background Processes (Long-Running Daemons)

Continuous background processes are persistent services running indefinitely:

The Supervisor Paradox: Why schedule Sidecars Use restart_policy: always

In supervisor-based architectures (such as Antigravity’s sidecar.json), a scheduled cron task is configured with:

{
  "builtin": "schedule",
  "restart_policy": "always"
}

At first glance, setting "restart_policy": "always" on a scheduled job appears contradictory. However, this separates the supervisor daemon from the agent worker:

  1. The Sidecar Supervisor is a continuous background daemon that must stay alive 24/7 to monitor the clock, parse cron expressions, and survive host sleep/wake cycles. If this supervisor crashes, it must be restarted immediately (restart_policy: always).

  2. The Agent Worker dispatched by the supervisor is an ephemeral process spawned via IPC/API when the cron trigger fires, completing its prompt turn and exiting.


2. Antigravity / Jetski Sidecar Architecture

Google Antigravity (and its internal Jetski engine) features a modular sidecar architecture designed for headless task automation.

Go-Based SidecarManager Backend

The SidecarManager is implemented in Go in the backend (google3/third_party/jetski/cortex/sidecars) and compiled directly into the unified agy / jetski binary.

+-------------------------------------------------------------+
|                      agy / jetski Host                      |
|                                                             |
|  +--------------------+             +--------------------+  |
|  |   SidecarManager   |             |   Language Server  |  |
|  |     (Go Engine)    |             | (tryPostAuthInit)  |  |
|  +---------+----------+             +---------+----------+  |
|            |                                  |             |
|            | spawns / monitors                | gates       |
|            v                                  v             |
|  +--------------------+             +--------------------+  |
|  | Sidecar Supervisor |             | Authenticated User |  |
|  | (builtin:schedule) |             |      Session       |  |
|  +---------+----------+             +--------------------+  |
|            |                                                |
|            | cron trigger                                   |
|            v                                                |
|  +-------------------------------------------------------+  |
|  | agentapi new-conversation / send-message              |  |
|  | -> Invokes Ephemeral Antigravity Agent Session        |  |
|  +-------------------------------------------------------+  |
+-------------------------------------------------------------+

Configuration Hierarchy

Automated sidecars in Antigravity are configured across three locations:

  1. Sidecar Definition (~/.gemini/config/sidecars/<id>/sidecar.json): Defines the task metadata, schedule arguments, and execution target.

    {
      "display_name": "Verizon Bill Analyzer",
      "description": "Runs daily at 8:00 AM to check Bank of America Zelle payment alerts, re-notify unsettled owners after 7 days, or process any new monthly Verizon statement PDF.",
      "builtin": "schedule",
      "args": [
        "0 8 * * *",
        "agentapi",
        "new-conversation",
        "/verizon-bill-analyzer Run the daily automated workflow in /var/home/dclong/archives/verizon: if the latest month in bill.yaml has any owner with payment.settled: false, run Step 7 (check_payments.py) to check Zelle payments, and re-notify any owner unsettled for >= 7 days via Step 6; otherwise, if all owners are settled and a newer monthly statement PDF exists, process the new statement in prod mode."
      ],
      "restart_policy": "always"
    }
  2. Project Linkage (~/.gemini/config/config.json): Enables the sidecar and binds it to a target project ID:

    {
      "sidecars": {
        "verizon-bill-analyzer": {
          "enabled": true,
          "projectId": "verizon",
          "schemaVersion": 1
        }
      }
    }
  3. Project Registry (~/.gemini/config/projects/<id>.json or ~/.gemini/projects.json): Maps the projectId to the filesystem path and workspace resources:

    {
      "id": "verizon",
      "name": "Verizon (/var/home/dclong/archives/verizon)",
      "projectResources": {
        "resources": [
          {
            "folderUri": "file:///var/home/dclong/archives/verizon"
          }
        ]
      }
    }

The agentapi Dispatch Protocol

When a cron expression triggers, the supervisor invokes the agentapi CLI tool:

Lifecycle & Prerequisites

For automated sidecars to operate:


3. Comparison with Claude Code Automation

Anthropic approaches background automation and scheduling with a different architecture, distributing capabilities across cloud infrastructure, local desktop instances, and interactive sessions.

Claude Cloud Scheduled Tasks (Routines)

Claude Code supports scheduled tasks executed directly on Anthropic’s managed cloud infrastructure:

Claude Desktop Local Tasks

For workflows requiring local hardware, proprietary network access, or private filesystem manipulation:

Interactive Session-Level Polling (/loop)

For short-term background monitoring inside an active terminal session, Claude Code provides the /loop command:

# Poll CI status every 5 minutes until finished
/loop 5m check if GitHub Actions CI checks have completed on current PR

Event-Driven vs. Scheduled Tasks: Demystifying @claude

A frequent point of confusion is how GitHub PR and issue triggers relate to scheduled tasks:


4. Linux System Cron / Systemd vs. Native Agent Schedulers

When deploying autonomous agents on Linux workstations or servers, developers can choose between Native Agent Schedulers (Sidecars or Claude Cloud Routines) and Operating System-Level Schedulers (cron or systemd timers).

Feature Comparison

Agent Automation Architecture Comparison

Architecture

Execution Host

Uptime Requirement

Resumption & Transcript

Notification & UI

Antigravity Sidecar

Local Host (agy)

Signed-in CLI / IDE active

SQLite & disk transcripts; interactive resume

Desktop notifications, IDE badges, thinking logs

Claude Cloud Routines

Anthropic Cloud

24/7 cloud (zero local uptime)

Cloud dashboard logs; quota-capped

Email / Claude web notifications

Claude Desktop Tasks

Local Host

Desktop App active

Desktop session storage

Desktop app notifications

System Cron / Systemd

Local / Server OS

OS running (headless, survives reboots)

Full disk transcripts; CLI --resume

System logs (journalctl), mail, or webhook

Advantages of Native Schedulers

  1. Rich Interactive History: Native schedulers preserve structured reasoning steps, tool invocation outputs, and diff previews in the agent’s native visual interface.

  2. Seamless Human-in-the-Loop Resumption: If an automated task encounters an ambiguous condition (e.g., an unexpected merge conflict or unverified invoice), a human engineer can jump into the conversation and provide guidance without losing prior context.

  3. Turn-by-Turn Thinking Logs: Full visibility into internal chain-of-thought tokens and subagent handoffs.

Advantages of Linux System Cron / Systemd Timers

Executing headless CLI runs via cron or systemd timers (agy --prompt "..." or claude -p "...") provides operational guarantees that GUI apps cannot:

  1. True Headless Independence: Eliminates reliance on whether VS Code, Electron, or a terminal window is currently open.

  2. Reboot Resilience: A systemd timer configured with Persistent=true will trigger missed runs if the machine was offline during the scheduled interval.

  3. Resource Determinism: Guaranteed clean process exit without background memory leaks.

Headless Session Persistence & Resumption

A common misconception is that headless runs (agy --prompt or claude -p) discard conversational history. In reality:


5. Practical Implementation Guidelines

To maximize reliability when deploying autonomous AI coding agents:

  1. Choose Ephemeral Batch Tasks by Default: Unless you explicitly need sub-second reaction to filesystem changes or socket events, implement workflows as ephemeral cron tasks rather than persistent daemons. This prevents memory leaks and ensures clean token context windows.

  2. Always Externalize State: Never rely on agent memory between scheduled executions. Persist state in structured files (state.yaml, SQLite, or Git commits). Each run should follow this lifecycle:

    • Read persistent state

    • Perform atomic checks or updates

    • Write updated state

    • Commit changes or notify stakeholders

  3. Set Hard Execution Timeouts: Headless autonomous agents can get caught in retry loops if a tool command blocks. Always enforce command-level or timer-level timeouts:

    # systemd service unit snippet
    [Service]
    Type=oneshot
    TimeoutStartSec=600
    ExecStart=/usr/local/bin/agy --prompt "Run daily repo lint and test audit"
  4. Combine OS Timers with Native Resumption: For mission-critical production maintenance, the most robust architecture pairs Linux systemd timers with native CLI session resumption. The systemd timer guarantees reliable headless execution, while agy --resume / claude --resume allows human operators to inspect and continue any run that requires manual intervention.


References