---
title: prefactor_http.models.bulk module
editUrl: true
head: []
template: doc
sidebar:
  hidden: false
  attrs: {}
pagefind: true
draft: false
---

# prefactor_http.models.bulk module

Models for the Bulk API.

### *class* prefactor_http.models.bulk.BulkItem(, \_type: str, idempotency_key: Annotated[str, MinLen(min_length=8), MaxLen(max_length=64)], \*\*extra_data: Any)

Bases: `BaseModel`

A single item in a bulk request.

Each item must include \_type and idempotency_key, plus any additional
parameters required by the specific action type.

#### idempotency_key *: str*

Required unique idempotency key for this item. Must be at least 8
characters long and unique within the request.

#### model_config *= {'extra': 'allow'}*

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

#### type *: str*

The type of query/action to execute (e.g., ‘agents/list’, ‘agents/create’).

### *class* prefactor_http.models.bulk.BulkOutput(, status: str, \*\*extra_data: Any)

Bases: `BaseModel`

Output from a query or action.

Contains either a success response (with ‘status’: ‘success’ and
operation-specific data) or an error response (with ‘status’: ‘error’,
‘code’, ‘message’, and optionally ‘errors’).

#### model_config *= {'extra': 'allow'}*

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

#### status *: str*

‘success’ or ‘error’.

* **Type:**
  Status of the operation

#### *classmethod* validate_status(v: str) → str

### *class* prefactor_http.models.bulk.BulkRequest(, items: Annotated[list[[BulkItem](#prefactor_http.models.bulk.BulkItem)], MinLen(min_length=1)])

Bases: `BaseModel`

Request body for bulk query/action operations.

Allows executing multiple API operations in a single request.

#### items *: list[[BulkItem](#prefactor_http.models.bulk.BulkItem)]*

List of items to process in bulk. Each item will be processed independently
in its own transaction.

#### model_config *= {}*

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

#### *classmethod* validate_unique_idempotency_keys(items: list[[BulkItem](#prefactor_http.models.bulk.BulkItem)]) → list[[BulkItem](#prefactor_http.models.bulk.BulkItem)]

Validate that all idempotency keys are unique within the request.

### *class* prefactor_http.models.bulk.BulkResponse(, status: str = 'success', outputs: dict[str, [BulkOutput](#prefactor_http.models.bulk.BulkOutput)])

Bases: `BaseModel`

Response from bulk query/action operations.

Contains a map of results keyed by the idempotency_key from each request item.

#### model_config *= {}*

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

#### outputs *: dict[str, [BulkOutput](#prefactor_http.models.bulk.BulkOutput)]*

Map where keys are the idempotency_key values from the request, and values
are the corresponding query/action outputs or error responses.

#### status *: str*

Response status, always ‘success’ when the request is processed.