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

# WeaveClient

> Référence du SDK TypeScript

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "voir la 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>
    Source GitHub
      </>}
  </a>;

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

<div id="properties">
  ## Propriétés
</div>

<div id="projectid">
  ### projectId
</div>

> **projectId** : `string`

***

<div id="settings">
  ### settings
</div>

> **settings** : `object`

<div id="attributes">
  #### attributes
</div>

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

Un ensemble d'attributs appliqués à chaque trace produite par ce client.

<div id="genai">
  #### genai
</div>

> `readonly` **genai** : `objet`

<div id="genaibatchoptions">
  ##### genai.batchOptions
</div>

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

Configuration de `BatchSpanProcessor`. Ignorée sauf si `spanProcessor === 'batch'`.

<div id="genaispanprocessor">
  ##### genai.spanProcessor
</div>

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

Mode d'export des spans GenAI.

* `'batch'` (par défaut) : `BatchSpanProcessor`, adapté aux agents en
  production et aux processus de longue durée.
* `'simple'` : `SimpleSpanProcessor`, une requête HTTP POST par span. Utile pour
  les tests et les CLI de courte durée, lorsqu'un vidage déterministe importe plus
  que le débit.
* Instance de `SpanProcessor` : un processor fourni par l'utilisateur. L'appelant
  gère son cycle de vie ; l'exporter OTLP de Weave ciblant `/agents/otel/v1/traces`
  n'est pas utilisé.

<div id="printcalllink">
  #### printCallLink
</div>

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

Affiche dans le terminal les liens vers l'interface Weave pour les ops.

<div id="default">
  ##### Par défaut
</div>

`true`

<div id="usecallscomplete">
  #### useCallsComplete
</div>

> **useCallsComplete** : `boolean`

Envoie les appels terminés au point de terminaison `calls/complete` (début et fin
appariés côté client) au lieu de l'ancien chemin `call/upsert_batch`.

<div id="default-2">
  ##### Par défaut
</div>

`true`

<div id="useotelv2">
  #### useOTelV2
</div>

> **useOTelV2** : `boolean`

Achemine les intégrations compatibles OTel via leur variante OTel.

<div id="default-3">
  ##### Par défaut
</div>

`true`

***

<div id="traceserverapi">
  ### traceServerApi
</div>

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

<div id="methods">
  ## Méthodes
</div>

<div id="addscore">
  ### addScore()
</div>

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

Ajoute le résultat d’un scorer (par exemple, sa sortie) à un appel.
Utilisé dans une évaluation impérative pour joindre les résultats du scorer aux appels de prédiction.

<div id="parameters">
  #### Paramètres
</div>

<ParamField path="predictCallId" type="string" required>
  ID de l'appel predict auquel joindre le feedback
</ParamField>

<ParamField path="scorerCallId" type="string" required>
  ID de l'appel du scorer ayant généré le feedback
</ParamField>

<ParamField path="runnableRefUri" type="string" required>
  URI du scorer (réf. d'op ou d'objet)
</ParamField>

<ParamField path="scorerOutput" type="any" required>
  Sortie du scorer
</ParamField>

<div id="returns">
  #### Renvoie
</div>

`Promise`\<`string`>

***

<div id="createcall">
  ### createCall()
</div>

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

<div id="parameters-2">
  #### Paramètres
</div>

<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="propriétés" 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>
  Type complet : `{ 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" />

<div id="returns-2">
  #### Renvoie
</div>

`Promise`\<`void`>

***

<div id="finishcall">
  ### finishCall()
</div>

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

<div id="parameters-3">
  #### Paramètres
</div>

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

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

<ParamField path="currentCall" type="object" required>
  <Expandable title="propriétés" 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>
  Type complet : `{ 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 />

<div id="returns-3">
  #### Renvoie
</div>

`Promise`\<`void`>

***

<div id="finishcallwithexception">
  ### finishCallWithException()
</div>

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

<div id="parameters-4">
  #### Paramètres
</div>

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

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

<ParamField path="currentCall" type="object" required>
  <Expandable title="propriétés" 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>
  Type complet : `{ 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 />

<div id="returns-4">
  #### Renvoie
</div>

`Promise`\<`void`>

***

<div id="flush">
  ### flush()
</div>

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

Transmet au serveur tous les appels mis en mémoire tampon. À attendre avant `process.exit()`.

<div id="returns-5">
  #### Renvoie
</div>

`Promise`\<`void`>

***

<div id="get">
  ### get()
</div>

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

<div id="parameters-5">
  #### Paramètres
</div>

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

<div id="returns-6">
  #### Renvoie
</div>

`Promise`\<`any`>

***

<div id="getagentcustomattributes">
  ### getAgentCustomAttributes()
</div>

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

Découvrez les clés d’attributs personnalisés typés observées dans les spans d’agent du
projet. Chaque ligne de résultat correspond à un triplet `(source, key, value_type)`, accompagné du
nombre de spans qui le portent. Les API de requête, de regroupement et de statistiques des
spans l’utilisent pour référencer les attributs personnalisés.

Filtrez les spans pris en compte en transmettant `query` (un filtre de span
structuré), `startedAfter` / `startedBefore` (ISO-8601), ou les deux. Utilisez
`limit` / `offset` pour parcourir les clés découvertes par pages.

<div id="parameters-6">
  #### Paramètres
</div>

<ParamField path="options" type="object" required>
  <Expandable title="propriétés" defaultOpen>
    <ParamField path="limit" type="number">
      **Min**

      1

      **Max**

      2000

      **Par défaut**

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

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

      0

      **Par défaut**

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

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

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

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

<div id="returns-7">
  #### Renvoie
</div>

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

<div id="example">
  #### Exemple
</div>

```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}`);
}
```

***

<div id="getagents">
  ### getAgents()
</div>

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

Répertorie les agents avec des statistiques agrégées.

<div id="parameters-7">
  #### Paramètres
</div>

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

<div id="returns-8">
  #### Renvoie
</div>

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

<div id="example-2">
  #### Exemple
</div>

```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}`)
```

***

<div id="getagentspans">
  ### getAgentSpans()
</div>

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

Interroge les spans d’agent, éventuellement filtrés par nom d’agent et/ou par une expression de requête de type Mongo.

<div id="parameters-8">
  #### Paramètres
</div>

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

<div id="returns-9">
  #### Renvoie
</div>

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

<div id="examples">
  #### Exemples
</div>

```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);
}
```

***

<div id="getagentspanstats">
  ### getAgentSpanStats()
</div>

> **getAgentSpanStats**(`options`) : `Promise`\<[`Réponse`](../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`; }>>

Agrégations sur les spans d’agent du projet, renvoyées sous forme de lignes et de métadonnées de colonnes
adaptées aux visualisations de séries temporelles ou par compartiments.

`start` (requis) et `end` définissent la fenêtre temporelle. Chaque entrée de
`metrics` indique un champ à extraire et la façon de l’agréger (`sum`,
`avg`, `count`, percentiles, etc.). Transmettez `granularity` (en secondes) pour
regrouper les lignes par intervalle temporel, ou `groupBy` pour ventiler les résultats par agent /
provider / model / etc. `query` filtre les spans sous-jacents avant
l’agrégation.

<div id="parameters-9">
  #### Paramètres
</div>

<ParamField path="options" type="object" required>
  <Expandable title="propriétés" 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">
      Voir [`Query`](./query).
    </ParamField>

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

    <ParamField path="timezone" type="string">
      **Par défaut**

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

<div id="returns-10">
  #### Renvoie
</div>

`Promise`\<[`Réponse`](../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`; }>>

<div id="example-3">
  #### Exemple
</div>

```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, // une ligne par jour
  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);
}
```

***

<div id="getagentturn">
  ### getAgentTurn()
</div>

> **getAgentTurn**(`options`) : `Promise`\<[`Réponse`](../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`; }>>

Obtient les données (y compris les messages) d'un seul tour de conversation (par traceId).

<div id="parameters-10">
  #### Paramètres
</div>

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

<div id="returns-11">
  #### Renvoie
</div>

`Promise`\<[`Réponse`](../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`; }>>

<div id="example-4">
  #### Exemple
</div>

```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);
}
```

***

<div id="getagentturns">
  ### getAgentTurns()
</div>

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

Obtenir les données (y compris les messages) de nombreux tours de conversation (par conversationId).

<div id="parameters-11">
  #### Paramètres
</div>

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

<div id="returns-12">
  #### Renvoie
</div>

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

<div id="example-5">
  #### Exemple
</div>

```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}`);
```

***

<div id="getagentversions">
  ### getAgentVersions()
</div>

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

Liste les versions d’un agent donné.

<div id="parameters-12">
  #### Paramètres
</div>

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

<div id="returns-13">
  #### Renvoie
</div>

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

<div id="example-6">
  #### Exemple
</div>

```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}`)
```

***

<div id="getcall">
  ### getCall()
</div>

> **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`>; }>

<div id="parameters-13">
  #### Paramètres
</div>

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

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

<div id="returns-14">
  #### Renvoie
</div>

`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`>; }>

***

<div id="getcalls">
  ### getCalls()
</div>

<div id="call-signature">
  #### Signature de l’appel
</div>

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

<div id="parameters-14">
  ##### Paramètres
</div>

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

<div id="returns-15">
  ##### Renvoie
</div>

`Promise`\<`objet`\[]>

<div id="call-signature-2">
  #### Signature de l’appel
</div>

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

<div id="parameters-15">
  ##### Paramètres
</div>

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

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

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

<div id="returns-16">
  ##### Renvoie
</div>

`Promise`\<`objet`\[]>

***

<div id="getcallsiterator">
  ### getCallsIterator()
</div>

<div id="call-signature-3">
  #### Signature de l’appel
</div>

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

<div id="parameters-16">
  ##### Paramètres
</div>

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

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

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

<div id="returns-17">
  ##### Renvoie
</div>

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

<div id="call-signature-4">
  #### Signature d’appel
</div>

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

<div id="parameters-17">
  ##### Paramètres
</div>

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

<div id="returns-18">
  ##### Renvoie
</div>

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

***

<div id="getcallstack">
  ### getCallStack()
</div>

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

<div id="returns-19">
  #### Renvoie
</div>

`CallStack`

***

<div id="getcurrentattributes">
  ### getCurrentAttributes()
</div>

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

<div id="returns-20">
  #### Renvoie
</div>

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

***

<div id="linkprompttoregistry">
  ### linkPromptToRegistry()
</div>

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

Associe une version publiée d’un prompt à un portefeuille de registre.

<div id="parameters-18">
  #### Paramètres
</div>

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

<ParamField path="options" type="objet" required>
  <Expandable title="propriétés" defaultOpen>
    <ParamField path="aliases" type="string[]" />

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

<div id="returns-21">
  #### Renvoie
</div>

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

***

<div id="pendingcallcount">
  ### pendingCallCount()
</div>

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

Appels mis en mémoire tampon côté client, mais pas encore transmis au serveur.

<div id="returns-22">
  #### Renvoie
</div>

`number`

***

<div id="publish">
  ### publish()
</div>

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

<div id="parameters-19">
  #### Paramètres
</div>

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

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

<div id="returns-23">
  #### Renvoie
</div>

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

***

<div id="pushnewcall">
  ### pushNewCall()
</div>

> **pushNewCall**() : `objet`

<div id="returns-24">
  #### Renvoie
</div>

`objet`

<ResponseField name="currentCall" type="objet" required>
  <div id="currentcallcallid">
    ###### currentCall.callId
  </div>

  > **callId**: `string`

  <div id="currentcallchildsummary">
    ###### currentCall.childSummary
  </div>

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

  <div id="currentcalldisplayname">
    ###### currentCall.displayName
  </div>

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

  <div id="currentcallopname">
    ###### currentCall.opName
  </div>

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

  <div id="currentcalltraceid">
    ###### currentCall.traceId
  </div>

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

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

<ResponseField name="parentCall" type="objet">
  <div id="parentcallcallid">
    ###### parentCall.callId
  </div>

  > **callId**: `string`

  <div id="parentcallchildsummary">
    ###### parentCall.childSummary
  </div>

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

  <div id="parentcalldisplayname">
    ###### parentCall.displayName
  </div>

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

  <div id="parentcallopname">
    ###### parentCall.opName
  </div>

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

  <div id="parentcalltraceid">
    ###### parentCall.traceId
  </div>

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

***

<div id="registercustomruntime">
  ### registerCustomRuntime()
</div>

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

Enregistre un environnement d’exécution personnalisé, en remplaçant l’intégralité de sa configuration s’il existe déjà.

<div id="parameters-20">
  #### Paramètres
</div>

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

<div id="returns-25">
  #### Renvoie
</div>

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

***

<div id="runwithattributes">
  ### runWithAttributes()
</div>

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

<div id="type-parameters">
  #### Paramètres de type
</div>

<ParamField path="T" />

<div id="parameters-21">
  #### Paramètres
</div>

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

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

<div id="returns-26">
  #### Renvoie
</div>

`T`

***

<div id="runwithcallstack">
  ### runWithCallStack()
</div>

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

<div id="type-parameters-2">
  #### Paramètres de type
</div>

<ParamField path="T" />

<div id="parameters-22">
  #### Paramètres
</div>

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

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

<div id="returns-27">
  #### Renvoie
</div>

`T`

***

<div id="savecallend">
  ### saveCallEnd()
</div>

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

<div id="parameters-23">
  #### Paramètres
</div>

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

<div id="returns-28">
  #### Renvoie
</div>

`void`

***

<div id="savecallstart">
  ### saveCallStart()
</div>

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

<div id="parameters-24">
  #### Paramètres
</div>

<ParamField path="callStart" type="object" required>
  <Expandable title="propriétés" defaultOpen>
    <ParamField path="attributes" type="Record<string, any>" required>
      Attributs
    </ParamField>

    <ParamField path="display_name" type="string | null">
      Nom d'affichage
    </ParamField>

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

    <ParamField path="inputs" type="Record<string, any>" required>
      Entrées
    </ParamField>

    <ParamField path="op_name" type="string" required>
      Nom de l'op
    </ParamField>

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

    <ParamField path="parent_id" type="string | null">
      ID parent
    </ParamField>

    <ParamField path="project_id" type="string" required>
      ID du project
    </ParamField>

    <ParamField path="started_at" type="string" required>
      Date de démarrage

      **Format**

      date-time
    </ParamField>

    <ParamField path="thread_id" type="string | null">
      ID du thread
    </ParamField>

    <ParamField path="trace_id" type="string | null">
      ID de la trace
    </ParamField>

    <ParamField path="turn_id" type="string | null">
      ID du tour de conversation
    </ParamField>

    <ParamField path="wb_run_id" type="string | null">
      ID du run W\&B
    </ParamField>

    <ParamField path="wb_run_step" type="number | null">
      Étape du run W\&B
    </ParamField>

    <ParamField path="wb_user_id" type="string | null">
      ID de l'utilisateur W\&B
      Ne définissez pas cette valeur directement. Le serveur renseigne automatiquement ce champ.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="opts" type="object">
  <Expandable title="propriétés" defaultOpen>
    <ParamField path="eager" type="boolean" />
  </Expandable>
</ParamField>

<div id="returns-29">
  #### Renvoie
</div>

`void`

***

<div id="saveop">
  ### saveOp()
</div>

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

<div id="parameters-25">
  #### Paramètres
</div>

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

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

<div id="returns-30">
  #### Renvoie
</div>

`Promise`\<`OpRef`>

***

<div id="searchagents">
  ### searchAgents()
</div>

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

Recherche en texte intégral parmi les messages d’agent du projet. Renvoie les résultats
regroupés par conversation, avec un aperçu de chaque message correspondant.

`query` correspond au terme de recherche en texte intégral. Transmettez une chaîne vide pour récupérer
tous les messages correspondant aux filtres structurés (`agentName`,
`conversationId`, `traceId`) sans effectuer de recherche textuelle. Utilisez `limit` /
`offset` pour parcourir les résultats page par page.

<div id="parameters-26">
  #### Paramètres
</div>

<ParamField path="options" type="objet" required>
  <Expandable title="propriétés" defaultOpen>
    <ParamField path="agentName" type="string | null" />

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

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

      **Min**

      0

      **Max**

      1000

      **Par défaut**

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

    <ParamField path="offset" type="number">
      Décalage

      **Min**

      0

      **Par défaut**

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

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

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

<div id="returns-31">
  #### Renvoie
</div>

`Promise`\<[`Réponse`](../type-aliases/response)\<\{ `results`: `objet`\[]; `total_conversations?`: `number`; }>>

<div id="example-7">
  #### Exemple
</div>

```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}`);
```

***

<div id="serializeaudio">
  ### serializeAudio()
</div>

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

Téléverse des octets audio bruts vers le magasin de contenu Weave et renvoie l’espace réservé
`CustomWeaveType` pouvant être intégré à une sortie d’appel.

Utilisez cette méthode lorsque vous créez manuellement des sorties d’appel (par ex. via `saveCallEnd`)
et que le pipeline de sérialisation automatique de `finishCall` n’est pas utilisé.

<div id="parameters-27">
  #### Paramètres
</div>

<ParamField path="data" type="Buffer" required>
  Données audio brutes (WAV pour une compatibilité optimale avec les navigateurs)
</ParamField>

<ParamField path="audioType" type="&#x22;wav&#x22; = DEFAULT_AUDIO_TYPE">
  Format de fichier — seul 'wav' est actuellement pris en charge
</ParamField>

<div id="returns-32">
  #### Renvoie
</div>

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

***

<div id="updatecall">
  ### updateCall()
</div>

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

<div id="parameters-28">
  #### Paramètres
</div>

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

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

<div id="returns-33">
  #### Renvoie
</div>

`Promise`\<`void`>

***

<div id="waitforbatchprocessing">
  ### waitForBatchProcessing()
</div>

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

<div id="returns-34">
  #### Renvoie
</div>

`Promise`\<`void`>
