Claude Platform Docs

スレッド

セッションスレッドの一覧
client.Beta.Sessions.Threads.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionThread], error)
GET/v1/sessions/{session_id}/threads
セッションスレッドを取得
client.Beta.Sessions.Threads.Get(ctx, threadID, params) (*BetaManagedAgentsSessionThread, error)
GET/v1/sessions/{session_id}/threads/{thread_id}
セッションスレッドをアーカイブ
client.Beta.Sessions.Threads.Archive(ctx, threadID, params) (*BetaManagedAgentsSessionThread, error)
POST/v1/sessions/{session_id}/threads/{thread_id}/archive
Models
type BetaManagedAgentsInlineAgent struct { Type: "inline"; Description; ExecutionIdentity; /* 6 more */ }

An agent that has no Agent resource, and so no id or version. It is defined inline, in a workflow run's plan or when a session thread is spawned, and is not saved.

type BetaManagedAgentsSessionThread struct { Type: "session_thread"; ID; Agent; /* 9 more */ }

An execution thread within a session. Each session has one primary thread plus zero or more child threads.

type BetaManagedAgentsSessionThreadStats struct { ActiveSeconds; DurationSeconds; StartupSeconds }

Timing statistics for a session thread.

ActiveSeconds float64 Optional

Cumulative time in seconds the thread spent actively running. Excludes idle time.

formatdouble
DurationSeconds float64 Optional

Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.

formatdouble
StartupSeconds float64 Optional

Time in seconds for the thread to begin running. Zero for child threads, which start immediately.

formatdouble
type BetaManagedAgentsSessionThreadStatus string
One of the following:
const BetaManagedAgentsSessionThreadStatusRunning BetaManagedAgentsSessionThreadStatus = "running"
const BetaManagedAgentsSessionThreadStatusIdle BetaManagedAgentsSessionThreadStatus = "idle"
const BetaManagedAgentsSessionThreadStatusRescheduling BetaManagedAgentsSessionThreadStatus = "rescheduling"
const BetaManagedAgentsSessionThreadStatusTerminated BetaManagedAgentsSessionThreadStatus = "terminated"
type BetaManagedAgentsSessionThreadUsage struct { ActiveSeconds; CacheCreation; CacheReadInputTokens; /* 4 more */ }

Cumulative token usage for a session thread across all turns.

type BetaManagedAgentsStreamSessionThreadEventsUnion interface{…}

Server-sent event in a single thread's stream.

One of the following:

スレッドイベント

セッションスレッドイベントの一覧
client.Beta.Sessions.Threads.Events.List(ctx, threadID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)
GET/v1/sessions/{session_id}/threads/{thread_id}/events
セッションスレッドイベントをストリーミング
client.Beta.Sessions.Threads.Events.StreamEvents(ctx, threadID, params) *ssestream.Stream[BetaManagedAgentsStreamSessionThreadEventsUnion]
GET/v1/sessions/{session_id}/threads/{thread_id}/stream