Skip to content

prefactor_core.models module

Data models for prefactor-core.

This module contains dataclasses and models used throughout the SDK.

class prefactor_core.models.AgentInstance(id: str, agent_id: str, status: str = ‘pending’, created_at: datetime = , started_at: datetime | None = None, finished_at: datetime | None = None, metadata: dict[str, ~typing.Any]=)

Section titled “class prefactor_core.models.AgentInstance(id: str, agent_id: str, status: str = ‘pending’, created_at: datetime = , started_at: datetime | None = None, finished_at: datetime | None = None, metadata: dict[str, ~typing.Any]=)”

Bases: object

Represents an agent instance.

An agent instance is a single execution of an agent. It tracks the lifecycle from registration through completion.

Unique identifier for this instance.

  • Type: str

ID of the agent this is an instance of.

  • Type: str

Current status (pending, active, complete).

  • Type: str

When the instance was registered.

  • Type: datetime.datetime

When the instance started executing (if started).

  • Type: datetime.datetime | None

When the instance completed (if finished).

  • Type: datetime.datetime | None

Additional metadata about the instance.

  • Type: dict[str, Any]

class prefactor_core.models.Span(id: str, instance_id: str, schema_name: str, parent_span_id: str | None = None, status: str = ‘pending’, payload: dict[str, ~typing.Any]=, created_at: datetime = , started_at: datetime | None = None, finished_at: datetime | None = None)

Section titled “class prefactor_core.models.Span(id: str, instance_id: str, schema_name: str, parent_span_id: str | None = None, status: str = ‘pending’, payload: dict[str, ~typing.Any]=, created_at: datetime = , started_at: datetime | None = None, finished_at: datetime | None = None)”

Bases: object

Represents a span within an agent instance.

Spans represent discrete units of work within an agent execution, such as LLM calls, tool executions, or processing steps.

Unique identifier for this span.

  • Type: str

ID of the agent instance this span belongs to.

  • Type: str

ID of the parent span (if nested).

  • Type: str | None

Name of the schema defining this span type.

  • Type: str

Current status (pending, active, complete).

  • Type: str

Arbitrary data associated with this span.

  • Type: dict[str, Any]

When the span was created.

  • Type: datetime.datetime

When the span started (defaults to created_at).

  • Type: datetime.datetime | None

When the span completed (if finished).

  • Type: datetime.datetime | None