Hosted agents

From kursku/skills · View interactive version

Hosted agents is an AI agent skill from the GitHub repository kursku/skills. This skill should be used when the user asks to "build background agent", "create hosted coding agent", "set up sandboxed execution", "implement multiplayer agent", or mentions background agents, sandboxed VMs, agent infrastructure, Modal sandboxes, self-spawning agents, or remote coding environment

How to use this skill

Skill file

Hosted Agent Infrastructure

Hosted agents run in remote sandboxed environments rather than on local machines. When designed well, they provide unlimited concurrency, consistent execution environments, and multiplayer collaboration. The critical insight is that session speed should be limited only by model provider time-to-first-token, with all infrastructure setup completed before the user starts their session.

When to Activate

Activate this skill when:

Core Concepts

Hosted agents address the fundamental limitation of local agent execution: resource contention, environment inconsistency, and single-user constraints. By moving agent execution to remote sandboxed environments, teams gain unlimited concurrency, reproducible environments, and collaborative workflows.

The architecture consists of three layers: sandbox infrastructure for isolated execution, API layer for state management and client coordination, and client interfaces for user interaction across platforms. Each layer has specific design requirements that enable the system to scale.

Detailed Topics

Sandbox Infrastructure

The Core Challenge

Spinning up full development environments quickly is the primary technical challenge. Users expect near-instant session starts, but development environments require cloning repositories, installing dependencies, and running build steps.

Image Registry Pattern

Pre-build environment images on a regular cadence (every 30 minutes works well). Each image contains:

When starting a session, spin up a sandbox from the most recent image. The repository is at most 30 minutes out of date, making synchronization with the latest code much faster.

Snapshot and Restore

Take filesystem snapshots at key points:

This enables instant restoration for follow-up prompts without re-running setup.

Git Configuration for Background Agents

Since git operations are not tied to a specific user during image builds:

Warm Pool Strategy

Maintain a pool of pre-warmed sandboxes for high-volume repositories:

Agent Framework Selection

Server-First Architecture

Choose an agent framework structured as a server first, with TUI and desktop apps as clients. This enables:

Code as Source of Truth

Select frameworks where the agent can read its own source code to understand behavior. This is underrated in AI development: having the code as source of truth prevents hallucination about the agent's own capabilities.

Plugin System Requirements

The framework should support plugins that:

Speed Optimizations

Predictive Warm-Up

Start warming the sandbox as soon as a user begins typing their prompt:

Parallel File Reading

Allow the agent to start reading files immediately, even if sync from latest base branch is not complete:

Maximize Build-Time Work

Move everything possible to the image build step:

Self-Spawning Agents

Agent-Spawned Sessions

Create tools that allow agents to spawn new sessions:

Frontier models are capable of containing themselves. The tools should:

Prompt Engineering for Self-Spawning

Engineer prompts to guide when agents spawn sub-sessions:

API Layer

Per-Session State Isolation

Each session requires its own isolated state storage:

Real-Time Streaming

Agent work involves high-frequency updates:

WebSocket connections with hibernation APIs reduce compute costs during idle periods while maintaining open connections.

Synchronization Across Clients

Build a single state system that synchronizes across:

All changes sync to the session state, enabling seamless client switching.

Multiplayer Support

Why Multiplayer Matters

Multiplayer enables:

Implementation Requirements

With proper synchronization architecture, multiplayer support is nearly free to add.

Authentication and Authorization

User-Based Commits

Use GitHub authentication to:

Sandbox-to-API Flow

  1. Sandbox pushes changes (updating git user config)
  2. Sandbox sends event to API with branch name and session ID
  3. API uses user's GitHub token to create PR
  4. GitHub webhooks notify API of PR events

Client Implementations

Slack Integration

The most effective distribution channel for internal adoption:

Build a classifier to determine which repository to work in:

Web Interface

Core features:

Statistics page showing:

Chrome Extension

For non-engineering users:

Practical Guidance

Follow-Up Message Handling

Decide how to handle messages sent during execution:

Queueing is simpler to manage and lets users send thoughts on next steps while agent works. Build mechanism to stop agent mid-execution when needed.

Metrics That Matter

Track metrics that indicate real value:

Adoption Strategy

Internal adoption patterns that work:

Guidelines

  1. Pre-build environment images on regular cadence (30 minutes is a good default)
  2. Start warming sandboxes when users begin typing, not when they submit
  3. Allow file reads before git sync completes; block only writes
  4. Structure agent framework as server-first with clients as thin wrappers
  5. Isolate state per session to prevent cross-session interference
  6. Attribute commits to the user who prompted, not the app
  7. Track merged PRs as primary success metric
  8. Build for multiplayer from the start; it is nearly free with proper sync architecture

Integration

This skill builds on multi-agent-patterns for agent coordination and tool-design for agent-tool interfaces. It connects to:

References

Internal reference:

Related skills in this collection:

External resources:


Skill Metadata

Created: 2026-01-12

Last Updated: 2026-01-12

Author: Agent Skills for Context Engineering Contributors

Version: 1.0.0

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.