> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-2516.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# WeaveClient

> TypeScript SDK reference

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "View source" : <>
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub source
      </>}
  </a>;

<GitHubLink url="https://github.com/wandb/weave/blob/7c9efdc9fe05ffcaf2430dd652ef9bc5b3ffdfaa/sdks/node/src/weaveClient.ts#L519" />

## Properties

### projectId

> **projectId**: `string`

***

### settings

> **settings**: `object`

#### attributes

> `readonly` **attributes**: `Record`\<`string`, `any`>

A map of attributes applied to every trace produced by this client.

#### genai

> `readonly` **genai**: `object`

##### genai.batchOptions

> `optional` **batchOptions**: `BufferConfig`

`BatchSpanProcessor` configuration. Ignored unless `spanProcessor === 'batch'`.

##### genai.spanProcessor

> `optional` **spanProcessor**: `"batch"` | `"simple"` | `SpanProcessor`

How GenAI spans are exported.

* `'batch'` (default): `BatchSpanProcessor`, suitable for production
  agents and long-lived processes.
* `'simple'`: `SimpleSpanProcessor`, one HTTP POST per span. Useful for
  tests and short-lived CLIs where deterministic flush matters more than
  throughput.
* `SpanProcessor` instance: a user-supplied processor. The caller owns
  its lifecycle; the Weave OTLP exporter targeting `/agents/otel/v1/traces`
  is not used.

#### printCallLink

> `readonly` **printCallLink**: `boolean`

Prints links in terminal to Weave UI for ops.

##### Default

`true`

#### useCallsComplete

> **useCallsComplete**: `boolean`

Sends finished calls to the `calls/complete` endpoint (start+end paired
client-side) instead of the legacy `call/upsert_batch` path.

##### Default

`true`

#### useOTelV2

> **useOTelV2**: `boolean`

Routes OTel-capable integrations through their OTel variant.

##### Default

`true`

***

### traceServerApi

> **traceServerApi**: `Api`\<`any`>

## Methods

### addScore()

> **addScore**(`predictCallId`, `scorerCallId`, `runnableRefUri`, `scorerOutput`): `Promise`\<`string`>

Add a scorer result (e.g., scorer output) to a call.
Used in imperative evaluation to attach scorer results to predict calls.

#### Parameters

<ParamField path="predictCallId" type="string" required>
  ID of the predict call to attach feedback to
</ParamField>

<ParamField path="scorerCallId" type="string" required>
  ID of the scorer call that generated the feedback
</ParamField>

<ParamField path="runnableRefUri" type="string" required>
  URI of the scorer (Op or Object ref)
</ParamField>

<ParamField path="scorerOutput" type="any" required>
  Output of the scorer
</ParamField>

#### Returns

`Promise`\<`string`>

***

### createCall()

> **createCall**(`internalCall`, `opRef`, `params`, `parameterNames`, `thisArg`, `currentCall`, `parentCall`, `startTime`, `displayName?`, `attributes?`, `eagerCallStart?`): `Promise`\<`void`>

#### Parameters

<ParamField path="internalCall" type="InternalCall" required />

<ParamField path="opRef" type="any" required />

<ParamField path="params" type="any[]" required />

<ParamField path="parameterNames" type="undefined | &#x22;useParam0Object&#x22; | string[]" required />

<ParamField path="thisArg" type="any" required />

<ParamField path="currentCall" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="callId" type="string" required />

    <ParamField path="childSummary" type="Record<string, any>" required />

    <ParamField path="displayName" type="string" />

    <ParamField path="opName" type="string" />

    <ParamField path="traceId" type="string" required />
  </Expandable>
</ParamField>

<ParamField path="parentCall" type="{…} | undefined" required>
  Full type: `{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined`
</ParamField>

<ParamField path="startTime" type="Date" required />

<ParamField path="displayName" type="string" />

<ParamField path="attributes" type="Record<string, any>" />

<ParamField path="eagerCallStart" type="boolean = false" />

#### Returns

`Promise`\<`void`>

***

### finishCall()

> **finishCall**(`call`, `result`, `currentCall`, `parentCall`, `summarize`, `endTime`, `startCallPromise`): `Promise`\<`void`>

#### Parameters

<ParamField path="call" type="InternalCall" required />

<ParamField path="result" type="any" required />

<ParamField path="currentCall" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="callId" type="string" required />

    <ParamField path="childSummary" type="Record<string, any>" required />

    <ParamField path="displayName" type="string" />

    <ParamField path="opName" type="string" />

    <ParamField path="traceId" type="string" required />
  </Expandable>
</ParamField>

<ParamField path="parentCall" type="{…} | undefined" required>
  Full type: `{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined`
</ParamField>

<ParamField path="summarize" type="((result) => Record<string, any>) | undefined" required />

<ParamField path="endTime" type="Date" required />

<ParamField path="startCallPromise" type="Promise<void>" required />

#### Returns

`Promise`\<`void`>

***

### finishCallWithException()

> **finishCallWithException**(`call`, `error`, `currentCall`, `parentCall`, `endTime`, `startCallPromise`): `Promise`\<`void`>

#### Parameters

<ParamField path="call" type="InternalCall" required />

<ParamField path="error" type="any" required />

<ParamField path="currentCall" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="callId" type="string" required />

    <ParamField path="childSummary" type="Record<string, any>" required />

    <ParamField path="displayName" type="string" />

    <ParamField path="opName" type="string" />

    <ParamField path="traceId" type="string" required />
  </Expandable>
</ParamField>

<ParamField path="parentCall" type="{…} | undefined" required>
  Full type: `{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined`
</ParamField>

<ParamField path="endTime" type="Date" required />

<ParamField path="startCallPromise" type="Promise<void>" required />

#### Returns

`Promise`\<`void`>

***

### flush()

> **flush**(): `Promise`\<`void`>

Deliver all buffered calls to the server. Await before `process.exit()`.

#### Returns

`Promise`\<`void`>

***

### get()

> **get**(`ref`): `Promise`\<`any`>

#### Parameters

<ParamField path="ref" type="ObjectRef" required>
  See [`ObjectRef`](../classes/objectref).
</ParamField>

#### Returns

`Promise`\<`any`>

***

### getAgentCustomAttributes()

> **getAgentCustomAttributes**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `attributes?`: `object`\[]; `has_more?`: `boolean`; `limit?`: `number`; `offset?`: `number`; }>>

Discover typed custom-attribute keys observed on agent spans in the
project. Each result row is one `(source, key, value_type)` triple plus
a count of how many spans carry it, which is what the spans
query/group/stats APIs use to reference custom attrs.

Filter the spans considered by passing `query` (a structured span
filter), `startedAfter` / `startedBefore` (ISO-8601), or both. Use
`limit` / `offset` to page through the discovered keys.

#### Parameters

<ParamField path="options" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="limit" type="number">
      **Min**

      1

      **Max**

      2000

      **Default**

      ```ts twoslash theme={null}
      // @noErrors
      200
      ```
    </ParamField>

    <ParamField path="offset" type="number">
      **Min**

      0

      **Default**

      ```ts twoslash theme={null}
      // @noErrors
      0
      ```
    </ParamField>

    <ParamField path="query" type="Query | null">
      See [`Query`](./query).
    </ParamField>

    <ParamField path="startedAfter" type="string | null" />

    <ParamField path="startedBefore" type="string | null" />
  </Expandable>
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<\{ `attributes?`: `object`\[]; `has_more?`: `boolean`; `limit?`: `number`; `offset?`: `number`; }>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentCustomAttributes({
  query: {
    $expr: {
      $eq: [{$getField: 'agent_name'}, {$literal: 'my-agent'}],
    },
  },
  startedAfter: '2026-06-15T00:00:00Z',
  limit: 200,
});

for (const attr of resp.data.attributes ?? []) {
  console.log(`${attr.source}.${attr.key} (${attr.value_type}): ${attr.span_count}`);
}
```

***

### getAgents()

> **getAgents**(`options?`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentsResult`](../type-aliases/getagentsresult)>>

List agents with aggregated stats.

#### Parameters

<ParamField path="options" type="GetAgentsOptions = {}">
  See [`GetAgentsOptions`](./getagentsoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentsResult`](../type-aliases/getagentsresult)>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgents({limit: 20});

for (const agent of resp.data.agents) {
  console.log(agent.agent_name, agent.total_input_tokens);
}

console.log(`total count: ${resp.data.total_count}`)
```

***

### getAgentSpans()

> **getAgentSpans**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentSpansResult`](../type-aliases/getagentspansresult)>>

Query agent spans, optionally filtered by agent name and/or a mongo-style
query expression.

#### Parameters

<ParamField path="options" type="GetAgentSpansOptions" required>
  See [`GetAgentSpansOptions`](./getagentspansoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentSpansResult`](../type-aliases/getagentspansresult)>>

#### Examples

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentSpans({agentName: 'my-agent', limit: 20});

for (const span of resp.data.spans) {
  console.log(span.span_id, span.span_name, span.input_tokens);
}
```

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');

const resp = await client.getAgentSpans({
  agentName: 'my-agent',
  query: {
    $expr: {$gt: [{$getField: 'input_tokens'}, {$literal: 1000}]},
  },
});

for (const span of resp.data.spans) {
  console.log(span.span_id, span.span_name, span.input_tokens);
}
```

***

### getAgentSpanStats()

> **getAgentSpanStats**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `bucket_type?`: `"number"` | `"time"`; `columns?`: `object`\[]; `end`: `string`; `granularity?`: `number` | `null`; `rows?`: `Record`\<`string`, `string` | `number` | `boolean` | `null`>\[]; `start`: `string`; `timezone`: `string`; }>>

Agregations over agent spans in the project, returned as rows + column
metadata suitable for time-series / bucketed visualizations.

`start` (required) and `end` define the time window. Each entry in
`metrics` declares a field to extract and how to aggregate it (`sum`,
`avg`, `count`, percentiles, etc.). Pass `granularity` (seconds) to
bucket rows by time, or `groupBy` to break results out per agent /
provider / model / etc. `query` filters the underlying spans before
aggregation.

#### Parameters

<ParamField path="options" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="end" type="string | null" />

    <ParamField path="granularity" type="number | null" />

    <ParamField path="groupBy" type="object[]" />

    <ParamField path="metrics" type="object[]" required />

    <ParamField path="query" type="Query | null">
      See [`Query`](./query).
    </ParamField>

    <ParamField path="start" type="string" required />

    <ParamField path="timezone" type="string">
      **Default**

      ```ts twoslash theme={null}
      // @noErrors
      "UTC"
      ```
    </ParamField>
  </Expandable>
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<\{ `bucket_type?`: `"number"` | `"time"`; `columns?`: `object`\[]; `end`: `string`; `granularity?`: `number` | `null`; `rows?`: `Record`\<`string`, `string` | `number` | `boolean` | `null`>\[]; `start`: `string`; `timezone`: `string`; }>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentSpanStats({
  start: '2026-06-10T00:00:00Z',
  end: '2026-06-23T00:00:00Z',
  granularity: 86400, // one row per day
  metrics: [
    {
      alias: 'total_input_tokens',
      value_type: 'number',
      aggregations: ['sum'],
      value: {source: 'field', key: 'input_tokens'},
    },
  ],
  groupBy: [{key: 'agent_name'}],
});

for (const row of resp.data.rows ?? []) {
  console.log(row.started_at_bucket, row.agent_name, row.total_input_tokens);
}
```

***

### getAgentTurn()

> **getAgentTurn**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `agent_name?`: `string` | `null`; `agent_version?`: `string` | `null`; `feedback?`: `Record`\<`string`, `any`>\[] | `null`; `messages?`: `object`\[]; `provider?`: `string` | `null`; `root_span_name?`: `string` | `null`; `status_code?`: `"UNSET"` | `"OK"` | `"ERROR"` | `null`; `total_cost_usd?`: `number` | `null`; `total_duration_ms?`: `number` | `null`; `trace_id`: `string`; }>>

Get data (including messages) for a single turn (by traceId).

#### Parameters

<ParamField path="options" type="GetAgentTurnOptions" required>
  See [`GetAgentTurnOptions`](./getagentturnoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<\{ `agent_name?`: `string` | `null`; `agent_version?`: `string` | `null`; `feedback?`: `Record`\<`string`, `any`>\[] | `null`; `messages?`: `object`\[]; `provider?`: `string` | `null`; `root_span_name?`: `string` | `null`; `status_code?`: `"UNSET"` | `"OK"` | `"ERROR"` | `null`; `total_cost_usd?`: `number` | `null`; `total_duration_ms?`: `number` | `null`; `trace_id`: `string`; }>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentTurn({
  traceId: '01997b8a-2c89-7c4d-9d0e-2f7e5b9a1b2c',
  includeFeedback: true,
});

console.log(resp.data.root_span_name, resp.data.total_duration_ms);

for (const message of resp.data.messages ?? []) {
  if (message.user_message) console.log('user:', message.user_message);
  if (message.assistant_message) console.log('assistant:', message.assistant_message);
}
```

***

### getAgentTurns()

> **getAgentTurns**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentTurnsResult`](../type-aliases/getagentturnsresult)>>

Get data (including messages) for many turns (by conversationId).

#### Parameters

<ParamField path="options" type="GetAgentTurnsOptions" required>
  See [`GetAgentTurnsOptions`](./getagentturnsoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentTurnsResult`](../type-aliases/getagentturnsresult)>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentTurns({
  conversationId: 'trace_c50312356de3487fa90e381c9399b5b4',
  limit: 20,
  includeFeedback: true,
});

for (const turn of resp.data.turns ?? []) {
  console.log(turn.trace_id, turn.root_span_name);
  for (const message of turn.messages ?? []) {
    if (message.user_message) console.log('user:', message.user_message);
    if (message.assistant_message) console.log('assistant:', message.assistant_message);
  }
}

console.log(`total turns: ${resp.data.total_turns}, has more: ${resp.data.has_more}`);
```

***

### getAgentVersions()

> **getAgentVersions**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentVersionsResult`](../type-aliases/getagentversionsresult)>>

List versions for a given agent.

#### Parameters

<ParamField path="options" type="GetAgentVersionsOptions" required>
  See [`GetAgentVersionsOptions`](./getagentversionsoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<[`GetAgentVersionsResult`](../type-aliases/getagentversionsresult)>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.getAgentVersions({agentName: 'my-agent', limit: 20});

for (const version of resp.data.versions) {
  console.log(version.agent_version, version.total_input_tokens);
}

console.log(`total count: ${resp.data.total_count}`)
```

***

### getCall()

> **getCall**(`callId`, `includeCosts?`): `Promise`\<\{ `attributes`: `Record`\<`string`, `any`>; `deleted_at?`: `string` | `null`; `display_name?`: `string` | `null`; `ended_at?`: `string` | `null`; `exception?`: `string` | `null`; `expire_at?`: `string` | `null`; `id`: `string`; `inputs`: `Record`\<`string`, `any`>; `op_name`: `string`; `output?`: `null`; `parent_id?`: `string` | `null`; `project_id`: `string`; `started_at`: `string`; `storage_size_bytes?`: `number` | `null`; `summary?`: `Record`\<`string`, `any`>; `thread_id?`: `string` | `null`; `total_storage_size_bytes?`: `number` | `null`; `trace_id`: `string`; `turn_id?`: `string` | `null`; `wb_run_id?`: `string` | `null`; `wb_run_step?`: `number` | `null`; `wb_run_step_end?`: `number` | `null`; `wb_user_id?`: `string` | `null`; `wb_username?`: `string` | `null`; `setDisplayName`: `Promise`\<`void`>; }>

#### Parameters

<ParamField path="callId" type="string" required />

<ParamField path="includeCosts" type="boolean = false" />

#### Returns

`Promise`\<\{ `attributes`: `Record`\<`string`, `any`>; `deleted_at?`: `string` | `null`; `display_name?`: `string` | `null`; `ended_at?`: `string` | `null`; `exception?`: `string` | `null`; `expire_at?`: `string` | `null`; `id`: `string`; `inputs`: `Record`\<`string`, `any`>; `op_name`: `string`; `output?`: `null`; `parent_id?`: `string` | `null`; `project_id`: `string`; `started_at`: `string`; `storage_size_bytes?`: `number` | `null`; `summary?`: `Record`\<`string`, `any`>; `thread_id?`: `string` | `null`; `total_storage_size_bytes?`: `number` | `null`; `trace_id`: `string`; `turn_id?`: `string` | `null`; `wb_run_id?`: `string` | `null`; `wb_run_step?`: `number` | `null`; `wb_run_step_end?`: `number` | `null`; `wb_user_id?`: `string` | `null`; `wb_username?`: `string` | `null`; `setDisplayName`: `Promise`\<`void`>; }>

***

### getCalls()

#### Call Signature

> **getCalls**(`options?`): `Promise`\<`object`\[]>

##### Parameters

<ParamField path="options" type="GetCallsOptions">
  See [`GetCallsOptions`](./getcallsoptions).
</ParamField>

##### Returns

`Promise`\<`object`\[]>

#### Call Signature

> **getCalls**(`options?`, `includeCosts?`, `limit?`): `Promise`\<`object`\[]>

##### Parameters

<ParamField path="options" type="CallsFilter">
  See [`CallsFilter`](./callsfilter).
</ParamField>

<ParamField path="includeCosts" type="boolean" />

<ParamField path="limit" type="number" />

##### Returns

`Promise`\<`object`\[]>

***

### getCallsIterator()

#### Call Signature

> **getCallsIterator**(`options?`, `includeCosts?`, `limit?`): `AsyncIterableIterator`\<[`CallSchema`](./callschema)>

##### Parameters

<ParamField path="options" type="CallsFilter">
  See [`CallsFilter`](./callsfilter).
</ParamField>

<ParamField path="includeCosts" type="boolean" />

<ParamField path="limit" type="number" />

##### Returns

`AsyncIterableIterator`\<[`CallSchema`](./callschema)>

#### Call Signature

> **getCallsIterator**(`options?`): `AsyncIterableIterator`\<[`CallSchema`](./callschema)>

##### Parameters

<ParamField path="options" type="GetCallsOptions">
  See [`GetCallsOptions`](./getcallsoptions).
</ParamField>

##### Returns

`AsyncIterableIterator`\<[`CallSchema`](./callschema)>

***

### getCallStack()

> **getCallStack**(): `CallStack`

#### Returns

`CallStack`

***

### getCurrentAttributes()

> **getCurrentAttributes**(): `Record`\<`string`, `any`>

#### Returns

`Record`\<`string`, `any`>

***

### linkPromptToRegistry()

> **linkPromptToRegistry**(`prompt`, `options`): `Promise`\<\{ `version_index`: `number` | `null`; }>

Link a published prompt version into a registry portfolio.

#### Parameters

<ParamField path="prompt" type="string | ObjectRef | Prompt" required>
  See [`ObjectRef`](../classes/objectref).
</ParamField>

<ParamField path="options" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="aliases" type="string[]" />

    <ParamField path="targetPath" type="string" required />
  </Expandable>
</ParamField>

#### Returns

`Promise`\<\{ `version_index`: `number` | `null`; }>

***

### pendingCallCount()

> **pendingCallCount**(): `number`

Calls buffered client-side but not yet delivered to the server.

#### Returns

`number`

***

### publish()

> **publish**(`obj`, `objId?`): `Promise`\<[`ObjectRef`](../classes/objectref)>

#### Parameters

<ParamField path="obj" type="any" required />

<ParamField path="objId" type="string" />

#### Returns

`Promise`\<[`ObjectRef`](../classes/objectref)>

***

### pushNewCall()

> **pushNewCall**(): `object`

#### Returns

`object`

<ResponseField name="currentCall" type="object" required>
  ###### currentCall.callId

  > **callId**: `string`

  ###### currentCall.childSummary

  > **childSummary**: `Record`\<`string`, `any`>

  ###### currentCall.displayName

  > `optional` **displayName**: `string`

  ###### currentCall.opName

  > `optional` **opName**: `string`

  ###### currentCall.traceId

  > **traceId**: `string`
</ResponseField>

<ResponseField name="newStack" type="CallStack" required />

<ResponseField name="parentCall" type="object">
  ###### parentCall.callId

  > **callId**: `string`

  ###### parentCall.childSummary

  > **childSummary**: `Record`\<`string`, `any`>

  ###### parentCall.displayName

  > `optional` **displayName**: `string`

  ###### parentCall.opName

  > `optional` **opName**: `string`

  ###### parentCall.traceId

  > **traceId**: `string`
</ResponseField>

***

### registerCustomRuntime()

> **registerCustomRuntime**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `api_key_secret`: `string` | `null`; `base_url`: `string`; `headers`: `Record`\<`string`, `string`>; `name`: `string`; `runtime_ids`: `object`\[]; }>>

Register a custom runtime, replacing its complete configuration if it exists.

#### Parameters

<ParamField path="options" type="RegisterCustomRuntimeOptions" required>
  See [`RegisterCustomRuntimeOptions`](./registercustomruntimeoptions).
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<\{ `api_key_secret`: `string` | `null`; `base_url`: `string`; `headers`: `Record`\<`string`, `string`>; `name`: `string`; `runtime_ids`: `object`\[]; }>>

***

### runWithAttributes()

> **runWithAttributes**\<`T`>(`attributes`, `fn`): `T`

#### Type Parameters

<ParamField path="T" />

#### Parameters

<ParamField path="attributes" type="Record<string, any>" required />

<ParamField path="fn" type="() => T" required />

#### Returns

`T`

***

### runWithCallStack()

> **runWithCallStack**\<`T`>(`callStack`, `fn`): `T`

#### Type Parameters

<ParamField path="T" />

#### Parameters

<ParamField path="callStack" type="CallStack" required />

<ParamField path="fn" type="() => T" required />

#### Returns

`T`

***

### saveCallEnd()

> **saveCallEnd**(`callEnd`): `void`

#### Parameters

<ParamField path="callEnd" type="object & object" required />

#### Returns

`void`

***

### saveCallStart()

> **saveCallStart**(`callStart`, `opts?`): `void`

#### Parameters

<ParamField path="callStart" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="attributes" type="Record<string, any>" required>
      Attributes
    </ParamField>

    <ParamField path="display_name" type="string | null">
      Display Name
    </ParamField>

    <ParamField path="id" type="string | null">
      Id
    </ParamField>

    <ParamField path="inputs" type="Record<string, any>" required>
      Inputs
    </ParamField>

    <ParamField path="op_name" type="string" required>
      Op Name
    </ParamField>

    <ParamField path="otel_dump" type="Record<string, any> | null">
      Otel Dump
    </ParamField>

    <ParamField path="parent_id" type="string | null">
      Parent Id
    </ParamField>

    <ParamField path="project_id" type="string" required>
      Project Id
    </ParamField>

    <ParamField path="started_at" type="string" required>
      Started At

      **Format**

      date-time
    </ParamField>

    <ParamField path="thread_id" type="string | null">
      Thread Id
    </ParamField>

    <ParamField path="trace_id" type="string | null">
      Trace Id
    </ParamField>

    <ParamField path="turn_id" type="string | null">
      Turn Id
    </ParamField>

    <ParamField path="wb_run_id" type="string | null">
      Wb Run Id
    </ParamField>

    <ParamField path="wb_run_step" type="number | null">
      Wb Run Step
    </ParamField>

    <ParamField path="wb_user_id" type="string | null">
      Wb User Id
      Do not set directly. Server will automatically populate this field.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="opts" type="object">
  <Expandable title="properties" defaultOpen>
    <ParamField path="eager" type="boolean" />
  </Expandable>
</ParamField>

#### Returns

`void`

***

### saveOp()

> **saveOp**(`op`, `objId?`): `Promise`\<`OpRef`>

#### Parameters

<ParamField path="op" type="Op<(...args) => any>" required>
  See [`Op`](../type-aliases/op).
</ParamField>

<ParamField path="objId" type="string" />

#### Returns

`Promise`\<`OpRef`>

***

### searchAgents()

> **searchAgents**(`options`): `Promise`\<[`Response`](../type-aliases/response)\<\{ `results`: `object`\[]; `total_conversations?`: `number`; }>>

Full-text search across agent messages in the project. Returns hits
grouped by conversation, with a preview of each matched message.

`query` is the full-text search term. Pass an empty string to retrieve
all messages matching the structured filters (`agentName`,
`conversationId`, `traceId`) without text matching. Use `limit` /
`offset` to page through results.

#### Parameters

<ParamField path="options" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ParamField path="agentName" type="string | null" />

    <ParamField path="conversationId" type="string | null" />

    <ParamField path="limit" type="number">
      Limit

      **Min**

      0

      **Max**

      1000

      **Default**

      ```ts twoslash theme={null}
      // @noErrors
      20
      ```
    </ParamField>

    <ParamField path="offset" type="number">
      Offset

      **Min**

      0

      **Default**

      ```ts twoslash theme={null}
      // @noErrors
      0
      ```
    </ParamField>

    <ParamField path="query" type="string" required />

    <ParamField path="traceId" type="string | null" />
  </Expandable>
</ParamField>

#### Returns

`Promise`\<[`Response`](../type-aliases/response)\<\{ `results`: `object`\[]; `total_conversations?`: `number`; }>>

#### Example

```ts twoslash theme={null}
// @noErrors
const client = await weave.init('entity/project');
const resp = await client.searchAgents({
  query: 'Liverpool',
  agentName: 'Assistant',
  limit: 20,
});

for (const conversation of resp.data.results ?? []) {
  console.log(`${conversation.conversation_id} (${conversation.agent_name})`);
  for (const match of conversation.matched_messages) {
    console.log(`  [${match.role}] ${match.content_preview}`);
  }
}

console.log(`total conversations: ${resp.data.total_conversations}`);
```

***

### serializeAudio()

> **serializeAudio**(`data`, `audioType?`): `Promise`\<\{ `_type`: `"CustomWeaveType"`; `files`: `Record`\<`string`, `string`>; `load_op`: `string`; `weave_type`: \{ `type`: `string`; }; }>

Upload raw audio bytes to the Weave content store and return the
`CustomWeaveType` placeholder that can be embedded in a call output.

Use this when building call outputs manually (e.g. via `saveCallEnd`)
where the automatic serialization pipeline from `finishCall` is not used.

#### Parameters

<ParamField path="data" type="Buffer" required>
  Raw audio bytes (WAV for best browser compatibility)
</ParamField>

<ParamField path="audioType" type="&#x22;wav&#x22; = DEFAULT_AUDIO_TYPE">
  File format — currently only 'wav' is supported
</ParamField>

#### Returns

`Promise`\<\{ `_type`: `"CustomWeaveType"`; `files`: `Record`\<`string`, `string`>; `load_op`: `string`; `weave_type`: \{ `type`: `string`; }; }>

***

### updateCall()

> **updateCall**(`callId`, `displayName`): `Promise`\<`void`>

#### Parameters

<ParamField path="callId" type="string" required />

<ParamField path="displayName" type="string" required />

#### Returns

`Promise`\<`void`>

***

### waitForBatchProcessing()

> **waitForBatchProcessing**(): `Promise`\<`void`>

#### Returns

`Promise`\<`void`>
