# Client.runner

```python
def Client.runner(
    cluster: ClusterSlugLike | None = None,
    tasks: list[type[Task]] | None = None,
    cache: JobCache | None = None,
    context: type[RunnerContext] | None = None,
    runner: Runner | None = None,
) -> TaskRunner
```

Initialize a direct runner from task classes.

For new Python workflow projects, define a reusable [`Runner`](/docs/api-reference/python/tilebox.workflows/Runner) object and call [`Runner.connect_to`](/docs/api-reference/python/tilebox.workflows/Runner.connect_to) when you want direct execution. The `Client.runner` method remains available for existing code and simple direct runner scripts.

## Parameters

**cluster**

`str | None`

The [cluster slug](/docs/workflows/concepts/clusters#cluster-slug) for the cluster associated with this direct runner.
If not provided, the default cluster is used.

**tasks**

`list[type[Task]] | None`

A list of task classes that this runner can execute. Pass either `tasks`, `cache`, and `context`, or pass a reusable `runner` object.

**cache**

`JobCache`

An optional [job cache](/docs/workflows/run-and-inspect/caches) for caching results from tasks and sharing data between tasks.

**context**

`type[RunnerContext] | None`

Optional runner context class to instantiate for task execution.

**runner**

`Runner | None`

A reusable runner definition. If provided, do not also pass `tasks`, `cache`, or `context`.

```python title="Python"
from tilebox.workflows import Client
from tilebox.workflows.cache import LocalFileSystemCache

client = Client()
runner = client.runner(
    tasks=[MyFirstTask, MySubtask],
    # optional:
    cache=LocalFileSystemCache("cache_directory"),
)
```
