> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kubiya.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Execution Resources

> Manage executions, scheduled jobs, and workers for task automation

Execution resources handle task scheduling, monitoring, and distributed execution across your worker infrastructure. This includes one-time executions, scheduled jobs with cron triggers, and worker management.

## Quick Start

```bash theme={null}
# List executions
kubiya execution list --status running
```

**Output:**

```
📊 Executions

ID                                    AGENT           STATUS      STARTED
a1b2c3d4-e5f6-7890-abcd-ef1234567890  DevOps Agent   running     2025-01-15 14:23:45
b2c3d4e5-f6a7-8901-bcde-f12345678901  Platform Agent running     2025-01-15 14:20:12
```

```bash theme={null}
# View execution logs
kubiya execution logs <execution-id> --follow

# Create scheduled job
kubiya job create --file job.yaml

# List scheduled jobs
kubiya job list
```

**Output:**

```
⏰ Scheduled Jobs (0)

No jobs found. Create your first job with:
  kubiya job create --file job.yaml
```

```bash theme={null}
# Check worker status (requires queue ID)
kubiya worker status --queue-id <queue-id>
```

**Output:**

```
📊 Worker Status

Queue ID: default-queue
Status: Running
Workers: 2 active
Last Heartbeat: 2025-01-15 14:25:30
```

## Executions

One-time task runs with real-time streaming and logging.

### List Executions

```bash theme={null}
# List all executions
kubiya execution list

# Filter by agent
kubiya execution list --agent <agent-id>

# Filter by status
kubiya execution list --status running
kubiya execution list --status completed
kubiya execution list --status failed
```

### Get Execution Details

```bash theme={null}
# View execution details
kubiya execution get <execution-id>

# JSON output
kubiya execution get <execution-id> --output json
```

### View Execution Logs

```bash theme={null}
# View logs
kubiya execution logs <execution-id>

# Follow logs in real-time
kubiya execution logs <execution-id> --follow
```

### Check Execution Status

```bash theme={null}
# Get current status
kubiya execution status <execution-id>
```

### Cancel Execution

```bash theme={null}
# Cancel running execution
kubiya execution cancel <execution-id>
```

### Retry Failed Execution

```bash theme={null}
# Retry with same parameters
kubiya execution retry <execution-id>
```

## Jobs

Scheduled or recurring tasks with cron-based triggers.

### List Jobs

```bash theme={null}
# List all jobs
kubiya job list

# JSON output
kubiya job list --output json
```

### Get Job Details

```bash theme={null}
# View job configuration
kubiya job get <job-id>
```

### Create Job

```bash theme={null}
# Create from file
kubiya job create --file job.yaml
```

```yaml theme={null}
# job.yaml
name: daily-backup
description: Run daily database backup
schedule: "0 0 * * *"  # Daily at midnight
agent_id: backup-agent
prompt: "Run full database backup"
enabled: true
```

**Common Cron Expressions:**

| Schedule         | Cron Expression  | Description                     |
| ---------------- | ---------------- | ------------------------------- |
| Every hour       | `0 * * * *`      | Run at the start of every hour  |
| Daily at 2 AM    | `0 2 * * *`      | Run once per day at 2:00 AM     |
| Weekly on Monday | `0 0 * * 1`      | Run every Monday at midnight    |
| Monthly on 1st   | `0 0 1 * *`      | Run first day of each month     |
| Every 15 minutes | `*/15 * * * *`   | Run 4 times per hour            |
| Business hours   | `0 9-17 * * 1-5` | Every hour during business days |

### Update Job

```bash theme={null}
# Update job configuration
kubiya job update <job-id> --file job.yaml
```

### Pause Job

```bash theme={null}
# Pause scheduled job
kubiya job pause <job-id>
```

### Resume Job

```bash theme={null}
# Resume paused job
kubiya job resume <job-id>
```

### Trigger Job Manually

```bash theme={null}
# Run job immediately
kubiya job trigger <job-id>
```

### Delete Job

```bash theme={null}
# Delete job
kubiya job delete <job-id>
```

## Workers

Execution engines that process agent tasks. Workers can be persistent (always running) or on-demand (ephemeral).

<Note>
  For detailed worker deployment and configuration, see the [Worker Management](/cli/workers) guide.
</Note>

### Start Worker

```bash theme={null}
# Start worker
kubiya worker start

# Start with specific queue
kubiya worker start --queue <queue-id>
```

### Stop Worker

```bash theme={null}
# Stop running worker
kubiya worker stop
```

### Check Worker Status

```bash theme={null}
# Get worker status (requires queue ID)
kubiya worker status --queue-id <queue-id>
```

### View Worker Logs

```bash theme={null}
# View logs
kubiya worker logs

# Follow logs in real-time
kubiya worker logs --follow
```

## Best Practices

* Monitor for failed executions and long-running tasks
* Check execution logs regularly for errors
* Test jobs manually before enabling schedules
* Use appropriate cron expressions for schedules
* Set realistic timeouts for jobs
* Use on-demand workers for occasional tasks
* Use persistent workers for high-frequency operations
* Keep workers updated with latest features
* Deploy multiple workers for critical workloads

## Command Reference

```bash theme={null}
# Executions
kubiya execution list [--status running|completed|failed]
kubiya execution list --agent <id>
kubiya execution get <id>
kubiya execution logs <id> [--follow]
kubiya execution status <id>
kubiya execution cancel <id>
kubiya execution retry <id>

# Jobs
kubiya job list
kubiya job get <id>
kubiya job create --file job.yaml
kubiya job update <id> --file job.yaml
kubiya job delete <id>
kubiya job pause <id>
kubiya job resume <id>
kubiya job trigger <id>

# Workers
kubiya worker start [--queue <id>]
kubiya worker stop
kubiya worker status --queue-id <id>
kubiya worker logs [--follow]
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Core Resources" icon="cube" href="/cli/core-resources">
    Manage agents, teams, and projects
  </Card>

  <Card title="Worker Management" icon="server" href="/cli/workers">
    Detailed worker deployment and configuration
  </Card>

  <Card title="Smart Execution" icon="bolt" href="/cli/exec">
    Execute tasks with automatic planning
  </Card>

  <Card title="Capabilities" icon="puzzle-piece" href="/cli/capabilities">
    Add skills, models, and policies
  </Card>
</CardGroup>
