@archastro/sdk
    Preparing search index...
    Index

    Constructors

    Properties

    settings: SettingResource

    Methods

    • List agents in a thread Returns the agents participating in the specified thread. Only personal user threads (threads owned by a single user, not a team) expose agents through this endpoint; requests for team threads return 404. The authenticated user must have visibility into the thread. Each agent entry includes display information such as name and profile picture. Thread-level overrides (e.g. a custom name or profile picture set for this thread) take precedence over the agent's default values. When the caller is the thread owner, each entry also includes an agent_config object describing the agent's message policy and context configuration.

      Parameters

      • thread: string

        Thread ID (thr_...). Must be a personal user thread visible to the authenticated user.

      Returns Promise<{ data: Record<string, unknown>[] }>

      Successful response

    • List artifacts for a thread Returns all artifacts produced during a thread's AI conversation. Artifacts are structured outputs such as code files, documents, or generated assets created by the AI agent in response to messages in the thread. The authenticated user must have access to the specified thread. Results are returned in a single page; there is no cursor-based pagination for this endpoint.

      Parameters

      • thread: string

        Thread ID (thr_...). Must be accessible to the authenticated user.

      Returns Promise<
          {
              data: {
                  agent?: string;
                  content_type?: string;
                  created_at?: string;
                  current_version?: string;
                  description?: string;
                  file?: string;
                  file_name?: string;
                  file_url?: string;
                  id: string;
                  image_source?: {
                      file?: string
                      | null;
                      height?: number | null;
                      media?: string | null;
                      mime_type?: string | null;
                      refresh_url?: string | null;
                      url?: string | null;
                      width?: number | null;
                  };
                  name?: string;
                  org?: string;
                  sandbox?: string;
                  team?: string;
                  thread?: string;
                  updated_at?: string;
                  user?: string;
                  version?: number;
              }[];
          },
      >

      Successful response

    • Delete a thread Permanently deletes a thread and all of its messages and artifacts. This action cannot be undone. The authenticated user must own the thread or be an owner of the team the thread belongs to. Attempting to delete a thread owned by another user or team returns 403.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must own this thread.

      Returns Promise<void>

      Empty response on successful deletion.

    • Retrieve a thread Returns the full thread record for the given thread ID. The authenticated user must own the thread or be a member of the workspace it belongs to. Use this endpoint to fetch the current state of a single thread, including its title, description, and metadata. To list many threads, use the list endpoint with cursor-based pagination.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must have access to this thread.

      Returns Promise<Thread>

      The requested thread object.

    • Mark a thread as read Records that a user has read up to a specific message in the thread. Unread indicators and badge counts are cleared up to the specified message. You must supply exactly one of last_read_message or use_latest_message. Omitting both returns 400. If use_latest_message is true and the thread has no messages, the request succeeds silently with no state change. For server-to-server (S2S) requests where no user identity is present in the token, the user param is required to identify whose read state to update.

      Parameters

      • thread: string

        Thread ID (thr_...). The thread to mark as read.

      • input: { last_read_message?: string; use_latest_message?: boolean; user?: string }

        Request body.

        • Optionallast_read_message?: string

          Message ID (msg_...) to record as the last read message. Mutually exclusive with use_latest_message.

        • Optionaluse_latest_message?: boolean

          When true, marks the thread as read up to the latest message. Mutually exclusive with last_read_message.

        • Optionaluser?: string

          User ID (usr_...) whose read state to update. Required for S2S requests; ignored when an authenticated user is present in the token.

      Returns Promise<void>

      Empty response on success.

    • List messages in a thread Returns a cursor-paginated list of messages belonging to the specified thread, ordered from oldest to newest. Supply before_cursor, after_cursor, or both to page through or bound the result set; omit both to receive the most recent page. Supply anchor and direction to fetch a window before, after, or around a specific message. Use anchor=last_matching&anchor_agent_mode=embedded to resolve the anchor from the latest embedded-agent message, and add anchor_agent to scope that resolution to a single sender agent. Supply metadata as a JSON-encoded structured expression to filter message metadata before cursor pagination or anchored window limits are applied. The authenticated user must have access to the thread's owner (workspace or user). A 403 is returned if the thread exists but is not accessible to the caller; a 404 is returned if the thread does not exist or is not visible to the authenticated user. Pass include_reply_counts: true to annotate each message with the number of threaded replies it has received. This adds a small amount of latency and should be omitted when reply counts are not needed.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must have access to this thread.

      • Optionalparams: {
            afterCursor?: string;
            afterLimit?: number;
            anchor?: string;
            anchorAgent?: string;
            anchorAgentMode?: "cli" | "embedded";
            beforeCursor?: string;
            beforeLimit?: number;
            direction?: "before" | "after" | "around";
            includeAnchor?: boolean;
            includeReplyCounts?: boolean;
            limit?: number;
            metadata?: {
                clause?: Record<string, unknown>;
                clauses?: Record<string, unknown>[];
                key?: string;
                operator?: "and" | "or" | "eq" | "contains" | "exists" | "not";
                path?: string[];
                type?: string;
                value?: unknown;
            };
        }

        Query parameters.

        • OptionalafterCursor?: string

          Opaque cursor returned in a previous response's after_cursor field. When provided, returns messages immediately after that position. May be combined with before_cursor to bound a range.

        • OptionalafterLimit?: number

          For direction=around, maximum number of messages newer than the anchor. Defaults to 20; maximum is 100.

        • Optionalanchor?: string

          Message ID (msg_...) to use as a window anchor, or last_matching to resolve the anchor from the latest message matching the anchor filters. Cannot be combined with before_cursor or after_cursor.

        • OptionalanchorAgent?: string

          When anchor=last_matching, scope the anchor resolution to messages sent by this agent (agi_...). Combine with anchor_agent_mode to resolve the latest message from a specific agent in a given mode.

        • OptionalanchorAgentMode?: "cli" | "embedded"

          When anchor=last_matching, resolve the anchor from the latest message with this local agent execution mode.

        • OptionalbeforeCursor?: string

          Opaque cursor returned in a previous response's before_cursor field. When provided, returns messages immediately before that position. May be combined with after_cursor to bound a range.

        • OptionalbeforeLimit?: number

          For direction=around, maximum number of messages older than the anchor. Defaults to 20; maximum is 100.

        • Optionaldirection?: "before" | "after" | "around"

          Window direction relative to anchor. before returns older messages, after returns newer messages, and around returns messages on both sides. Defaults to after when anchor is supplied. direction=around cannot be combined with an explicit limit; use before_limit and after_limit.

        • OptionalincludeAnchor?: boolean

          Whether to include the anchor message in a window response. Defaults to true for direction=around; ignored for ordinary cursor pagination and one-sided windows.

        • OptionalincludeReplyCounts?: boolean

          When true, each message in the response is annotated with its threaded reply count. Defaults to false. Adds latency; omit when reply counts are not needed.

        • Optionallimit?: number

          Maximum number of messages to return per page. Defaults to 20; maximum is 100.

        • Optionalmetadata?: {
              clause?: Record<string, unknown>;
              clauses?: Record<string, unknown>[];
              key?: string;
              operator?: "and" | "or" | "eq" | "contains" | "exists" | "not";
              path?: string[];
              type?: string;
              value?: unknown;
          }

          Structured metadata filter expression. Only messages whose metadata object satisfies the expression are returned. The filter is applied before cursor pagination and anchored window limits.

      Returns Promise<
          {
              data: {
                  after_cursor?: string
                  | null;
                  anchor?: string | null;
                  before_cursor?: string | null;
                  messages: {
                      acl?:
                          | {
                              add?: {
                                  actions: (...)[];
                                  principal?: (...) | (...);
                                  principal_type: string;
                              }[];
                              grants?: {
                                  actions: (...)[];
                                  principal?: (...) | (...);
                                  principal_type: string;
                              }[];
                              remove?: { principal?: (...)
                              | (...); principal_type: string }[];
                          }
                          | null;
                      actors?: {
                          alias?: string
                          | null;
                          id?: string | null;
                          name?: string | null;
                          profile_picture?:
                              | {
                                  file?: (...)
                                  | (...)
                                  | (...);
                                  height?: (...) | (...) | (...);
                                  media?: (...) | (...) | (...);
                                  mime_type?: (...) | (...) | (...);
                                  refresh_url?: (...) | (...) | (...);
                                  url?: (...) | (...) | (...);
                                  width?: (...) | (...) | (...);
                              }
                              | null;
                      }[];
                      agent?: string
                      | null;
                      agent_mode?: "cli" | "embedded" | null;
                      attachments?: {
                          content_type?: string | null;
                          description?: string | null;
                          filename?: string | null;
                          height?: number | null;
                          id: string;
                          image_height?: number | null;
                          image_source?:
                              | {
                                  file?: (...)
                                  | (...)
                                  | (...);
                                  height?: (...) | (...) | (...);
                                  media?: (...) | (...) | (...);
                                  mime_type?: (...) | (...) | (...);
                                  refresh_url?: (...) | (...) | (...);
                                  url?: (...) | (...) | (...);
                                  width?: (...) | (...) | (...);
                              }
                              | null;
                          image_url?: string
                          | null;
                          image_width?: number | null;
                          media_type?: string;
                          name?: string | null;
                          object?: Record<string, unknown>;
                          title?: string | null;
                          type: string;
                          url?: string | null;
                          variants?: {
                              content_type?: ...;
                              created_at?: ...;
                              file?: ...;
                              filename?: ...;
                              height?: ...;
                              id: ...;
                              image_source?: ...;
                              updated_at?: ...;
                              url?: ...;
                              variant_key?: ...;
                              width?: ...;
                          }[];
                          version?: number
                          | null;
                          width?: number | null;
                      }[];
                      branched_thread?: string
                      | null;
                      content?: string | null;
                      context?: {
                          attributes?: Record<string, unknown>;
                          content?: string | null;
                          title?: string | null;
                          type: string;
                      }[];
                      created_at?: string;
                      has_replies?: boolean;
                      id: string;
                      idempotency_key?: string
                      | null;
                      is_deleted?: boolean;
                      legacy_agent?: string | null;
                      metadata?: Record<string, unknown>;
                      org?: string | null;
                      reactions?: {
                          payload?: Record<string, unknown>;
                          type: string;
                          user?: string;
                      }[];
                      rendering_mode?: string
                      | null;
                      replies?: Record<string, unknown>[];
                      replies_after_cursor?: string | null;
                      replies_before_cursor?: string | null;
                      reply_count?: number;
                      reply_to?: Record<string, unknown> | null;
                      root_message_id?: string | null;
                      sandbox?: string | null;
                      team?: string | null;
                      thread?: string;
                      type?: string | null;
                      user?:
                          | string
                          | {
                              alias?: string
                              | null;
                              app?: string | null;
                              app_name?: string | null;
                              created_by_agent_user?: string | null;
                              created_by_developer?: string | null;
                              created_by_org?: string | null;
                              created_by_team?: string | null;
                              created_by_user?: string | null;
                              email?: string | null;
                              id: string;
                              is_system_user?: boolean;
                              metadata?: Record<string, unknown>;
                              name?: string | null;
                              org?: string | null;
                              org_name?: string | null;
                              org_role?: string | null;
                              org_slug?: string | null;
                              sandbox?: string | null;
                              sandbox_name?: string | null;
                          }
                          | null;
                      visibility?: "default"
                      | "private";
                  }[];
              };
          },
      >

      Successful response

    • Update a thread's profile picture Uploads a new profile picture for the specified thread and returns the updated thread object. The image must be supplied as a base64-encoded string with its MIME type. The authenticated user must own the thread or be a team owner of the workspace the thread belongs to. Supplying invalid base64 data returns 422.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must have permission to update this thread.

      • input: { picture: { data: string; filename: string; mime_type: string } }

        Request body.

        • picture: { data: string; filename: string; mime_type: string }

          Profile picture payload. Must include the base64-encoded image data and its MIME type.

      Returns Promise<Thread>

      The thread object after the profile picture has been updated.

    • Retrieve a thread's read status Returns the read status of a thread for the specified user, including the ID of the last message they have read and the number of unread messages remaining. For user-authenticated requests, the status is always returned for the authenticated user and the user parameter is ignored. For server-to-server (S2S) requests, the user parameter is required and must be a valid user ID. Returns 404 if the thread does not exist or the caller does not have access to it.

      Parameters

      • thread: string

        Thread ID (thr_...). Must be accessible to the authenticated user or, for S2S requests, to the specified user.

      • Optionalparams: { user?: string }

        Query parameters.

        • Optionaluser?: string

          User ID (usr_...) whose read status to retrieve. Required for S2S requests; ignored for user-authenticated requests, which always return the status for the authenticated user.

      Returns Promise<ThreadReadStatus>

      The read status record for the requested thread and user.

    • Update a thread Updates one or more mutable properties of the specified thread and returns the full thread object with the applied changes. Only the fields you provide are modified; omitted fields retain their current values. If profile_picture is supplied, the image is uploaded before the other fields are saved, after all ordinary thread fields have passed validation. Supplying invalid base64 picture data returns 422 and no other fields are updated. Visibility can only widen: private may become restricted or team, and restricted may become team. The authenticated viewer must have permission to modify the thread. Mirror-thread titles, descriptions, and notification state remain editable by privileged app viewers. Mirror metadata, visibility, and membership are provider-managed and cannot be changed through this endpoint.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must have permission to update this thread.

      • input: {
            description?: string;
            metadata?: Record<string, unknown>;
            muted?: boolean;
            profile_picture?: { data?: string; filename?: string; mime_type?: string };
            title?: string;
            visibility?: "team" | "private" | "restricted";
        }

        Request body.

        • Optionaldescription?: string

          Optional longer text describing the thread's purpose. Replaces the existing description when provided.

        • Optionalmetadata?: Record<string, unknown>

          Arbitrary key-value metadata to store on the thread. Merged with or replaces existing metadata.

        • Optionalmuted?: boolean

          When true, suppresses notifications for new messages in this thread for the authenticated user.

        • Optionalprofile_picture?: { data?: string; filename?: string; mime_type?: string }

          New profile picture for the thread. Provide all three inner fields to replace the existing image.

        • Optionaltitle?: string

          Human-readable display name for the thread. Replaces the existing title when provided.

        • Optionalvisibility?: "team" | "private" | "restricted"

          Widen a team-owned thread: private may become restricted or team, and restricted may become team. Visibility cannot be narrowed.

      Returns Promise<Thread>

      The thread object after the update has been applied.

    • Search messages in a thread Searches canonical message content in the specified thread. "text" mode performs the existing case-insensitive substring search, "embedding" ranks stored message embeddings by cosine similarity, and "hybrid" combines the text and embedding rankings with Reciprocal Rank Fusion (RRF). Only messages visible to the authenticated caller are considered. Results are intentionally lean: each row contains only a bounded content snippet, sender identity, and timestamp. Attachments, reactions, ACLs, and metadata are neither hydrated nor serialized. At most 20 results are returned. Text results support chronological cursor pagination. Embedding and hybrid results are relevance-ranked single pages and return null cursors.

      Parameters

      • thread: string

        Thread ID (thr_...). Must be visible to the authenticated caller.

      • Optionalparams: {
            afterCursor?: string;
            app?: string;
            beforeCursor?: string;
            limit?: number;
            mode?: "text" | "embedding" | "hybrid";
            q?: string;
        }

        Query parameters.

        • OptionalafterCursor?: string

          Text mode only. Opaque cursor returned by a previous page; fetches newer matches.

        • Optionalapp?: string

          App ID (app_...). Required by the protected developer mount and omitted from the public mount.

        • OptionalbeforeCursor?: string

          Text mode only. Opaque cursor returned by a previous page; fetches older matches.

        • Optionallimit?: number

          Maximum number of results. Defaults to 20 and is capped at 20.

        • Optionalmode?: "text" | "embedding" | "hybrid"

          Search algorithm: text for substring matching, embedding for cosine similarity, or hybrid for RRF over both rankings.

        • Optionalq?: string

          Text or semantic search query. Must contain 3 to 200 characters after trimming.

      Returns Promise<
          {
              after_cursor?: string;
              before_cursor?: string;
              data: {
                  agent?: string;
                  content: string;
                  created_at: string;
                  id: string;
                  similarity_score?: number;
                  user?: string;
              }[];
              has_more: boolean;
          },
      >

      Successful response

    • List trajectories for a thread Returns a cursor-paginated list of thread message trajectories associated with the specified thread. Each trajectory links a user message and its agent response to the underlying AI trajectory record that captured the model's reasoning steps. The authenticated user must own the thread or be a member of the workspace it belongs to. Results are returned in reverse chronological order by default. Use before_cursor and after_cursor to navigate pages; provide at most one cursor per request. Optionally filter results to trajectories produced in response to a specific message by supplying the message parameter. When no trajectories match the query, data is an empty array and both cursor fields are null. A cursor that cannot be decoded returns a 400 invalid_cursor error.

      Parameters

      • thread: string

        Thread ID (thr_...). The authenticated user must own this thread or belong to its workspace.

      • Optionalparams: {
            afterCursor?: string;
            beforeCursor?: string;
            limit?: number;
            message?: string;
        }

        Query parameters.

        • OptionalafterCursor?: string

          Opaque cursor from a previous response's after_cursor field. Returns the page of results following that cursor position.

        • OptionalbeforeCursor?: string

          Opaque cursor from a previous response's before_cursor field. Returns the page of results preceding that cursor position.

        • Optionallimit?: number

          Maximum number of trajectories to return per page. Defaults to 20; maximum is 100.

        • Optionalmessage?: string

          Message ID (msg_...). When provided, limits results to trajectories associated with this specific message.

      Returns Promise<
          {
              after_cursor?: string
              | null;
              before_cursor?: string | null;
              data: {
                  agent_message?: string | null;
                  created_at?: string;
                  id: string;
                  org?: string | null;
                  sandbox?: string | null;
                  thread?: string;
                  trajectory?: string;
                  updated_at?: string;
                  user_message?: string | null;
              }[];
          },
      >

      Successful response