🛠️ Hostedエージェント
隔離された安全な環境で、バックグラウンドで
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Build background agents in sandboxed environments. Use for hosted coding agents, sandboxed VMs, Modal sandboxes, and remote coding environments.
🇯🇵 日本人クリエイター向け解説
隔離された安全な環境で、バックグラウンドで
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o hosted-agents.zip https://jpskill.com/download/2981.zip && unzip -o hosted-agents.zip && rm hosted-agents.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/2981.zip -OutFile "$d\hosted-agents.zip"; Expand-Archive "$d\hosted-agents.zip" -DestinationPath $d -Force; ri "$d\hosted-agents.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
hosted-agents.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
hosted-agentsフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › Hosted Agents を使って、最小構成のサンプルコードを示して
- › Hosted Agents の主な使い方と注意点を教えて
- › Hosted Agents を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] hosted-agents
ホスト型エージェントインフラストラクチャ
ホスト型エージェントは、ローカルマシンではなく、リモートのサンドボックス環境で実行されます。適切に設計されていれば、無制限の並行性、一貫した実行環境、およびマルチプレイヤーコラボレーションを提供します。重要な洞察は、セッション速度はモデルプロバイダーの初回トークン生成時間によってのみ制限されるべきであり、ユーザーがセッションを開始する前にすべてのインフラストラクチャ設定が完了している必要があるということです。
使用するタイミング
このスキルは、次の場合にアクティブ化してください。
- ユーザーデバイスから独立して実行されるバックグラウンドコーディングエージェントを構築する場合
- エージェントワークロード用のサンドボックス実行環境を設計する場合
- 共有状態を持つマルチプレイヤーエージェントセッションを実装する場合
- マルチクライアントエージェントインターフェース(Slack、Web、Chrome拡張機能)を作成する場合
- ローカルマシンの制約を超えてエージェントインフラストラクチャを拡張する場合
- エージェントが並行作業のためにサブエージェントを生成するシステムを構築する場合
コアコンセプト
ホスト型エージェントは、ローカルエージェント実行の根本的な制限であるリソース競合、環境の不整合、およびシングルユーザーの制約に対処します。エージェントの実行をリモートのサンドボックス環境に移行することで、チームは無制限の並行性、再現可能な環境、および共同ワークフローを獲得できます。
アーキテクチャは、分離された実行のためのサンドボックスインフラストラクチャ、状態管理とクライアント調整のためのAPIレイヤー、およびプラットフォーム間のユーザーインタラクションのためのクライアントインターフェースの3つのレイヤーで構成されています。各レイヤーには、システムを拡張可能にするための特定の設計要件があります。
詳細なトピック
サンドボックスインフラストラクチャ
コアチャレンジ 完全な開発環境を迅速に立ち上げることが、主要な技術的課題です。ユーザーはほぼ瞬時のセッション開始を期待しますが、開発環境ではリポジトリのクローン作成、依存関係のインストール、ビルドステップの実行が必要です。
イメージレジストリパターン 定期的に(30分ごとが適切です)環境イメージを事前にビルドします。各イメージには以下が含まれます。
- 既知のコミットでクローンされたリポジトリ
- すべてのランタイム依存関係がインストール済み
- 初期セットアップとビルドコマンドが完了済み
- アプリとテストスイートを一度実行してキャッシュされたファイル
セッションを開始するときは、最新のイメージからサンドボックスを立ち上げます。リポジトリは最大で30分遅れているため、最新のコードとの同期がはるかに高速になります。
スナップショットと復元 主要なポイントでファイルシステムのスナップショットを取得します。
- 初期イメージビルド後(ベーススナップショット)
- エージェントが変更を完了した後(セッションスナップショット)
- 潜在的なフォローアップのためにサンドボックスを終了する前
これにより、セットアップを再実行することなく、フォローアッププロンプトのために瞬時に復元できます。
バックグラウンドエージェントのGit構成 イメージビルド中にgit操作が特定のユーザーに紐付けられないため:
- クローン中のリポジトリアクセス用にGitHubアプリインストールトークンを生成します
- 変更をコミットおよびプッシュするときにgit configの
user.nameとuser.emailを更新します - アプリのIDではなく、プロンプトを送信したユーザーのIDをコミットに使用します
ウォームプール戦略 大量のリポジトリ用に、事前にウォームアップされたサンドボックスのプールを維持します。
- ユーザーがセッションを開始する前にサンドボックスが準備完了
- 新しいイメージビルドが完了すると、プールエントリを期限切れにして再作成
- ユーザーが入力し始めるとすぐにサンドボックスのウォームアップを開始(予測的ウォームアップ)
エージェントフレームワークの選択
サーバーファーストアーキテクチャ TUIおよびデスクトップアプリをクライアントとする、サーバーファーストとして構築されたエージェントフレームワークを選択します。これにより、以下が可能になります。
- エージェントロジックを重複させることなく、複数のカスタムクライアント
- すべてのインタラクションサーフェスで一貫した動作
- 機能を拡張するためのプラグインシステム
- リアルタイム更新のためのイベント駆動型アーキテクチャ
コードを真実の源とする エージェントが自身の動作を理解するために自身のソースコードを読み取ることができるフレームワークを選択します。これはAI開発において過小評価されています。コードを真実の源とすることで、エージェント自身の能力に関する幻覚を防ぐことができます。
プラグインシステムの要件 フレームワークは、以下の機能を備えたプラグインをサポートする必要があります。
- ツール実行イベント(例:
tool.execute.before)をリッスンする - ツール呼び出しを条件付きでブロックまたは変更する
- ランタイム時にコンテキストまたは状態を注入する
速度最適化
予測的ウォームアップ ユーザーがプロンプトを入力し始めるとすぐにサンドボックスのウォームアップを開始します。
- ユーザーの入力と並行して最新の変更をクローン
- ユーザーがEnterキーを押す前に初期セットアップを実行
- 高速なスピンアップのために、ユーザーが入力し終える前にサンドボックスが準備完了になることも可能
並列ファイル読み取り 最新のベースブランチからの同期が完了していなくても、エージェントがすぐにファイルの読み取りを開始できるようにします。
- 大規模なリポジトリでは、受信プロンプトが最近変更されたファイルを変更することはめったにありません
- エージェントはgit同期を待たずにすぐに調査を開始できます
- 同期が完了するまでファイルの編集(読み取りではない)をブロックします
ビルド時作業の最大化 可能な限りすべてをイメージビルドステップに移動します。
- 完全な依存関係のインストール
- データベーススキーマのセットアップ
- 初期アプリとテストスイートの実行(キャッシュを投入)
- ビルド時間の長さはユーザーには見えません
自己生成エージェント
エージェント生成セッション エージェントが新しいセッションを生成できるツールを作成します。
- 異なるリポジトリにわたる調査タスク
- 大規模な変更のための並列サブタスク実行
- 1つの主要なタスクから複数の小さなPR
フロンティアモデルは自己完結型です。ツールは以下を行う必要があります。
- 指定されたパラメーターで新しいセッションを開始する
- 任意のセッションのステータスを読み取る(チェックイン機能)
- サブセッションが並行して実行されている間、メイン作業を続行する
自己生成のためのプロンプトエンジニアリング エージェントがサブセッションを生成するタイミングをガイドするようにプロンプトを設計します。
- クロスリポジトリ探索を必要とする調査タスク
- モノリシックな変更をより小さなPRに分割する
- 異なるアプローチの並列探索
APIレイヤー
セッションごとの状態分離 各セッションには、独自の分離された状態ストレージが必要です。
- セッションごとに専用のデータベース(セッションごとにSQLiteがうまく機能します)
- どのセッションも他のセッションのパフォーマンスに影響を与えない
- 数百の同時セッションを処理
リアルタイムストリーミング エージェントの作業には高頻度の更新が含まれます。
- モデルプロバイダーからのトークンストリーミング
- ツール実行ステータス
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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 Use
Activate this skill when:
- Building background coding agents that run independently of user devices
- Designing sandboxed execution environments for agent workloads
- Implementing multiplayer agent sessions with shared state
- Creating multi-client agent interfaces (Slack, Web, Chrome extensions)
- Scaling agent infrastructure beyond local machine constraints
- Building systems where agents spawn sub-agents for parallel work
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:
- Cloned repository at a known commit
- All runtime dependencies installed
- Initial setup and build commands completed
- Cached files from running app and test suite once
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:
- After initial image build (base snapshot)
- When agent finishes making changes (session snapshot)
- Before sandbox exit for potential follow-up
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:
- Generate GitHub app installation tokens for repository access during clone
- Update git config's
user.nameanduser.emailwhen committing and pushing changes - Use the prompting user's identity for commits, not the app identity
Warm Pool Strategy Maintain a pool of pre-warmed sandboxes for high-volume repositories:
- Sandboxes are ready before users start sessions
- Expire and recreate pool entries as new image builds complete
- Start warming sandbox as soon as user begins typing (predictive warm-up)
Agent Framework Selection
Server-First Architecture Choose an agent framework structured as a server first, with TUI and desktop apps as clients. This enables:
- Multiple custom clients without duplicating agent logic
- Consistent behavior across all interaction surfaces
- Plugin systems for extending functionality
- Event-driven architectures for real-time updates
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:
- Listen to tool execution events (e.g.,
tool.execute.before) - Block or modify tool calls conditionally
- Inject context or state at runtime
Speed Optimizations
Predictive Warm-Up Start warming the sandbox as soon as a user begins typing their prompt:
- Clone latest changes in parallel with user typing
- Run initial setup before user hits enter
- For fast spin-up, sandbox can be ready before user finishes typing
Parallel File Reading Allow the agent to start reading files immediately, even if sync from latest base branch is not complete:
- In large repositories, incoming prompts rarely modify recently-changed files
- Agent can research immediately without waiting for git sync
- Block file edits (not reads) until synchronization completes
Maximize Build-Time Work Move everything possible to the image build step:
- Full dependency installation
- Database schema setup
- Initial app and test suite runs (populates caches)
- Build-time duration is invisible to users
Self-Spawning Agents
Agent-Spawned Sessions Create tools that allow agents to spawn new sessions:
- Research tasks across different repositories
- Parallel subtask execution for large changes
- Multiple smaller PRs from one major task
Frontier models are capable of containing themselves. The tools should:
- Start a new session with specified parameters
- Read status of any session (check-in capability)
- Continue main work while sub-sessions run in parallel
Prompt Engineering for Self-Spawning Engineer prompts to guide when agents spawn sub-sessions:
- Research tasks that require cross-repository exploration
- Breaking monolithic changes into smaller PRs
- Parallel exploration of different approaches
API Layer
Per-Session State Isolation Each session requires its own isolated state storage:
- Dedicated database per session (SQLite per session works well)
- No session can impact another's performance
- Handles hundreds of concurrent sessions
Real-Time Streaming Agent work involves high-frequency updates:
- Token streaming from model providers
- Tool execution status updates
- File change notifications
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:
- Chat interfaces
- Slack bots
- Chrome extensions
- Web interfaces
- VS Code instances
All changes sync to the session state, enabling seamless client switching.
Multiplayer Support
Why Multiplayer Matters Multiplayer enables:
- Teaching non-engineers to use AI effectively
- Live QA sessions with multiple team members
- Real-time PR review with immediate changes
- Collaborative debugging sessions
Implementation Requirements
- Data model must not tie sessions to single authors
- Pass authorship info to each prompt
- Attribute code changes to the prompting user
- Share session links for instant collaboration
With proper synchronization architecture, multiplayer support is nearly free to add.
Authentication and Authorization
User-Based Commits Use GitHub authentication to:
- Obtain user tokens for PR creation
- Open PRs on behalf of the user (not the app)
- Prevent users from approving their own changes
Sandbox-to-API Flow
- Sandbox pushes changes (updating git user config)
- Sandbox sends event to API with branch name and session ID
- API uses user's GitHub token to create PR
- GitHub webhooks notify API of PR events
Client Implementations
Slack Integration The most effective distribution channel for internal adoption:
- Creates virality loop as team members see others using it
- No syntax required, natural chat interface
- Classify repository from message, thread context, and channel name
Build a classifier to determine which repository to work in:
- Fast model with descriptions of available repositories
- Include hints for common repositories
- Allow "unknown" option for ambiguous cases
Web Interface Core features:
- Works on desktop and mobile
- Real-time streaming of agent work
- Hosted VS Code instance running inside sandbox
- Streamed desktop view for visual verification
- Before/after screenshots for PRs
Statistics page showing:
- Sessions resulting in merged PRs (primary metric)
- Usage over time
- Live "humans prompting" count (prompts in last 5 minutes)
Chrome Extension For non-engineering users:
- Sidebar chat interface with screenshot tool
- DOM and React internals extraction instead of raw images
- Reduces token usage while maintaining precision
- Distribute via managed device policy (bypasses Chrome Web Store)
Practical Guidance
Follow-Up Message Handling
Decide how to handle messages sent during execution:
- Queue approach: Messages wait until current prompt completes
- Insert approach: Messages are processed immediately
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:
- Sessions resulting in merged PRs (primary success metric)
- Time from session start to first model response
- PR approval rate and revision count
- Agent-written code percentage across repositories
Adoption Strategy
Internal adoption patterns that work:
- Work in public spaces (Slack channels) for visibility
- Let the product create virality loops
- Don't force usage over existing tools
- Build to people's needs, not hypothetical requirements
Guidelines
- Pre-build environment images on regular cadence (30 minutes is a good default)
- Start warming sandboxes when users begin typing, not when they submit
- Allow file reads before git sync completes; block only writes
- Structure agent framework as server-first with clients as thin wrappers
- Isolate state per session to prevent cross-session interference
- Attribute commits to the user who prompted, not the app
- Track merged PRs as primary success metric
- 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:
- multi-agent-patterns - Self-spawning agents follow supervisor patterns
- tool-design - Building tools for agent spawning and status checking
- context-optimization - Managing context across distributed sessions
- filesystem-context - Using filesystem for session state and artifacts
References
Internal reference:
- Infrastructure Patterns - Detailed implementation patterns
Related skills in this collection:
- multi-agent-patterns - Coordination patterns for self-spawning agents
- tool-design - Designing tools for hosted environments
- context-optimization - Managing context in distributed systems
External resources:
- Ramp - Why We Built Our Own Background Agent
- Modal Sandboxes - Cloud sandbox infrastructure
- Cloudflare Durable Objects - Per-session state management
- OpenCode - Server-first agent framework
Skill Metadata
Created: 2026-01-12 Last Updated: 2026-01-12 Author: Agent Skills for Context Engineering Contributors Version: 1.0.0
When to Use
Use this skill when tackling tasks related to its primary domain or functionality as described above.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.