Skip to content

Thread info

Thread metadata and status tracking for agent graphs.

This module defines the ThreadInfo model, which tracks thread identity, user, metadata, status, and timestamps for agent graph execution and orchestration.

Classes:

Name Description
ThreadInfo

Metadata and status for a thread in agent execution.

Classes

ThreadInfo

Bases: BaseModel

Metadata and status for a thread in agent execution.

Attributes:

Name Type Description
thread_id int | str

Unique identifier for the thread.

thread_name str | None

Optional name for the thread.

user_id int | str | None

Optional user identifier associated with the thread.

metadata dict[str, Any] | None

Optional metadata for the thread.

updated_at datetime | None

Timestamp of last update.

stop_requested bool

Whether a stop has been requested for the thread.

run_id str | None

Optional run identifier for the thread execution.

Example

ThreadInfo(thread_id=1, thread_name="main", user_id=42)

Source code in pyagenity/utils/thread_info.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class ThreadInfo(BaseModel):
    """
    Metadata and status for a thread in agent execution.

    Attributes:
        thread_id (int | str): Unique identifier for the thread.
        thread_name (str | None): Optional name for the thread.
        user_id (int | str | None): Optional user identifier associated with the thread.
        metadata (dict[str, Any] | None): Optional metadata for the thread.
        updated_at (datetime | None): Timestamp of last update.
        stop_requested (bool): Whether a stop has been requested for the thread.
        run_id (str | None): Optional run identifier for the thread execution.

    Example:
        >>> ThreadInfo(thread_id=1, thread_name="main", user_id=42)
    """

    thread_id: int | str
    thread_name: str | None = None
    user_id: int | str | None = None
    metadata: dict[str, Any] | None = None
    updated_at: datetime | None = None
    run_id: str | None = None

Attributes

metadata class-attribute instance-attribute
metadata = None
run_id class-attribute instance-attribute
run_id = None
thread_id instance-attribute
thread_id
thread_name class-attribute instance-attribute
thread_name = None
updated_at class-attribute instance-attribute
updated_at = None
user_id class-attribute instance-attribute
user_id = None