Skip to main content

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:

Execution Specification

Workspace Types

AgentGate supports five workspace types for different scenarios:
Use an existing local directoryWork directly on an existing codebase:
Options:Best for:
  • 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

Full container isolationThe most secure option with complete process isolation:
Capabilities:
  • Full filesystem isolation
  • Network namespace isolation
  • Resource limit enforcement
  • Custom Docker images
Use slim/alpine images for faster startup and smaller footprint.

Resource Specification

Control compute resources allocated to the sandbox:
Format Reference:

Network Modes

Control sandbox network access:

Volume Mounts

Share directories between host and sandbox:

Environment Variables

Pass environment variables to the sandbox:
Be careful with sensitive environment variables. Consider using secrets management instead of embedding them in TaskSpecs.

Complete Examples

Minimal Execution

GitHub with Docker

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

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

Check image availability:
Ensure Docker daemon is running:
Increase memory limit:
Or use a smaller base image:
For GitHub workspaces, ensure GITHUB_TOKEN is set.For git workspaces, configure credentials:
Increase timeout in resources:
Also check convergence limits:
Check host directory permissions:
Or use readonly mount:

TaskSpec

Configure execution within TaskSpec

Agents

Agent driver configuration

Delivery

Ship results after execution

Gates

Verification during execution