Skip to content

agent-sdk / Exports / Session

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

Constructors

constructor

new Session(options): Session

Parameters

NameType
optionsISessionOptions

Returns

Session

Defined in

packages/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

NameType
messagestring

Returns

Promise<string>

Defined in

packages/agent-sessions/dist/node/index.d.ts:260


getPermissionMode

getPermissionMode(): TPermissionMode

Return the active permission mode

Returns

TPermissionMode

Defined in

packages/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

NameType
modeTPermissionMode

Returns

void

Defined in

packages/agent-sessions/dist/node/index.d.ts:271


getSessionId

getSessionId(): string

Return the stable session identifier

Returns

string

Defined in

packages/agent-sessions/dist/node/index.d.ts:273


getMessageCount

getMessageCount(): number

Return the number of run() calls completed

Returns

number

Defined in

packages/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

packages/agent-sessions/dist/node/index.d.ts:277


clearSessionAllowedTools

clearSessionAllowedTools(): void

Clear all session-scoped allow rules.

Returns

void

Defined in

packages/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

packages/agent-sessions/dist/node/index.d.ts:281


isRunning

isRunning(): boolean

Whether a run() call is currently in progress.

Returns

boolean

Defined in

packages/agent-sessions/dist/node/index.d.ts:283


getContextState

getContextState(): IContextWindowState

Get current context window state

Returns

IContextWindowState

Defined in

packages/agent-sessions/dist/node/index.d.ts:285


compact

compact(instructions?): Promise<void>

Run compaction — summarize the conversation to free context space.

Parameters

NameTypeDescription
instructions?stringOptional focus instructions for the summary

Returns

Promise<void>

Defined in

packages/agent-sessions/dist/node/index.d.ts:290


clearHistory

clearHistory(): void

Clear conversation history

Returns

void

Defined in

packages/agent-sessions/dist/node/index.d.ts:292


getHistory

getHistory(): TUniversalMessage[]

Get conversation history

Returns

TUniversalMessage[]

Defined in

packages/agent-sessions/dist/node/index.d.ts:294

Released under the MIT License.