@usine/core/agent/session
Classes
Section titled “Classes”ChildSession
Section titled “ChildSession”A coding session delegated by the Attempt’s parent; children cannot delegate to further children.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ChildSession(…
args):ChildSession
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyagent:string&Brand<"AgentName">
readonlybrain:BrainSpec
readonlyid:string&Brand<"AgentSessionId">
parentId
Section titled “parentId”
readonlyparentId:string&Brand<"AgentSessionId">
HarnessSession
Section titled “HarnessSession”A saved harness conversation and the worker checkout from which it can be resumed.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HarnessSession(…
args):HarnessSession
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlycwd:string
readonlyid:string&Brand<"HarnessSessionId">
ParentSession
Section titled “ParentSession”The session coordinating an Attempt and delegating work to its coding children.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ParentSession(…
args):ParentSession
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlyagent:string&Brand<"AgentName">
readonlybrain:BrainSpec
readonlyid:string&Brand<"AgentSessionId">
PoolRateLimitsUpdated
Section titled “PoolRateLimitsUpdated”The latest rate windows observed for a billing pool during one session.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PoolRateLimitsUpdated(…
args):PoolRateLimitsUpdated
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”
readonlypool:"apiKeys"|"claudePlan"|"chatgptPlan"
rateLimits
Section titled “rateLimits”
readonlyrateLimits:RateLimitsSnapshot
session
Section titled “session”
readonlysession:ChildSession|ParentSession
RateLimitsSnapshot
Section titled “RateLimitsSnapshot”The allowance windows reported together by a provider; omitted windows remain unknown.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RateLimitsSnapshot(…
args):RateLimitsSnapshot
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”limitId
Section titled “limitId”
readonlylimitId:Option<string>
limitName
Section titled “limitName”
readonlylimitName:Option<string>
primary
Section titled “primary”
readonlyprimary:Option<RateLimitWindow>
secondary
Section titled “secondary”
readonlysecondary:Option<RateLimitWindow>
RateLimitWindow
Section titled “RateLimitWindow”A billing pool’s observed usage for one allowance window.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RateLimitWindow(…
args):RateLimitWindow
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”resetsAt
Section titled “resetsAt”
readonlyresetsAt:Option<Utc>
When the allowance resets; absent when the provider omits it.
usedPercent
Section titled “usedPercent”
readonlyusedPercent:number
Percentage of the allowance already consumed, including usage outside this Attempt.
windowDurationMinutes
Section titled “windowDurationMinutes”
readonlywindowDurationMinutes:Option<number>
Length of the allowance window; absent when the provider omits it.
SessionFinished
Section titled “SessionFinished”Marks the end of a session’s activity in the transcript; the Attempt’s outcome is recorded separately.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SessionFinished(…
args):SessionFinished
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”session
Section titled “session”
readonlysession:ChildSession|ParentSession
SessionIdle
Section titled “SessionIdle”A supervised session finished a turn and remains available for further operator messages.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SessionIdle(…
args):SessionIdle
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”session
Section titled “session”
readonlysession:ChildSession|ParentSession
SessionResumed
Section titled “SessionResumed”A live session is processing another user turn in the same conversation.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SessionResumed(…
args):SessionResumed
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”session
Section titled “session”
readonlysession:ChildSession|ParentSession
SessionStarted
Section titled “SessionStarted”Records the session identity and brain actually selected at launch.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SessionStarted(…
args):SessionStarted
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”harnessSession
Section titled “harnessSession”
readonlyharnessSession:Option<HarnessSession>
Absent for older transcripts and harnesses without a saved conversation.
session
Section titled “session”
readonlysession:ChildSession|ParentSession
SessionTokensUpdated
Section titled “SessionTokensUpdated”Cumulative TokenCount consumed by this session so far, including its later operator turns.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SessionTokensUpdated(…
args):SessionTokensUpdated
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”session
Section titled “session”
readonlysession:ChildSession|ParentSession
totalTokens
Section titled “totalTokens”
readonlytotalTokens:number&Brand<"TokenCount">
TextOutput
Section titled “TextOutput”Completed assistant text emitted during the session, which may precede its final result.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TextOutput(…
args):TextOutput
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”session
Section titled “session”
readonlysession:ChildSession|ParentSession
readonlytext:string
ToolFinished
Section titled “ToolFinished”A tool call returned its output; a tool error does not by itself close the session.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolFinished(…
args):ToolFinished
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”callId
Section titled “callId”
readonlycallId:string
isError
Section titled “isError”
readonlyisError:boolean
output
Section titled “output”
readonlyoutput:Json
session
Section titled “session”
readonlysession:ChildSession|ParentSession
readonlytool:string
ToolStarted
Section titled “ToolStarted”A session began a tool call; callId pairs it with the corresponding result.
Extends
Section titled “Extends”Schema.Class
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolStarted(…
args):ToolStarted
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…args |
[props: object, options?: MakeOptions] |
Returns
Section titled “Returns”Properties
Section titled “Properties”callId
Section titled “callId”
readonlycallId:string
readonlyinput:Json
session
Section titled “session”
readonlysession:ChildSession|ParentSession
readonlytool:string
Type Aliases
Section titled “Type Aliases”AgentSession
Section titled “AgentSession”AgentSession = typeof
AgentSession.Type
A participant in an Attempt, with its role, Agent, and effective brain recorded.
AgentSessionEvent
Section titled “AgentSessionEvent”AgentSessionEvent = typeof
AgentSessionEvent.Type
Session activity and billing observations recorded in an Attempt’s transcript.
AgentSessionId
Section titled “AgentSessionId”AgentSessionId = typeof
AgentSessionId.Type
Identity usine assigns to a parent or child session within an Attempt.
BillingPool
Section titled “BillingPool”BillingPool = typeof
BillingPool.Type
The billing source whose meter produced a usage or rate-limit observation.
ChildSessionBudget
Section titled “ChildSessionBudget”ChildSessionBudget = typeof
ChildSessionBudget.Type
Maximum child sessions one Attempt may spawn over its lifetime, including sequential spawns.
ChildSessionCount
Section titled “ChildSessionCount”ChildSessionCount = typeof
ChildSessionCount.Type
The 1-based child spawn request number within an Attempt, including requests rejected by the budget.
HarnessSessionId
Section titled “HarnessSessionId”HarnessSessionId = typeof
HarnessSessionId.Type
The identity assigned by a harness to its saved conversation, distinct from usine’s session id.
TokenCount
Section titled “TokenCount”TokenCount = typeof
TokenCount.Type
Tokens a session consumed: output tokens plus uncached input tokens (new prompt text and cache writes). Cache reads are excluded, so the count grows with work done rather than with the length of the conversation re-read on every turn. Each harness computes it from its own usage report.
Variables
Section titled “Variables”AgentSession
Section titled “AgentSession”
constAgentSession:Schema.Union<readonly [typeofParentSession, typeofChildSession]>
A participant in an Attempt, with its role, Agent, and effective brain recorded.
AgentSessionEvent
Section titled “AgentSessionEvent”
constAgentSessionEvent:Schema.Union<readonly [typeofSessionStarted, typeofTextOutput, typeofToolStarted, typeofToolFinished, typeofPoolRateLimitsUpdated, typeofSessionFinished, typeofSessionIdle, typeofSessionResumed, typeofSessionTokensUpdated]>
Session activity and billing observations recorded in an Attempt’s transcript.
AgentSessionId
Section titled “AgentSessionId”
constAgentSessionId:Schema.brand<Schema.NonEmptyString,"AgentSessionId">
Identity usine assigns to a parent or child session within an Attempt.
BillingPool
Section titled “BillingPool”
constBillingPool:Schema.Literals<readonly ["apiKeys","claudePlan","chatgptPlan"]>
The billing source whose meter produced a usage or rate-limit observation.
ChildSessionBudget
Section titled “ChildSessionBudget”
constChildSessionBudget:Schema.brand<Schema.Int,"ChildSessionBudget">
Maximum child sessions one Attempt may spawn over its lifetime, including sequential spawns.
ChildSessionCount
Section titled “ChildSessionCount”
constChildSessionCount:Schema.brand<Schema.Int,"ChildSessionCount">
The 1-based child spawn request number within an Attempt, including requests rejected by the budget.
HarnessSessionId
Section titled “HarnessSessionId”
constHarnessSessionId:Schema.brand<Schema.NonEmptyString,"HarnessSessionId">
The identity assigned by a harness to its saved conversation, distinct from usine’s session id.
TokenCount
Section titled “TokenCount”
constTokenCount:Schema.brand<Schema.Int,"TokenCount">
Tokens a session consumed: output tokens plus uncached input tokens (new prompt text and cache writes). Cache reads are excluded, so the count grows with work done rather than with the length of the conversation re-read on every turn. Each harness computes it from its own usage report.