Skip to content

prefactor_core.operations module

Operation types for prefactor-core.

Operations represent discrete units of work that can be queued and processed asynchronously. Each operation type maps to a specific API action.

class prefactor_core.operations.Operation(type: ~prefactor_core.operations.OperationType, payload: dict[str, ~typing.Any], timestamp: ~datetime.datetime, idempotency_key: str | None = None, metadata: dict[str, ~typing.Any] = )

Section titled “class prefactor_core.operations.Operation(type: ~prefactor_core.operations.OperationType, payload: dict[str, ~typing.Any], timestamp: ~datetime.datetime, idempotency_key: str | None = None, metadata: dict[str, ~typing.Any] = )”

Bases: object

A single operation to be queued and processed.

Operations are immutable and contain all data needed for execution. They are created synchronously and processed asynchronously by workers.

The type of operation to perform.

Dictionary containing operation-specific data.

  • Type: dict[str, Any]

When the operation was created.

  • Type: datetime.datetime

Optional key for idempotent operations.

  • Type: str | None

Optional additional metadata.

  • Type: dict[str, Any]

from datetime import datetime, timezone

operation = Operation( : type=OperationType.CREATE_SPAN, payload={

“instance_id”: “inst-123”, “schema_name”: “agent:llm”, “span_id”: “span-456”


}, timestamp=datetime.now(timezone.utc), idempotency_key=”span-456”

)

class prefactor_core.operations.OperationType(*values)

Section titled “class prefactor_core.operations.OperationType(*values)”

Bases: Enum

Types of operations that can be performed.

Each operation type corresponds to a specific API endpoint action.