---
title: "Client.runner"
description: "Initialize a direct runner from task classes."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

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

# Client.runner

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```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**

type: 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**

type: 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**

type: JobCache

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

**context**

type: type[RunnerContext] | None

Optional runner context class to instantiate for task execution.

**runner**

type: Runner | None

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

<h2 id="request-example">Usage example</h2>

```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"),
)
```

Source: https://tilebox.com/docs/api-reference/python/tilebox.workflows/Client.runner/index.mdx
