# flyte.extras

Flyte extras package.
This package provides various utilities that make it possible to build highly customized workflows.

1. ContainerTask: Execute arbitrary pre-containerized applications, without needing the `flyte-sdk`
                  to be installed. This extra uses `flyte copilot` system to inject inputs and slurp
                  outputs from the container run.

2. DynamicBatcher / TokenBatcher: Maximize resource utilization by batching work from many concurrent
                   producers through a single async processing function.  DynamicBatcher is the
                   general-purpose base; TokenBatcher is a convenience subclass for token-budgeted
                   LLM inference with reusable containers.
## Directory

### Classes

| Class | Description |
|-|-|
| [`BatchStats`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/batchstats/page.md) | Monitoring statistics exposed by `DynamicBatcher. |
| [`ContainerTask`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/containertask/page.md) | This is an intermediate class that represents Flyte Tasks that run a container at execution time. |
| [`DynamicBatcher`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/dynamicbatcher/page.md) | Batches records from many concurrent producers and runs them through. |
| [`Prompt`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/prompt/page.md) | Simple prompt record with built-in token estimation. |
| [`TokenBatcher`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/tokenbatcher/page.md) | Token-aware batcher for LLM inference workloads. |

### Protocols

| Protocol | Description |
|-|-|
| [`CostEstimator`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/costestimator/page.md) | Protocol for records that can estimate their own processing cost. |
| [`TokenEstimator`](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/tokenestimator/page.md) | Protocol for records that can estimate their own token count. |

## Subpages

- [BatchStats](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/batchstats/page.md)
  - Parameters
  - Properties
- [ContainerTask](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/containertask/page.md)
  - Parameters
  - Properties
  - Methods
  - aio()
  - config()
  - container_args()
  - custom_config()
  - data_loading_config()
  - execute()
  - forward()
  - override()
  - post()
  - pre()
  - sql()
- [CostEstimator](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/costestimator/page.md)
  - Methods
  - estimate_cost()
- [DynamicBatcher](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/dynamicbatcher/page.md)
  - Parameters
  - Properties
  - Methods
  - start()
  - stop()
  - submit()
  - submit_batch()
- [Prompt](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/prompt/page.md)
  - Parameters
  - Methods
  - estimate_tokens()
- [TokenBatcher](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/tokenbatcher/page.md)
  - Parameters
  - Properties
  - Methods
  - start()
  - stop()
  - submit()
  - submit_batch()
- [TokenEstimator](https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/tokenestimator/page.md)
  - Methods
  - estimate_tokens()

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/packages/flyte.extras/_index.md
**HTML**: https://www.union.ai/docs/v2/union/api-reference/flyte-sdk/packages/flyte.extras/
