| name | remote-code-agents |
| description | Delegate tasks to remote Claude Code agent containers for parallel execution, long-running analysis, or resource-intensive operations. |
Remote Code Agents
Core Principle
When facing long-running tasks, complex analysis, or workloads better suited for dedicated compute resources, delegate them to remote Claude Code agent containers rather than executing locally.
Note: This skill supports both Claude Code agents (production-ready) and OpenRouter agents (⚠️ experimental, multi-model support).
When to Use This Skill
Always Use When:
- Long-running analysis that would block current workflow (> 5 minutes)
- Resource-intensive tasks like full codebase analysis or performance profiling
- Parallel workload distribution across multiple specialized agents
- Background research that doesn't block current development
Example Scenarios:
- Code review of large pull requests
- Security audit of entire codebase
- Performance optimization analysis
- Documentation generation for multiple modules
- Test generation for legacy code
- Dependency update research
Environment Configuration
Remote code agents require the following environment variables:
export REMOTE_AGENT_API_URL="http://your-agent-host:8080"
export REMOTE_AGENT_API_KEY="your-secure-api-key"
export REMOTE_AGENT_DEFAULT_TYPE="general"
Note: Never commit API keys or internal endpoints to version control. Use:
.env files (gitignored)
- Secret management systems (Vault, AWS Secrets Manager)
- CI/CD secret variables
Agent Types
General Agent
Use for: Coding, debugging, refactoring, feature implementation
AGENT_TYPE=general
Research Agent
Use for: Analysis, documentation, architecture review, research
AGENT_TYPE=research
Testing Agent
Use for: Code review, test generation, QA analysis
AGENT_TYPE=testing
Integration Patterns
1. Command-Line Delegation
If you have the claude-task CLI installed:
TASK_ID=$(claude-task submit \
"Analyze this codebase for performance bottlenecks in API endpoints" \
--repo https://github.com/org/repo \
--type research)
claude-task status $TASK_ID
claude-task wait $TASK_ID
2. API-Based Delegation
Using curl or HTTP clients:
curl -X POST "${REMOTE_AGENT_API_URL}/tasks" \
-H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Review this code for security vulnerabilities",
"repo_url": "https://github.com/org/repo",
"branch": "main",
"agent_type": "testing"
}'
curl -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks/${TASK_ID}"
curl -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks/${TASK_ID}/output"
3. CI/CD Integration
GitLab CI Example
code-review:
stage: review
script:
- |
TASK_ID=$(curl -X POST "${REMOTE_AGENT_API_URL}/tasks" \
-H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
-H "Content-Type: application/json" \
-d "{
\"prompt\": \"Review this merge request for bugs and security issues\",
\"repo_url\": \"${CI_REPOSITORY_URL}\",
\"branch\": \"${CI_COMMIT_REF_NAME}\",
\"agent_type\": \"testing\"
}" | jq -r '.task_id')
for i in {1..60}; do
STATUS=$(curl -s -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks/${TASK_ID}" | jq -r '.status')
[ "$STATUS" = "completed" ] && break
sleep 10
done
curl -s -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks/${TASK_ID}/output"
only:
- merge_requests
GitHub Actions Example
- name: Delegate to Remote Agent
env:
REMOTE_AGENT_API_URL: ${{ secrets.REMOTE_AGENT_API_URL }}
REMOTE_AGENT_API_KEY: ${{ secrets.REMOTE_AGENT_API_KEY }}
run: |
TASK_ID=$(curl -X POST "${REMOTE_AGENT_API_URL}/tasks" \
-H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Generate tests for new features",
"repo_url": "${{ github.repository }}",
"agent_type": "testing"
}' | jq -r '.task_id')
echo "Task submitted: ${TASK_ID}"
4. From Current Session
When working interactively and you need to delegate:
echo "This analysis will take ~15 minutes. Delegating to remote agent..."
TASK_ID=$(curl -X POST "${REMOTE_AGENT_API_URL}/tasks" \
-H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Perform comprehensive security audit of authentication system",
"repo_url": "https://github.com/org/repo",
"agent_type": "research"
}' | jq -r '.task_id')
echo "Task ID: ${TASK_ID}"
echo "You can check status with: curl -H 'X-API-Key: ${REMOTE_AGENT_API_KEY}' ${REMOTE_AGENT_API_URL}/tasks/${TASK_ID}"
Task Lifecycle
States
- pending: Task queued, waiting for agent
- processing: Agent actively working on task
- completed: Task finished successfully
- failed: Task encountered errors
Monitoring
curl -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks"
curl -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/tasks?status=completed"
curl -H "X-API-Key: ${REMOTE_AGENT_API_KEY}" \
"${REMOTE_AGENT_API_URL}/agents"
Best Practices
1. Clear Task Descriptions
Be specific in your prompts:
❌ Bad: "Fix bugs"
✅ Good: "Review the authentication module for security vulnerabilities, focusing on JWT validation and password hashing"
2. Choose Appropriate Agent Type
- General: Implementation, debugging, refactoring
- Research: Analysis, documentation, investigation
- Testing: Reviews, test generation, QA
3. Don't Wait for Long Tasks
For tasks > 5 minutes:
TASK_ID=$(submit_task "Long analysis task")
echo "Check later: claude-task status ${TASK_ID}"
4. Security Considerations
- Never expose API keys in code
- Use environment variables or secret management
- Rotate API keys regularly
- Limit agent access to necessary repositories only
5. Repository Access
Ensure remote agents can access repositories:
- Use public repos, OR
- Configure SSH keys/tokens on agent host, OR
- Use repository mirrors accessible to agents
Setting Up Remote Agents
If you want to set up your own remote agent infrastructure:
Requirements
- Docker-capable server (Linux, macOS, Windows)
- Anthropic API key
- Network accessibility (VPN, Tailscale, or public IP)
Basic Setup
mkdir -p ~/claude-agents
cat > ~/claude-agents/.env <<EOF
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
API_KEY=your-secure-random-api-key
EOF
docker-compose up -d
Recommended: Use Private Network
- Tailscale, ZeroTier, or WireGuard VPN
- Avoid exposing to public internet
- Use mTLS if public exposure required
Integration with Other Skills
Combines With:
- git-platform-cli: Get repo URLs for delegation
- code-review: Delegate reviews to testing agent
- test-driven-development: Generate tests via testing agent
- systematic-debugging: Delegate root cause analysis
Example Combined Workflow:
REPO_URL=$(git remote get-url origin)
BRANCH=$(git branch --show-current)
TASK_ID=$(claude-task submit \
"Review changes in ${BRANCH} for bugs, security, and performance" \
--repo "${REPO_URL}" \
--type testing)
claude-task status ${TASK_ID}
Commitment
When delegating to remote agents, I will:
Note: This skill requires external infrastructure. Ensure remote agents are configured and accessible before use.