# Run tasks and workflows with an agent

> Discover compact MCP resources, load one detailed contract, estimate paid work, start it deliberately, and follow its lifecycle.

Canonical: https://entirefeed.com/docs/agents/tasks-and-workflows

Use list tools for compact discovery, then fetch one task, workflow, starter, generation, or run when you need its full contract. This keeps agent context focused and avoids acting on stale summaries.

A generation task creates or processes media directly. A workflow starter exposes a curated input and output contract. A Console workflow is an organization-owned reusable graph and must be read before edits or runs so the current `definition_hash` can guard the action.

## Discover compact resources first

- Generation: list compact tasks or models, then get one task for its schemas and defaults.
- Workflow starters: list compact starters, then get one starter for its current input and output contract.
- Console workflows: list or search, then get one workflow before editing, estimating, or running it.
- Existing work: list compact generations or runs, then get one resource for output, usage, and errors.

## Estimate and run a generation

Use the exact task, optional model, and input from the estimate when creating. The create call is optional and should happen only after the estimate is accepted. Supply a stable caller-generated idempotency key:

### list_console_generation_tasks

```json
{
  "tool": "list_console_generation_tasks",
  "arguments": {}
}
```

### get_console_generation_task

```json
{
  "tool": "get_console_generation_task",
  "arguments": {
    "task_id": "video.create"
  }
}
```

### estimate_console_generation

```json
{
  "tool": "estimate_console_generation",
  "arguments": {
    "task": "video.create",
    "model": "seedance-2",
    "input": {
      "prompt": "A clean product reveal on a studio table.",
      "duration_seconds": 4,
      "aspect_ratio": "9:16",
      "resolution": "1080p"
    }
  }
}
```

### create_console_generation

```json
{
  "tool": "create_console_generation",
  "arguments": {
    "task": "video.create",
    "model": "seedance-2",
    "input": {
      "prompt": "A clean product reveal on a studio table.",
      "duration_seconds": 4,
      "aspect_ratio": "9:16",
      "resolution": "1080p"
    },
    "idempotency_key": "campaign-42-product-reveal-v1"
  }
}
```

### get_console_generation

```json
{
  "tool": "get_console_generation",
  "arguments": {
    "generation_id": "gen_0123456789abcdef0123456789abcdef"
  }
}
```

## Run a workflow starter

Use a starter returned by discovery. Pass the `estimate_version` returned for the same starter version and inputs into the run call; do not invent or reuse an old estimate version:

### list_public_workflow_starters

```json
{
  "tool": "list_public_workflow_starters",
  "arguments": {}
}
```

### get_public_workflow_starter

```json
{
  "tool": "get_public_workflow_starter",
  "arguments": {
    "starter_slug": "<starter_slug from discovery>"
  }
}
```

### estimate_public_workflow_starter_run

```json
{
  "tool": "estimate_public_workflow_starter_run",
  "arguments": {
    "starter_slug": "<starter_slug from discovery>",
    "inputs": {
      "brief": "Create a short vertical product reel."
    }
  }
}
```

### run_public_workflow_starter

```json
{
  "tool": "run_public_workflow_starter",
  "arguments": {
    "starter_slug": "<starter_slug from discovery>",
    "estimate_version": "estimate_v1",
    "idempotency_key": "campaign-42-starter-v1",
    "inputs": {
      "brief": "Create a short vertical product reel."
    }
  }
}
```

### get_public_workflow_run

```json
{
  "tool": "get_public_workflow_run",
  "arguments": {
    "workflow_run_id": "wrun_0123456789abcdef0123456789abcdef"
  }
}
```

## Run a Console workflow

Read the workflow first and pass its returned `definition_hash` as `expected_definition_hash` to estimate and run. Pass the estimate response's `estimate_version` into the run call:

### list_console_workflows

```json
{
  "tool": "list_console_workflows",
  "arguments": {}
}
```

### get_console_workflow

```json
{
  "tool": "get_console_workflow",
  "arguments": {
    "workflow_id": "11111111-1111-4111-8111-111111111111"
  }
}
```

### estimate_console_workflow_run

```json
{
  "tool": "estimate_console_workflow_run",
  "arguments": {
    "workflow_id": "11111111-1111-4111-8111-111111111111",
    "expected_definition_hash": "sha256:current-definition-hash",
    "inputs": {
      "brief": "Create a short vertical product reel."
    }
  }
}
```

### run_console_workflow

```json
{
  "tool": "run_console_workflow",
  "arguments": {
    "workflow_id": "11111111-1111-4111-8111-111111111111",
    "expected_definition_hash": "sha256:current-definition-hash",
    "estimate_version": "estimate_v1",
    "idempotency_key": "campaign-42-workflow-v1",
    "inputs": {
      "brief": "Create a short vertical product reel."
    }
  }
}
```

### get_console_workflow_run

```json
{
  "tool": "get_console_workflow_run",
  "arguments": {
    "run_id": "55555555-5555-4555-8555-555555555555"
  }
}
```

## Follow lifecycle and output

- Use the returned generation or run ID for subsequent reads; do not infer completion from elapsed time.
- Continue reading while work is queued or running. On success, inspect output and final usage before the next action.
- On failure or cancellation, inspect the current resource before deciding whether a retry is intended.
- A retry creates new paid work. Give it a new caller-generated idempotency key for that retry intent.
- Stop automation on manual review or ambiguous output and preserve the resource ID for the user.

Retry only after inspecting a failed or cancelled resource. Each retry below is new paid work and has its own intent key:

### retry_console_generation

```json
{
  "tool": "retry_console_generation",
  "arguments": {
    "generation_id": "gen_0123456789abcdef0123456789abcdef",
    "idempotency_key": "campaign-42-product-reveal-retry-1"
  }
}
```

### retry_console_workflow_run

```json
{
  "tool": "retry_console_workflow_run",
  "arguments": {
    "run_id": "55555555-5555-4555-8555-555555555555",
    "idempotency_key": "campaign-42-workflow-retry-1"
  }
}
```

### retry_public_workflow_run

```json
{
  "tool": "retry_public_workflow_run",
  "arguments": {
    "workflow_run_id": "wrun_0123456789abcdef0123456789abcdef",
    "idempotency_key": "campaign-42-starter-retry-1"
  }
}
```
