Runs
A run is the execution of a work order. When you submit a work order, AgentGate creates a run to carry out the task. Runs track progress, status, and results.What Is a Run
Each work order creates exactly one run. The run represents the entire execution lifecycle:- Workspace setup
- AI agent execution
- Iteration and verification cycles
- Result generation
Run Lifecycle
Runs progress through these states:Run States
| State | Description | Terminal |
|---|---|---|
pending | Queued, waiting to start | No |
running | Currently executing | No |
succeeded | Completed successfully | Yes |
failed | Completed with failure | Yes |
cancelled | Stopped by user request | Yes |
Terminal states are final—the run will not change state again.
State Transitions
- pending → running: Run starts execution
- running → succeeded: All iterations passed verification
- running → failed: Max iterations reached without success, or unrecoverable error
- running → cancelled: User requested cancellation
Monitoring Runs
Polling
Retrieve run status by ID:Webhooks (Recommended)
Configure webhooks to receive real-time notifications:Run Results
When a run completes successfully, results include:Result Fields
| Field | Description |
|---|---|
id | Run identifier |
workOrderId | Associated work order |
status | Final status |
iterations | Number of iterations completed |
prUrl | Pull request URL (if changes were made) |
timing | Start, end, and duration |
cost | Credit cost of the run |
tenantContext | Tenant info (if provided) |
Run Timing
Duration
Run duration depends on:- Task complexity
- Workspace size
- Number of iterations needed
- Verification level
Timeouts
Runs have a maximum execution time. If exceeded:- Run status becomes
failed - Partial results may be available
- Credits are charged for completed iterations
Cancelling Runs
Cancel a run that’s in progress:Only runs in
pending or running state can be cancelled.- Run status becomes
cancelled - Any in-progress work stops
- Credits are charged for completed iterations only
- Webhook fires with
run.cancelledevent
Cost Information
Run costs are determined by:- Number of iterations
- Complexity of verification
- Workspace resources used
Listing Runs
Retrieve all runs with filtering:Query Parameters
| Parameter | Description |
|---|---|
status | Filter by status |
tenantUserId | Filter by tenant user |
limit | Results per page (max 100) |
offset | Pagination offset |
Related
Work Orders
Learn about creating work orders
Iterations
Understand the iteration and verification process