Tela SDK for JavaScript
    Preparing search index...

    Class Agents

    Agents API resource.

    const tela = new TelaSDK({ apiKey: '...' })

    // Start a session by agent id (`POST /agent/:id/run`).
    const { sessionId } = await tela.agents.run({
    agentId: 'agent-123',
    message: 'Summarize the latest tickets',
    inputs: {
    report: tela.createFile('https://example.com/q3.pdf'),
    notes: { type: 'text', content: 'Focus on churn.' },
    },
    })

    // Stream / inspect / cancel by session id (agent-sdk pass-through).
    for await (const event of await tela.agents.streamSession(sessionId))
    console.log(event.kind)
    const timeline = await tela.agents.fetchTimeline(sessionId)
    Index

    Constructors

    Properties

    cancelSession: (sessionId: string) => Promise<{} | {}>

    Cancels a running session. Pass-through to the agent-sdk client (POST /v4/sessions/:id/cancel).

    fetchTimeline: (
        sessionId: string,
        options?: FetchTimelineOptions,
    ) => Promise<{}>

    Fetches the session timeline summary. Pass-through to the agent-sdk client (GET /v4/sessions/:id/timeline).

    resolveReference: {
        (reference: string, options?: {}): Promise<ArrayBuffer>;
        (reference: string, options: {}): Promise<ReadableStream<Uint8Array>>;
        <T = unknown>(reference: string, options: {}): Promise<T>;
    }

    Resolves a vault:// reference to bytes/stream/json. Pass-through to the agent-sdk client.

    streamSession: (
        sessionId: string,
        options?: StreamSessionOptions,
    ) => Promise<AsyncIterable<{} | {} | {} | {} | {}, any, any>>

    Streams a session's events. Pass-through to the agent-sdk client (GET /v4/sessions/:id).

    Methods

    • Fetches an agent record by id via the Tela gateway (GET /agent/:id).

      Parameters

      • agentId: string

      Returns Promise<AgentRecord>

    • Starts (or continues) an agent session via the Tela gateway (POST /agent/:id/run).

      • New session: pass agentId (+ message).
      • Continue: pass agentId and the existing sessionId.

      The per-variable inputs map is flattened into the wire inputSchema array (each entry tagged with its variable name); any TelaFile inputs are uploaded to the vault first. Returns the sessionId to stream/inspect.

      Parameters

      Returns Promise<{} | {}>

    • Updates an agent's model, delegating to the agent-sdk client (PUT /v4/agents/:repository/model). The agentId is resolved to the underlying repository first.

      Parameters

      Returns Promise<{} | {}>