Skip to main content

Propriétés

projectId

projectId : string

settings

settings : object

attributes

readonly attributes: Record<string, any>
Table de correspondance des attributs appliqués à chaque trace produite par ce client.

genai

readonly genai: object
optional batchOptions : BufferConfig
Configuration de BatchSpanProcessor. Ignorée sauf si spanProcessor === 'batch'.
optional spanProcessor: "batch" | "simple" | SpanProcessor
Mode d’exportation 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 à exécution brève, lorsqu’un vidage déterministe compte davantage que le débit.
  • Instance de SpanProcessor : un processeur fourni par l’utilisateur. L’appelant gère son cycle de vie ; l’exportateur OTLP de Weave ciblant /agents/otel/v1/traces n’est pas utilisé.
readonly printCallLink: boolean
Affiche dans le terminal des liens vers l’interface Weave pour les ops. true

useCallsComplete

useCallsComplete: boolean
Envoie les appels terminés au point de terminaison calls/complete (début et fin appariés côté client) plutôt qu’au chemin historique call/upsert_batch. true

useOTelV2

useOTelV2: boolean
Achemine les intégrations compatibles OTel via leur variante OTel. true

traceServerApi

traceServerApi: Api<any>

Méthodes

addScore()

addScore(predictCallId, scorerCallId, runnableRefUri, scorerOutput): Promise<string>
Ajoute un résultat de scorer (par exemple, la sortie d’un scorer) à un appel. Utilisé dans l’évaluation impérative pour joindre les résultats de scorer aux appels de prédiction.

Paramètres

string
requis
ID de l’appel de prédiction auquel joindre le feedback
string
requis
ID de l’appel du scorer qui a généré le feedback
string
requis
URI du scorer (réf. d’op ou d’objet)
any
requis
Sortie du scorer

Renvoie

Promise<string>

createCall()

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

Paramètres

InternalCall
requis
any
requis
any[]
requis
undefined | "useParam0Object" | string[]
requis
any
requis
object
requis
{…} | undefined
requis
Type complet : { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
Date
requis
string
Record<string, any>
boolean = false

Renvoie

Promise<void>

finishCall()

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

Paramètres

InternalCall
requis
any
requis
object
requis
{…} | undefined
requis
Type complet : { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
((result) => Record<string, any>) | undefined
requis
Date
requis
Promise<void>
requis

Renvoie

Promise<void>

finishCallWithException()

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

Paramètres

InternalCall
requis
any
requis
object
requis
{…} | undefined
requis
Type complet : { callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
Date
requis
Promise<void>
requis

Renvoie

Promise<void>

flush()

flush(): Promise<void>
Envoie au serveur tous les appels en mémoire tampon. Attendez sa résolution avec await avant d’appeler process.exit().

Renvoie

Promise<void>

get()

get(ref): Promise<any>

Paramètres

ObjectRef
requis
Voir ObjectRef.

Renvoie

Promise<any>

getAgentCustomAttributes()

getAgentCustomAttributes(options): Promise<Response<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>
Découvre les clés d’attributs personnalisés typées observées sur 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. C’est ce triplet que les API query/group/stats des spans utilisent pour référencer les attributs personnalisés. Filtrez les spans pris en compte en passant query (un filtre de spans structuré), startedAfter / startedBefore (ISO-8601), ou les deux. Utilisez limit / offset pour parcourir les clés découvertes page par page.

Paramètres

object
requis

Renvoie

Promise<Response<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>

Exemple


getAgents()

getAgents(options?): Promise<Response<GetAgentsResult>>
Liste les agents avec leurs statistiques agrégées.

Paramètres

GetAgentsOptions = {}

Renvoie

Promise<Response<GetAgentsResult>>

Exemple


getAgentSpans()

getAgentSpans(options): Promise<Response<GetAgentSpansResult>>
Interroge les spans d’agent, avec un filtrage facultatif par nom d’agent et/ou par une expression de requête de type MongoDB.

Paramètres

GetAgentSpansOptions
requis

Renvoie

Promise<Response<GetAgentSpansResult>>

Exemples


getAgentSpanStats()

getAgentSpanStats(options): Promise<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 accompagnées de métadonnées de colonnes, adaptées aux visualisations de séries temporelles ou par intervalles. start (requis) et end définissent la fenêtre temporelle. Chaque entrée de metrics déclare un champ à extraire et sa méthode d’agrégation (sum, avg, count, percentiles, etc.). Passez granularity (en secondes) pour regrouper les lignes par intervalle de temps, ou groupBy pour ventiler les résultats par agent, fournisseur, modèle, etc. query filtre les spans sous-jacents avant l’agrégation.

Paramètres

object
requis

Renvoie

Promise<Response<{ bucket_type?: "number" | "time"; columns?: object[]; end: string; granularity?: number | null; rows?: Record<string, string | number | boolean | null>[]; start: string; timezone: string; }>>

Exemple


getAgentTurn()

getAgentTurn(options): Promise<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 (messages compris) d’un tour de conversation donné, identifié par son traceId.

Paramètres

GetAgentTurnOptions
requis

Renvoie

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

Exemple


getAgentTurns()

getAgentTurns(options): Promise<Response<GetAgentTurnsResult>>
Obtient les données (messages compris) de plusieurs tours de conversation, par conversationId.

Paramètres

GetAgentTurnsOptions
requis

Renvoie

Promise<Response<GetAgentTurnsResult>>

Exemple


getAgentVersions()

getAgentVersions(options): Promise<Response<GetAgentVersionsResult>>
Liste les versions d’un agent donné.

Paramètres

GetAgentVersionsOptions
requis

Renvoie

Promise<Response<GetAgentVersionsResult>>

Exemple


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

Paramètres

string
requis
boolean = false

Renvoie

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

Signature d’appel

getCalls(options?): Promise<object[]>
GetCallsOptions
Promise<object[]>

Signature d’appel

getCalls(options?, includeCosts?, limit?): Promise<object[]>
CallsFilter
boolean
number
Promise<object[]>

getCallsIterator()

Signature d’appel

getCallsIterator(options?, includeCosts?, limit?): AsyncIterableIterator<CallSchema>
CallsFilter
boolean
number
AsyncIterableIterator<CallSchema>

Signature d’appel

getCallsIterator(options?): AsyncIterableIterator<CallSchema>
GetCallsOptions
AsyncIterableIterator<CallSchema>

getCallStack()

getCallStack(): CallStack

Renvoie

CallStack

getCurrentAttributes()

getCurrentAttributes(): Record<string, any>

Renvoie

Record<string, any>

linkPromptToRegistry()

linkPromptToRegistry(prompt, options): Promise<{ version_index: number | null; }>
Lie une version publiée d’un prompt à un portfolio d’un registre.

Paramètres

string | ObjectRef | Prompt
requis
Voir ObjectRef.
object
requis

Renvoie

Promise<{ version_index: number | null; }>

pendingCallCount()

pendingCallCount(): number
Nombre d’appels mis en mémoire tampon côté client, mais pas encore transmis au serveur.

Renvoie

number

publish()

publish(obj, objId?): Promise<ObjectRef>

Paramètres

any
requis
string

Renvoie

Promise<ObjectRef>

pushNewCall()

pushNewCall(): object

Renvoie

object
object
requis
callId: string
childSummary: Record<string, any>
optional displayName: string
optional opName: string
traceId: string
CallStack
requis
object
callId: string
childSummary: Record<string, any>
optional displayName: string
optional opName: string
traceId: string

registerCustomRuntime()

registerCustomRuntime(options): Promise<Response<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>
Enregistre un environnement d’exécution personnalisé et remplace l’intégralité de sa configuration s’il existe déjà.

Paramètres

RegisterCustomRuntimeOptions
requis

Renvoie

Promise<Response<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>

runWithAttributes()

runWithAttributes<T>(attributes, fn): T

Paramètres de type

Paramètres

Record<string, any>
requis
() => T
requis

Renvoie

T

runWithCallStack()

runWithCallStack<T>(callStack, fn): T

Paramètres de type

Paramètres

CallStack
requis
() => T
requis

Renvoie

T

saveCallEnd()

saveCallEnd(callEnd): void

Paramètres

object & object
requis

Renvoie

void

saveCallStart()

saveCallStart(callStart, opts?): void

Paramètres

object
requis
object

Renvoie

void

saveOp()

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

Paramètres

Op<(...args) => any>
requis
Voir Op.
string

Renvoie

Promise<OpRef>

searchAgents()

searchAgents(options): Promise<Response<{ results: object[]; total_conversations?: number; }>>
Recherche en texte intégral dans les messages des agents du projet. Renvoie les résultats regroupés par conversation, avec un aperçu de chaque message correspondant. query est le terme de recherche en texte intégral. Passez une chaîne vide pour récupérer tous les messages correspondant aux filtres structurés (agentName, conversationId, traceId), sans correspondance textuelle. Utilisez limit / offset pour paginer les résultats.

Paramètres

object
requis

Renvoie

Promise<Response<{ results: object[]; total_conversations?: number; }>>

Exemple


serializeAudio()

serializeAudio(data, audioType?): Promise<{ _type: "CustomWeaveType"; files: Record<string, string>; load_op: string; weave_type: { type: string; }; }>
Téléverse des octets audio bruts dans le magasin de contenu Weave et renvoie l’espace réservé CustomWeaveType, qui peut être intégré à la sortie d’un appel. Utilisez cette méthode lorsque vous construisez manuellement les sorties d’un appel (par exemple via saveCallEnd) sans recourir au pipeline de sérialisation automatique de finishCall.

Paramètres

Buffer
requis
Octets audio bruts (WAV pour une compatibilité optimale avec les navigateurs)
"wav" = DEFAULT_AUDIO_TYPE
Format de fichier — seul ‘wav’ est actuellement pris en charge

Renvoie

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

updateCall()

updateCall(callId, displayName): Promise<void>

Paramètres

string
requis
string
requis

Renvoie

Promise<void>

waitForBatchProcessing()

waitForBatchProcessing(): Promise<void>

Renvoie

Promise<void>
Dernière modification le 30 septembre 2026