Class: Session
Session class.
Maintains conversation history by keeping the same Robota agent across multiple run() calls. The session ID is stable for the lifetime of the object.
Table of contents
Constructors
Methods
- run
- getPermissionMode
- setPermissionMode
- getSessionId
- getMessageCount
- getSessionAllowedTools
- clearSessionAllowedTools
- abort
- isRunning
- getContextState
- compact
- clearHistory
- getHistory
Constructors
constructor
• new Session(options): Session
Parameters
| Name | Type |
|---|---|
options | ISessionOptions |
Returns
Defined in
agent-sessions/dist/node/index.d.ts:254
Methods
run
▸ run(message): Promise<string>
Send a message to the agent and return the response.
Parameters
| Name | Type |
|---|---|
message | string |
Returns
Promise<string>
Defined in
agent-sessions/dist/node/index.d.ts:260
getPermissionMode
▸ getPermissionMode(): TPermissionMode
Return the active permission mode
Returns
Defined in
agent-sessions/dist/node/index.d.ts:266
setPermissionMode
▸ setPermissionMode(mode): void
Change the active permission mode. Future tool calls will be evaluated against the new mode.
Parameters
| Name | Type |
|---|---|
mode | TPermissionMode |
Returns
void
Defined in
agent-sessions/dist/node/index.d.ts:271
getSessionId
▸ getSessionId(): string
Return the stable session identifier
Returns
string
Defined in
agent-sessions/dist/node/index.d.ts:273
getMessageCount
▸ getMessageCount(): number
Return the number of run() calls completed
Returns
number
Defined in
agent-sessions/dist/node/index.d.ts:275
getSessionAllowedTools
▸ getSessionAllowedTools(): string[]
Get tools that have been session-approved (via "Allow always" choice).
Returns
string[]
Defined in
agent-sessions/dist/node/index.d.ts:277
clearSessionAllowedTools
▸ clearSessionAllowedTools(): void
Clear all session-scoped allow rules.
Returns
void
Defined in
agent-sessions/dist/node/index.d.ts:279
abort
▸ abort(): void
Abort the currently running execution. No-op if nothing is running.
Returns
void
Defined in
agent-sessions/dist/node/index.d.ts:281
isRunning
▸ isRunning(): boolean
Whether a run() call is currently in progress.
Returns
boolean
Defined in
agent-sessions/dist/node/index.d.ts:283
getContextState
▸ getContextState(): IContextWindowState
Get current context window state
Returns
IContextWindowState
Defined in
agent-sessions/dist/node/index.d.ts:285
compact
▸ compact(instructions?): Promise<void>
Run compaction — summarize the conversation to free context space.
Parameters
| Name | Type | Description |
|---|---|---|
instructions? | string | Optional focus instructions for the summary |
Returns
Promise<void>
Defined in
agent-sessions/dist/node/index.d.ts:290
clearHistory
▸ clearHistory(): void
Clear conversation history
Returns
void
Defined in
agent-sessions/dist/node/index.d.ts:292
getHistory
▸ getHistory(): TUniversalMessage[]
Get conversation history
Returns
TUniversalMessage[]
Defined in
agent-sessions/dist/node/index.d.ts:294