archastro.platform.types.extractions

 1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License.
 2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
 3# Content hash: d8459d6fc18e
 4
 5from datetime import datetime
 6from typing import Any, Literal
 7
 8from pydantic import BaseModel, Field
 9
10from .common import StorageFile
11
12
13class ExtractionOutput(BaseModel):
14    """
15    A produced file tracked by an extraction. Type, size, and URL live on the file it points at.
16    """
17
18    created_at: datetime | None = Field(
19        default=None, description="When this output was produced (ISO 8601)."
20    )
21    file: StorageFile | None = Field(
22        default=None,
23        description="The produced file. For a config destination this is the `Storage.File` backing the versioned config row; type, size, and URL live here.",
24    )
25    id: str = Field(..., description="Output ID (`exo_...`).")
26    ordinal: int | None = Field(
27        default=None, description="Position of this output within the extraction's output set."
28    )
29    source_url: str | None = Field(
30        default=None, description="The crawled page path or document path this output came from."
31    )
32    state: Literal["done", "failed"] | None = Field(default=None, description="Output state.")
33
34
35class Extraction(BaseModel):
36    """
37    An extraction job: yields text from a document or website into a destination namespace, without committing knowledge to an agent.
38    """
39
40    agent: str | None = Field(
41        default=None, description="Owning agent (`agt_...`); `null` when not agent-scoped."
42    )
43    byte_count: int | None = Field(
44        default=None, description="Total bytes across produced storage files (a derived aggregate)."
45    )
46    created_at: datetime | None = Field(
47        default=None, description="When the extraction was created (ISO 8601)."
48    )
49    destination: dict[str, Any] | None = Field(
50        default=None, description="Where outputs were written: `{ kind, path_prefix }`."
51    )
52    failure_reason: (
53        Literal[
54            "fetch_failed", "unsupported_content", "extraction_failed", "timeout", "internal_error"
55        ]
56        | None
57    ) = Field(
58        default=None, description="Failure category when `state` is `failed`; `null` otherwise."
59    )
60    file: str | None = Field(
61        default=None,
62        description="Source file (`fil_...`) for document extraction; `null` for link/site.",
63    )
64    id: str = Field(..., description="Extraction ID (`ext_...`).")
65    kind: Literal["document", "link", "site"] | None = Field(
66        default=None, description="What is being extracted."
67    )
68    org: str | None = Field(default=None, description="Owning organization (`org_...`).")
69    output_count: int | None = Field(
70        default=None, description="Number of produced output files (a derived aggregate)."
71    )
72    outputs: list[ExtractionOutput] | None = Field(
73        default=None,
74        description="Produced output files; populated only when the association is preloaded.",
75    )
76    state: Literal["pending", "running", "done", "failed"] | None = Field(
77        default=None, description="Lifecycle state of the extraction job."
78    )
79    updated_at: datetime | None = Field(
80        default=None, description="When the extraction was last updated (ISO 8601)."
81    )
82    url: str | None = Field(
83        default=None, description="Source URL for link/site extraction; `null` for document."
84    )
class ExtractionOutput(pydantic.main.BaseModel):
14class ExtractionOutput(BaseModel):
15    """
16    A produced file tracked by an extraction. Type, size, and URL live on the file it points at.
17    """
18
19    created_at: datetime | None = Field(
20        default=None, description="When this output was produced (ISO 8601)."
21    )
22    file: StorageFile | None = Field(
23        default=None,
24        description="The produced file. For a config destination this is the `Storage.File` backing the versioned config row; type, size, and URL live here.",
25    )
26    id: str = Field(..., description="Output ID (`exo_...`).")
27    ordinal: int | None = Field(
28        default=None, description="Position of this output within the extraction's output set."
29    )
30    source_url: str | None = Field(
31        default=None, description="The crawled page path or document path this output came from."
32    )
33    state: Literal["done", "failed"] | None = Field(default=None, description="Output state.")

A produced file tracked by an extraction. Type, size, and URL live on the file it points at.

created_at: datetime.datetime | None = None

When this output was produced (ISO 8601).

The produced file. For a config destination this is the Storage.File backing the versioned config row; type, size, and URL live here.

id: str = PydanticUndefined

Output ID (exo_...).

ordinal: int | None = None

Position of this output within the extraction's output set.

source_url: str | None = None

The crawled page path or document path this output came from.

state: Optional[Literal['done', 'failed']] = None

Output state.

class Extraction(pydantic.main.BaseModel):
36class Extraction(BaseModel):
37    """
38    An extraction job: yields text from a document or website into a destination namespace, without committing knowledge to an agent.
39    """
40
41    agent: str | None = Field(
42        default=None, description="Owning agent (`agt_...`); `null` when not agent-scoped."
43    )
44    byte_count: int | None = Field(
45        default=None, description="Total bytes across produced storage files (a derived aggregate)."
46    )
47    created_at: datetime | None = Field(
48        default=None, description="When the extraction was created (ISO 8601)."
49    )
50    destination: dict[str, Any] | None = Field(
51        default=None, description="Where outputs were written: `{ kind, path_prefix }`."
52    )
53    failure_reason: (
54        Literal[
55            "fetch_failed", "unsupported_content", "extraction_failed", "timeout", "internal_error"
56        ]
57        | None
58    ) = Field(
59        default=None, description="Failure category when `state` is `failed`; `null` otherwise."
60    )
61    file: str | None = Field(
62        default=None,
63        description="Source file (`fil_...`) for document extraction; `null` for link/site.",
64    )
65    id: str = Field(..., description="Extraction ID (`ext_...`).")
66    kind: Literal["document", "link", "site"] | None = Field(
67        default=None, description="What is being extracted."
68    )
69    org: str | None = Field(default=None, description="Owning organization (`org_...`).")
70    output_count: int | None = Field(
71        default=None, description="Number of produced output files (a derived aggregate)."
72    )
73    outputs: list[ExtractionOutput] | None = Field(
74        default=None,
75        description="Produced output files; populated only when the association is preloaded.",
76    )
77    state: Literal["pending", "running", "done", "failed"] | None = Field(
78        default=None, description="Lifecycle state of the extraction job."
79    )
80    updated_at: datetime | None = Field(
81        default=None, description="When the extraction was last updated (ISO 8601)."
82    )
83    url: str | None = Field(
84        default=None, description="Source URL for link/site extraction; `null` for document."
85    )

An extraction job: yields text from a document or website into a destination namespace, without committing knowledge to an agent.

agent: str | None = None

Owning agent (agt_...); null when not agent-scoped.

byte_count: int | None = None

Total bytes across produced storage files (a derived aggregate).

created_at: datetime.datetime | None = None

When the extraction was created (ISO 8601).

destination: dict[str, typing.Any] | None = None

Where outputs were written: { kind, path_prefix }.

failure_reason: Optional[Literal['fetch_failed', 'unsupported_content', 'extraction_failed', 'timeout', 'internal_error']] = None

Failure category when state is failed; null otherwise.

file: str | None = None

Source file (fil_...) for document extraction; null for link/site.

id: str = PydanticUndefined

Extraction ID (ext_...).

kind: Optional[Literal['document', 'link', 'site']] = None

What is being extracted.

org: str | None = None

Owning organization (org_...).

output_count: int | None = None

Number of produced output files (a derived aggregate).

outputs: list[ExtractionOutput] | None = None

Produced output files; populated only when the association is preloaded.

state: Optional[Literal['pending', 'running', 'done', 'failed']] = None

Lifecycle state of the extraction job.

updated_at: datetime.datetime | None = None

When the extraction was last updated (ISO 8601).

url: str | None = None

Source URL for link/site extraction; null for document.