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

# task and logs

> Revisit a run, retrieve background results, or investigate a failed task.

`uv run lazycloud run` already displays a function's logs and result. These
commands cover an earlier run, a scheduled task, or work submitted with
`.spawn()`.

## lazycloud task

```bash theme={null}
uv run lazycloud task list [--limit <n>] [--app <name>]          # recent tasks, default 100
uv run lazycloud task show TASK_ID                                # status, timing, deployment, container
uv run lazycloud task result TASK_ID [--no-wait] [--timeout <s>] [--output FILE]  # waits for completion by default
uv run lazycloud task logs TASK_ID [--limit <n>]                  # recent log lines, default 250
uv run lazycloud task stop TASK_IDS...                            # stop running tasks
uv run lazycloud task cancel TASK_ID                              # cancel a pending task
```

```bash theme={null}
uv run lazycloud task list --limit 20 --app api_demo
uv run lazycloud task result <task-id> --timeout 60
```

## lazycloud logs

```bash theme={null}
uv run lazycloud logs (--deployment <name-or-id> | --task-id <id> | --container-id <id>) [options]
```

Prints logs for exactly one source, or streams them with `--follow`.

| Flag                | What it does                                                  |
| ------------------- | ------------------------------------------------------------- |
| `-n`, `--lines <n>` | Last N lines, 1 to 1000, default 250.                         |
| `-f`, `--follow`    | Stream new logs as they arrive.                               |
| `--show-timestamp`  | Prefix each line with its timestamp.                          |
| `--max-events <n>`  | Stop after N streamed events. `0`, the default, is unlimited. |

```bash theme={null}
uv run lazycloud logs --deployment count_words --follow --show-timestamp
uv run lazycloud logs --task-id <task-id> -n 1000
```

<Note>
  To change your default workspace, run `uv run lazycloud workspace use <name>`.
  Commands with a `--workspace` option can override it for one call.
</Note>
