from __future__ import annotations from typing import Any, TypedDict from kab_ingestion.models import Document, IngestionRequest, IngestionResult, SourceDocument class IngestionState(TypedDict, total=False): # Base agent state contract fields messages: list[dict[str, Any]] errors: list[dict[str, Any]] has_errors: bool workflow_id: str | None current_step: str next_step: str | None started_at: str | None updated_at: str | None final_output: dict[str, Any] | None # Ingestion phase extension fields request: IngestionRequest tenant_id: str existing_resources: dict[str, Any] validation_errors: list[str] fetched_documents: list[Document | SourceDocument] published_results: list[IngestionResult]