Agent Execution Loop
Agent Execution Loop
Sidekick's agent execution loop is the engine that powers autonomous, continuous action on your behalf. Once enabled, it wakes up on a schedule, reviews everything that has happened across your connected services, and takes action — without you needing to be present.
How It Works
Each cycle of the loop runs through four stages:
1. Event Gathering
The agent fetches all UnifiedEvents that have arrived since the last run. A UnifiedEvent is a normalised representation of any activity from any connected service — an incoming Slack message, a new email, a calendar invite, a merged pull request, a smart-home trigger, and so on.
Because every integration produces UnifiedEvents through the same adapter interface, the agent loop doesn't need to know anything specific about individual services.
2. User Context Loading
Before reasoning about what to do, the agent loads your current context:
- Connected integrations and their states
- Your preferences and active goals
- Prior agent state from the last run
- Any explicit instructions you've configured
This context grounds the AI's decision-making, ensuring responses and actions stay consistent with how you've configured Sidekick.
3. Claude Decision-Making
The gathered events and loaded context are handed to Claude. Claude reviews what happened, reasons about what actions — if any — are appropriate, and produces a list of UnifiedActions to execute.
Examples of decisions Claude might make:
- Reply to a low-priority message on your behalf
- Triage and label incoming email
- Decline a calendar conflict according to your rules
- Open a GitHub issue from a flagged log alert
- Trigger a smart-home routine
4. Action Execution
Each UnifiedAction is dispatched through the same unified adapter layer that produced the original events. Actions are executed in the same run cycle, so the turnaround between something happening and Sidekick responding is bounded by your schedule interval.
Scheduling
The execution loop runs on a per-user cron schedule managed by Inngest. Each user's agent is scheduled independently, which means:
- One user's heavy workload does not delay another's run.
- Schedule frequency is configurable — higher-tier plans support more frequent polling.
- All runs are durably tracked; failures are automatically retried by Inngest.
Relationship to the Unified Adapter Architecture
The agent loop is integration-agnostic by design. It operates entirely on UnifiedEvents and UnifiedActions. When you connect a new service, it immediately participates in the loop — the agent can receive events from it and take actions against it without any changes to the core loop logic.
This also means that community skills imported from ClawHub work inside the loop: any skill that produces events or actions uses the same normalised types.
Enabling & Configuring the Loop
- Connect at least one integration from the Sidekick dashboard.
- Navigate to Settings → Agent to review your schedule and configure preferences.
- The loop activates automatically once your account is set up — no additional steps required.
Note: The agent acts on your behalf using the permissions granted by each connected integration. Review the scopes requested during the OAuth flow for each service to understand what actions are possible.
Observability
Every agent run is logged. You can review:
- Which events were gathered in each run
- What context was loaded
- The actions Claude decided to take (and why)
- Whether each action succeeded or failed
Run history is available in the Sidekick dashboard under Activity.