archastro.platform.types.threads

  1# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
  2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
  3# Content hash: 04ab3c50541a
  4
  5from datetime import datetime
  6from typing import Any
  7
  8from pydantic import BaseModel, Field
  9
 10from .common import Agent, Message
 11from .users import User
 12
 13
 14class ThreadSettings(BaseModel):
 15    """
 16    Configuration settings for a thread that control AI agent behavior and other thread-level preferences.
 17    """
 18
 19    agent_enabled: bool | None = Field(
 20        default=None,
 21        description="Whether the AI agent is active for this thread. `true` enables AI responses; `false` disables them. Defaults to `true` when settings have not been explicitly configured.",
 22    )
 23
 24
 25class Thread(BaseModel):
 26    """
 27    A chat thread, representing a conversation channel that can be owned by a user, team, or agent and may contain messages, participants, and AI agent activity.
 28    """
 29
 30    agent_user: str | None = Field(
 31        default=None,
 32        description="ID of the agent that owns this thread (`agt_...`). `null` for user-owned or team-owned threads.",
 33    )
 34    created_at: datetime | None = Field(
 35        default=None, description="When the thread was created (ISO 8601)."
 36    )
 37    creator: User | None = Field(
 38        default=None,
 39        description="Expanded user object for the user who created this thread. Populated only when the association is loaded.",
 40    )
 41    description: str | None = Field(
 42        default=None,
 43        description="Optional description or purpose statement for the thread. `null` if not set.",
 44    )
 45    id: str = Field(..., description="Thread ID (`thr_...`).")
 46    is_channel: bool | None = Field(
 47        default=None,
 48        description="Whether this thread operates as a channel a multi-member broadcast-style conversation.",
 49    )
 50    is_default: bool | None = Field(
 51        default=None,
 52        description="Whether this is the default thread for its owner. Each user or team has at most one default thread.",
 53    )
 54    is_transient: bool | None = Field(
 55        default=None,
 56        description="Whether this thread is ephemeral and may be deleted automatically after a period of inactivity or when its TTL expires.",
 57    )
 58    is_unlisted: bool | None = Field(
 59        default=None,
 60        description="Whether this thread is hidden from public discovery. Unlisted threads are accessible only to direct participants.",
 61    )
 62    key: str | None = Field(
 63        default=None,
 64        description="Application-defined stable key that uniquely identifies the thread within its scope. Useful for idempotent creation. `null` if not set.",
 65    )
 66    last_activity: datetime | None = Field(
 67        default=None,
 68        description="When the last message or activity occurred in this thread. Present only when activity enrichment is requested.",
 69    )
 70    metadata: dict[str, Any] | None = Field(
 71        default=None,
 72        description="Arbitrary key-value metadata attached to the thread. Shape is application-defined; `null` if no metadata has been set.",
 73    )
 74    muted: bool | None = Field(
 75        default=None,
 76        description="Whether the authenticated user has muted notifications for this thread. `true` suppresses all notification delivery.",
 77    )
 78    org: str | None = Field(
 79        default=None,
 80        description="ID of the organization this thread belongs to (`org_...`). `null` for threads outside an org context.",
 81    )
 82    parent_message: Message | None = Field(
 83        default=None,
 84        description="The message that spawned this thread as a sub-thread. `null` for top-level threads.",
 85    )
 86    participant: list[str] | None = Field(
 87        default=None,
 88        description="Array of participant user IDs (`usr_...`) who are members of this thread.",
 89    )
 90    participants: list[User] | None = Field(
 91        default=None,
 92        description="Expanded participant user objects for each member of this thread. Populated only when the association is loaded.",
 93    )
 94    participating_actor: list[str] | None = Field(
 95        default=None,
 96        description="Composite actor identifiers for all participants currently active in this thread. Present only when actor enrichment is requested.",
 97    )
 98    participating_agents: list[Agent] | None = Field(
 99        default=None,
100        description="Expanded agent objects for all agents participating in this thread. Present only when agent enrichment is requested.",
101    )
102    role: str | None = Field(
103        default=None,
104        description='The authenticated user\'s membership role in this thread, e.g. `"owner"`, `"member"`, or `"viewer"`. `null` if the user is not a member.',
105    )
106    sandbox: str | None = Field(
107        default=None,
108        description="ID of the developer sandbox this thread is scoped to (`sbx_...`). `null` for production threads.",
109    )
110    settings: ThreadSettings | None = Field(
111        default=None,
112        description="Per-thread configuration settings controlling AI agent behavior for this thread.",
113    )
114    slug: str | None = Field(
115        default=None,
116        description="URL-safe slug for the thread, used in human-readable permalinks. `null` if not assigned.",
117    )
118    sub_threads: list[dict[str, Any]] | None = Field(
119        default=None,
120        description="Threads that are nested under this thread as replies to a parent message. Present only when sub-thread enrichment is requested.",
121    )
122    team: str | None = Field(
123        default=None,
124        description="ID of the team that owns this thread (`team_...`). `null` for user-owned or agent-owned threads.",
125    )
126    title: str | None = Field(
127        default=None,
128        description="Human-readable name of the thread. `null` if no title has been set.",
129    )
130    ttl: int | None = Field(
131        default=None,
132        description="Time-to-live in seconds after which the thread may be automatically cleaned up. `null` if the thread does not expire.",
133    )
134    unread_count: int | None = Field(
135        default=None,
136        description="Number of messages in this thread that the authenticated user has not yet read. Present only when read-state enrichment is requested.",
137    )
138    updated_at: datetime | None = Field(
139        default=None, description="When the thread was last modified (ISO 8601)."
140    )
141    user: str | None = Field(
142        default=None,
143        description="ID of the user who owns this thread (`usr_...`). `null` for team-owned or agent-owned threads.",
144    )
145
146
147class ThreadMember(BaseModel):
148    """
149    A user's membership record in a thread, capturing their role and full user profile.
150    """
151
152    membership_type: str | None = Field(
153        default=None,
154        description='Role of the member within the thread. One of `"owner"` (the user who created or was granted ownership) or `"member"` (a regular participant).',
155    )
156    thread: str | None = Field(
157        default=None, description="ID of the thread this membership belongs to (`thr_...`)."
158    )
159    user: User | None = Field(
160        default=None,
161        description="Full user object for the member (`usr_...`). Present when the association is preloaded; `null` otherwise.",
162    )
163
164
165class ThreadReadStatus(BaseModel):
166    """
167    The read status of a thread for a specific user, indicating how far they have read and how many messages remain unread.
168    """
169
170    last_read_message: str | None = Field(
171        default=None,
172        description="Message ID (`msg_...`) of the last message the user has read in this thread. `null` if the user has never read any message in the thread.",
173    )
174    thread: str = Field(..., description="Thread ID (`thr_...`) that this read status belongs to.")
175    unread_count: int = Field(
176        ..., description="Number of messages in the thread that the user has not yet read."
177    )
class ThreadSettings(pydantic.main.BaseModel):
15class ThreadSettings(BaseModel):
16    """
17    Configuration settings for a thread that control AI agent behavior and other thread-level preferences.
18    """
19
20    agent_enabled: bool | None = Field(
21        default=None,
22        description="Whether the AI agent is active for this thread. `true` enables AI responses; `false` disables them. Defaults to `true` when settings have not been explicitly configured.",
23    )

Configuration settings for a thread that control AI agent behavior and other thread-level preferences.

agent_enabled: bool | None = None

Whether the AI agent is active for this thread. true enables AI responses; false disables them. Defaults to true when settings have not been explicitly configured.

class Thread(pydantic.main.BaseModel):
 26class Thread(BaseModel):
 27    """
 28    A chat thread, representing a conversation channel that can be owned by a user, team, or agent and may contain messages, participants, and AI agent activity.
 29    """
 30
 31    agent_user: str | None = Field(
 32        default=None,
 33        description="ID of the agent that owns this thread (`agt_...`). `null` for user-owned or team-owned threads.",
 34    )
 35    created_at: datetime | None = Field(
 36        default=None, description="When the thread was created (ISO 8601)."
 37    )
 38    creator: User | None = Field(
 39        default=None,
 40        description="Expanded user object for the user who created this thread. Populated only when the association is loaded.",
 41    )
 42    description: str | None = Field(
 43        default=None,
 44        description="Optional description or purpose statement for the thread. `null` if not set.",
 45    )
 46    id: str = Field(..., description="Thread ID (`thr_...`).")
 47    is_channel: bool | None = Field(
 48        default=None,
 49        description="Whether this thread operates as a channel a multi-member broadcast-style conversation.",
 50    )
 51    is_default: bool | None = Field(
 52        default=None,
 53        description="Whether this is the default thread for its owner. Each user or team has at most one default thread.",
 54    )
 55    is_transient: bool | None = Field(
 56        default=None,
 57        description="Whether this thread is ephemeral and may be deleted automatically after a period of inactivity or when its TTL expires.",
 58    )
 59    is_unlisted: bool | None = Field(
 60        default=None,
 61        description="Whether this thread is hidden from public discovery. Unlisted threads are accessible only to direct participants.",
 62    )
 63    key: str | None = Field(
 64        default=None,
 65        description="Application-defined stable key that uniquely identifies the thread within its scope. Useful for idempotent creation. `null` if not set.",
 66    )
 67    last_activity: datetime | None = Field(
 68        default=None,
 69        description="When the last message or activity occurred in this thread. Present only when activity enrichment is requested.",
 70    )
 71    metadata: dict[str, Any] | None = Field(
 72        default=None,
 73        description="Arbitrary key-value metadata attached to the thread. Shape is application-defined; `null` if no metadata has been set.",
 74    )
 75    muted: bool | None = Field(
 76        default=None,
 77        description="Whether the authenticated user has muted notifications for this thread. `true` suppresses all notification delivery.",
 78    )
 79    org: str | None = Field(
 80        default=None,
 81        description="ID of the organization this thread belongs to (`org_...`). `null` for threads outside an org context.",
 82    )
 83    parent_message: Message | None = Field(
 84        default=None,
 85        description="The message that spawned this thread as a sub-thread. `null` for top-level threads.",
 86    )
 87    participant: list[str] | None = Field(
 88        default=None,
 89        description="Array of participant user IDs (`usr_...`) who are members of this thread.",
 90    )
 91    participants: list[User] | None = Field(
 92        default=None,
 93        description="Expanded participant user objects for each member of this thread. Populated only when the association is loaded.",
 94    )
 95    participating_actor: list[str] | None = Field(
 96        default=None,
 97        description="Composite actor identifiers for all participants currently active in this thread. Present only when actor enrichment is requested.",
 98    )
 99    participating_agents: list[Agent] | None = Field(
100        default=None,
101        description="Expanded agent objects for all agents participating in this thread. Present only when agent enrichment is requested.",
102    )
103    role: str | None = Field(
104        default=None,
105        description='The authenticated user\'s membership role in this thread, e.g. `"owner"`, `"member"`, or `"viewer"`. `null` if the user is not a member.',
106    )
107    sandbox: str | None = Field(
108        default=None,
109        description="ID of the developer sandbox this thread is scoped to (`sbx_...`). `null` for production threads.",
110    )
111    settings: ThreadSettings | None = Field(
112        default=None,
113        description="Per-thread configuration settings controlling AI agent behavior for this thread.",
114    )
115    slug: str | None = Field(
116        default=None,
117        description="URL-safe slug for the thread, used in human-readable permalinks. `null` if not assigned.",
118    )
119    sub_threads: list[dict[str, Any]] | None = Field(
120        default=None,
121        description="Threads that are nested under this thread as replies to a parent message. Present only when sub-thread enrichment is requested.",
122    )
123    team: str | None = Field(
124        default=None,
125        description="ID of the team that owns this thread (`team_...`). `null` for user-owned or agent-owned threads.",
126    )
127    title: str | None = Field(
128        default=None,
129        description="Human-readable name of the thread. `null` if no title has been set.",
130    )
131    ttl: int | None = Field(
132        default=None,
133        description="Time-to-live in seconds after which the thread may be automatically cleaned up. `null` if the thread does not expire.",
134    )
135    unread_count: int | None = Field(
136        default=None,
137        description="Number of messages in this thread that the authenticated user has not yet read. Present only when read-state enrichment is requested.",
138    )
139    updated_at: datetime | None = Field(
140        default=None, description="When the thread was last modified (ISO 8601)."
141    )
142    user: str | None = Field(
143        default=None,
144        description="ID of the user who owns this thread (`usr_...`). `null` for team-owned or agent-owned threads.",
145    )

A chat thread, representing a conversation channel that can be owned by a user, team, or agent and may contain messages, participants, and AI agent activity.

agent_user: str | None = None

ID of the agent that owns this thread (agt_...). null for user-owned or team-owned threads.

created_at: datetime.datetime | None = None

When the thread was created (ISO 8601).

creator: archastro.platform.types.users.User | None = None

Expanded user object for the user who created this thread. Populated only when the association is loaded.

description: str | None = None

Optional description or purpose statement for the thread. null if not set.

id: str = PydanticUndefined

Thread ID (thr_...).

is_channel: bool | None = None

Whether this thread operates as a channel a multi-member broadcast-style conversation.

is_default: bool | None = None

Whether this is the default thread for its owner. Each user or team has at most one default thread.

is_transient: bool | None = None

Whether this thread is ephemeral and may be deleted automatically after a period of inactivity or when its TTL expires.

is_unlisted: bool | None = None

Whether this thread is hidden from public discovery. Unlisted threads are accessible only to direct participants.

key: str | None = None

Application-defined stable key that uniquely identifies the thread within its scope. Useful for idempotent creation. null if not set.

last_activity: datetime.datetime | None = None

When the last message or activity occurred in this thread. Present only when activity enrichment is requested.

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

Arbitrary key-value metadata attached to the thread. Shape is application-defined; null if no metadata has been set.

muted: bool | None = None

Whether the authenticated user has muted notifications for this thread. true suppresses all notification delivery.

org: str | None = None

ID of the organization this thread belongs to (org_...). null for threads outside an org context.

parent_message: archastro.platform.types.common.Message | None = None

The message that spawned this thread as a sub-thread. null for top-level threads.

participant: list[str] | None = None

Array of participant user IDs (usr_...) who are members of this thread.

participants: list[archastro.platform.types.users.User] | None = None

Expanded participant user objects for each member of this thread. Populated only when the association is loaded.

participating_actor: list[str] | None = None

Composite actor identifiers for all participants currently active in this thread. Present only when actor enrichment is requested.

participating_agents: list[archastro.platform.types.common.Agent] | None = None

Expanded agent objects for all agents participating in this thread. Present only when agent enrichment is requested.

role: str | None = None

The authenticated user's membership role in this thread, e.g. "owner", "member", or "viewer". null if the user is not a member.

sandbox: str | None = None

ID of the developer sandbox this thread is scoped to (sbx_...). null for production threads.

settings: ThreadSettings | None = None

Per-thread configuration settings controlling AI agent behavior for this thread.

slug: str | None = None

URL-safe slug for the thread, used in human-readable permalinks. null if not assigned.

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

Threads that are nested under this thread as replies to a parent message. Present only when sub-thread enrichment is requested.

team: str | None = None

ID of the team that owns this thread (team_...). null for user-owned or agent-owned threads.

title: str | None = None

Human-readable name of the thread. null if no title has been set.

ttl: int | None = None

Time-to-live in seconds after which the thread may be automatically cleaned up. null if the thread does not expire.

unread_count: int | None = None

Number of messages in this thread that the authenticated user has not yet read. Present only when read-state enrichment is requested.

updated_at: datetime.datetime | None = None

When the thread was last modified (ISO 8601).

user: str | None = None

ID of the user who owns this thread (usr_...). null for team-owned or agent-owned threads.

class ThreadMember(pydantic.main.BaseModel):
148class ThreadMember(BaseModel):
149    """
150    A user's membership record in a thread, capturing their role and full user profile.
151    """
152
153    membership_type: str | None = Field(
154        default=None,
155        description='Role of the member within the thread. One of `"owner"` (the user who created or was granted ownership) or `"member"` (a regular participant).',
156    )
157    thread: str | None = Field(
158        default=None, description="ID of the thread this membership belongs to (`thr_...`)."
159    )
160    user: User | None = Field(
161        default=None,
162        description="Full user object for the member (`usr_...`). Present when the association is preloaded; `null` otherwise.",
163    )

A user's membership record in a thread, capturing their role and full user profile.

membership_type: str | None = None

Role of the member within the thread. One of "owner" (the user who created or was granted ownership) or "member" (a regular participant).

thread: str | None = None

ID of the thread this membership belongs to (thr_...).

Full user object for the member (usr_...). Present when the association is preloaded; null otherwise.

class ThreadReadStatus(pydantic.main.BaseModel):
166class ThreadReadStatus(BaseModel):
167    """
168    The read status of a thread for a specific user, indicating how far they have read and how many messages remain unread.
169    """
170
171    last_read_message: str | None = Field(
172        default=None,
173        description="Message ID (`msg_...`) of the last message the user has read in this thread. `null` if the user has never read any message in the thread.",
174    )
175    thread: str = Field(..., description="Thread ID (`thr_...`) that this read status belongs to.")
176    unread_count: int = Field(
177        ..., description="Number of messages in the thread that the user has not yet read."
178    )

The read status of a thread for a specific user, indicating how far they have read and how many messages remain unread.

last_read_message: str | None = None

Message ID (msg_...) of the last message the user has read in this thread. null if the user has never read any message in the thread.

thread: str = PydanticUndefined

Thread ID (thr_...) that this read status belongs to.

unread_count: int = PydanticUndefined

Number of messages in the thread that the user has not yet read.