Execution
Execution configuration defines where and how AgentGate runs agent tasks. It specifies the code workspace, sandbox isolation, and agent runtime settings.What Is Execution
The execution section of a TaskSpec controls three key aspects:| Component | Purpose |
|---|---|
| Workspace | Where the code lives (local, git, GitHub) |
| Sandbox | Isolation and resource limits (Docker, subprocess) |
| Agent | AI driver configuration |
Execution Specification
Workspace Types
AgentGate supports five workspace types for different scenarios:- Local
- Git
- GitHub
- GitHub New
- Fresh
Use an existing local directoryWork directly on an existing codebase:Options:
Best for:
| Option | Type | Description |
|---|---|---|
path | string | Absolute path to the workspace |
readonly | boolean | Prevent file modifications (testing) |
- Local development and testing
- Existing projects on the machine
- Quick iterations without git operations
Sandbox Configuration
Sandboxes provide isolation and resource control for agent execution:Sandbox Providers
- Docker
- Subprocess
- None
Full container isolationThe most secure option with complete process isolation:Capabilities:
- Full filesystem isolation
- Network namespace isolation
- Resource limit enforcement
- Custom Docker images
Resource Specification
Control compute resources allocated to the sandbox:| Resource | Format | Examples |
|---|---|---|
cpu | number | 0.5, 2, 4 |
memory | string | "512Mi", "4Gi" |
disk | string | "1Gi", "20Gi" |
timeout | string | "30m", "1h", "24h" |
Network Modes
Control sandbox network access:| Mode | Description | Use Case |
|---|---|---|
none | No network access | Security-sensitive tasks |
bridge | Isolated network with internet | Most development tasks |
host | Full host network access | Integration testing |
Volume Mounts
Share directories between host and sandbox:Environment Variables
Pass environment variables to the sandbox:Complete Examples
Minimal Execution
GitHub with Docker
Full-Featured Execution
Sandbox Lifecycle
1
Creation
AgentGate creates the sandbox based on provider configuration:
- Docker: Pulls image and creates container
- Subprocess: Prepares process environment
2
Workspace Setup
The workspace is cloned/mounted into the sandbox:
- Git operations (clone, checkout)
- Volume mounts applied
- Environment variables set
3
Agent Execution
The agent runs within the sandbox:
- Resource limits enforced
- Network policies applied
- Timeout monitoring active
4
Result Collection
Output is collected from the sandbox:
- Stdout/stderr captured
- Modified files tracked
- Resource usage recorded
5
Cleanup
Sandbox is destroyed after execution:
- Container removed (Docker)
- Process terminated (subprocess)
- Temporary files cleaned
Sandbox Registry
AgentGate tracks all active sandboxes for cleanup and monitoring:Orphan Detection
AgentGate automatically detects and cleans up orphaned sandboxes:- Containers from crashed runs
- Stale subprocess trees
- Abandoned volume mounts
Best Practices
1
Choose the Right Workspace Type
- local: Fast iteration on existing code
- github: Full CI/CD integration
- git: Non-GitHub repositories
- fresh: Clean slate experiments
2
Size Resources Appropriately
| Task Type | CPU | Memory | Timeout |
|---|---|---|---|
| Simple fix | 1-2 | 2Gi | 30m |
| Feature | 2-4 | 4Gi | 1-2h |
| Large build | 4-8 | 8Gi | 2-4h |
| Monorepo | 4-8 | 16Gi | 4h+ |
3
Use Docker for Isolation
Always use Docker sandbox for:
- Untrusted code
- Production environments
- Multi-tenant scenarios
4
Optimize with Mounts
Mount cache directories to speed up builds:
5
Limit Network Access
Use
network: none when possible:- Prevents data exfiltration
- Ensures offline builds work
- Reduces attack surface
Troubleshooting
Docker image pull fails
Docker image pull fails
Check image availability:Ensure Docker daemon is running:
Out of memory errors
Out of memory errors
Increase memory limit:Or use a smaller base image:
Git clone authentication fails
Git clone authentication fails
For GitHub workspaces, ensure
GITHUB_TOKEN is set.For git workspaces, configure credentials:Sandbox timeout
Sandbox timeout
Increase timeout in resources:Also check convergence limits:
Permission denied on mount
Permission denied on mount
Check host directory permissions:Or use readonly mount: