Skip to content

Class: AGB ​

Overview ​

The main AGB module provides the core functionality for creating and managing sessions with the AGB cloud platform. It serves as the entry point for all SDK operations.

Main class for interacting with the AGB cloud runtime environment. Use this class to create, list, and manage sessions.

Table of contents ​

Properties ​

Methods ​

Properties ​

typescript
apiKey: `string`
client: ``Client``
config: ``Config``
context: [`ContextService`](data_context/context.md)

Methods ​

create ​

▸ create(params?): Promise<SessionResult>

Create a new session in the AGB cloud environment.

Parameters ​

NameTypeDescription
params?null | CreateSessionParamsParameters for creating the session (imageId is required)

Returns ​

Promise<SessionResult>

Promise resolving to SessionResult with success, session, requestId, and optional errorMessage

Example

typescript
const agb = new AGB({ apiKey: 'your_api_key' });
const result = await agb.create({ imageId: 'agb-code-space-1' });
if (result.success && result.session) {
  await result.session.file.readFile('/etc/hostname');
  await agb.delete(result.session);
}

delete ​

▸ delete(session, syncContext?): Promise<DeleteResult>

Delete (release) a session.

Parameters ​

NameTypeDefault valueDescription
sessionSessionundefinedThe session to delete
syncContextbooleanfalseIf true, sync context before releasing (e.g. upload browser data)

Returns ​

Promise<DeleteResult>

Promise resolving to DeleteResult with success and requestId


get ​

▸ get(sessionId): Promise<SessionResult>

Get a Session instance by session ID.

Parameters ​

NameTypeDescription
sessionIdstringThe session ID

Returns ​

Promise<SessionResult>

Promise resolving to SessionResult with a Session object or error

list ​

▸ list(labels?, page?, limit?): Promise<SessionListResult>

List sessions filtered by labels with pagination.

Parameters ​

NameTypeDescription
labels?Record<string, string>Optional key-value pairs to filter sessions
page?numberPage number (1-based). If provided, fetches that page.
limit?numberMaximum number of sessions per page (default 10)

Returns ​

Promise<SessionListResult>

Promise resolving to SessionListResult with sessionIds, nextToken, totalCount, etc.


toJSON ​

▸ toJSON(): Record<string, unknown>

Serialize client configuration to a plain object.

Returns ​

Record<string, unknown>

Object with endpoint and timeoutMs