> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-dependabot-npm-and-yarn-scripts-css-minify-npm.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" />

<h2 id="properties">
  Propriétés
</h2>

<h3 id="projectid">
  projectId
</h3>

> **projectId** : `string`

***

<h3 id="settings">
  settings
</h3>

> **settings** : `object`

<h4 id="attributes">
  attributes
</h4>

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

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

<h4 id="genai">
  genai
</h4>

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

<h5 id="genaibatchoptions">
  genai.batchOptions
</h5>

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

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

<h5 id="genaispanprocessor">
  genai.spanProcessor
</h5>

> `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é.

<h4 id="printcalllink">
  printCallLink
</h4>

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

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

<h5 id="default">
  Par défaut
</h5>

`true`

<h4 id="usecallscomplete">
  useCallsComplete
</h4>

> **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`.

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

`true`

<h4 id="useotelv2">
  useOTelV2
</h4>

> **useOTelV2** : `boolean`

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

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

`true`

***

<h3 id="traceserverapi">
  traceServerApi
</h3>

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

<h2 id="methods">
  Méthodes
</h2>

<h3 id="addscore">
  addScore()
</h3>

> **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.

<h4 id="parameters">
  Paramètres
</h4>

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

<h4 id="returns">
  Renvoie
</h4>

`Promise`\<`string`>

***

<h3 id="createcall">
  createCall()
</h3>

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

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

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

<h4 id="returns-2">
  Renvoie
</h4>

`Promise`\<`void`>

***

<h3 id="finishcall">
  finishCall()
</h3>

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

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

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

<h4 id="returns-3">
  Renvoie
</h4>

`Promise`\<`void`>

***

<h3 id="finishcallwithexception">
  finishCallWithException()
</h3>

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

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

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

<h4 id="returns-4">
  Renvoie
</h4>

`Promise`\<`void`>

***

<h3 id="flush">
  flush()
</h3>

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

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

<h4 id="returns-5">
  Renvoie
</h4>

`Promise`\<`void`>

***

<h3 id="get">
  get()
</h3>

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

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

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

<h4 id="returns-6">
  Renvoie
</h4>

`Promise`\<`any`>

***

<h3 id="getagentcustomattributes">
  getAgentCustomAttributes()
</h3>

> **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.

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

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

<h4 id="returns-7">
  Renvoie
</h4>

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

<h4 id="example">
  Exemple
</h4>

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

***

<h3 id="getagents">
  getAgents()
</h3>

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

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

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

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

<h4 id="returns-8">
  Renvoie
</h4>

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

<h4 id="example-2">
  Exemple
</h4>

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

***

<h3 id="getagentspans">
  getAgentSpans()
</h3>

> **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.

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

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

<h4 id="returns-9">
  Renvoie
</h4>

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

<h4 id="examples">
  Exemples
</h4>

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

***

<h3 id="getagentspanstats">
  getAgentSpanStats()
</h3>

> **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.

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

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

<h4 id="returns-10">
  Renvoie
</h4>

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

<h4 id="example-3">
  Exemple
</h4>

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

***

<h3 id="getagentturn">
  getAgentTurn()
</h3>

> **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).

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

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

<h4 id="returns-11">
  Renvoie
</h4>

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

<h4 id="example-4">
  Exemple
</h4>

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

***

<h3 id="getagentturns">
  getAgentTurns()
</h3>

> **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).

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

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

<h4 id="returns-12">
  Renvoie
</h4>

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

<h4 id="example-5">
  Exemple
</h4>

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

***

<h3 id="getagentversions">
  getAgentVersions()
</h3>

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

Liste les versions d’un agent donné.

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

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

<h4 id="returns-13">
  Renvoie
</h4>

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

<h4 id="example-6">
  Exemple
</h4>

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

***

<h3 id="getcall">
  getCall()
</h3>

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

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

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

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

<h4 id="returns-14">
  Renvoie
</h4>

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

***

<h3 id="getcalls">
  getCalls()
</h3>

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

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

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

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

<h5 id="returns-15">
  Renvoie
</h5>

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

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

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

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

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

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

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

<h5 id="returns-16">
  Renvoie
</h5>

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

***

<h3 id="getcallsiterator">
  getCallsIterator()
</h3>

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

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

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

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

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

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

<h5 id="returns-17">
  Renvoie
</h5>

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

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

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

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

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

<h5 id="returns-18">
  Renvoie
</h5>

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

***

<h3 id="getcallstack">
  getCallStack()
</h3>

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

<h4 id="returns-19">
  Renvoie
</h4>

`CallStack`

***

<h3 id="getcurrentattributes">
  getCurrentAttributes()
</h3>

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

<h4 id="returns-20">
  Renvoie
</h4>

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

***

<h3 id="linkprompttoregistry">
  linkPromptToRegistry()
</h3>

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

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

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

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

<h4 id="returns-21">
  Renvoie
</h4>

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

***

<h3 id="pendingcallcount">
  pendingCallCount()
</h3>

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

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

<h4 id="returns-22">
  Renvoie
</h4>

`number`

***

<h3 id="publish">
  publish()
</h3>

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

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

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

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

<h4 id="returns-23">
  Renvoie
</h4>

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

***

<h3 id="pushnewcall">
  pushNewCall()
</h3>

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

<h4 id="returns-24">
  Renvoie
</h4>

`objet`

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

  > **callId**: `string`

  <h6 id="currentcallchildsummary">
    currentCall.childSummary
  </h6>

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

  <h6 id="currentcalldisplayname">
    currentCall.displayName
  </h6>

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

  <h6 id="currentcallopname">
    currentCall.opName
  </h6>

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

  <h6 id="currentcalltraceid">
    currentCall.traceId
  </h6>

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

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

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

  > **callId**: `string`

  <h6 id="parentcallchildsummary">
    parentCall.childSummary
  </h6>

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

  <h6 id="parentcalldisplayname">
    parentCall.displayName
  </h6>

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

  <h6 id="parentcallopname">
    parentCall.opName
  </h6>

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

  <h6 id="parentcalltraceid">
    parentCall.traceId
  </h6>

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

***

<h3 id="registercustomruntime">
  registerCustomRuntime()
</h3>

> **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à.

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

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

<h4 id="returns-25">
  Renvoie
</h4>

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

***

<h3 id="runwithattributes">
  runWithAttributes()
</h3>

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

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

<ParamField path="T" />

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

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

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

<h4 id="returns-26">
  Renvoie
</h4>

`T`

***

<h3 id="runwithcallstack">
  runWithCallStack()
</h3>

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

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

<ParamField path="T" />

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

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

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

<h4 id="returns-27">
  Renvoie
</h4>

`T`

***

<h3 id="savecallend">
  saveCallEnd()
</h3>

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

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

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

<h4 id="returns-28">
  Renvoie
</h4>

`void`

***

<h3 id="savecallstart">
  saveCallStart()
</h3>

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

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

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

<h4 id="returns-29">
  Renvoie
</h4>

`void`

***

<h3 id="saveop">
  saveOp()
</h3>

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

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

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

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

<h4 id="returns-30">
  Renvoie
</h4>

`Promise`\<`OpRef`>

***

<h3 id="searchagents">
  searchAgents()
</h3>

> **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.

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

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

<h4 id="returns-31">
  Renvoie
</h4>

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

<h4 id="example-7">
  Exemple
</h4>

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

***

<h3 id="serializeaudio">
  serializeAudio()
</h3>

> **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é.

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

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

<h4 id="returns-32">
  Renvoie
</h4>

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

***

<h3 id="updatecall">
  updateCall()
</h3>

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

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

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

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

<h4 id="returns-33">
  Renvoie
</h4>

`Promise`\<`void`>

***

<h3 id="waitforbatchprocessing">
  waitForBatchProcessing()
</h3>

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

<h4 id="returns-34">
  Renvoie
</h4>

`Promise`\<`void`>
