Properties
projectId
projectId: string
Defined in: src/weaveClient.ts:538
settings
settings: object
Defined in: src/weaveClient.ts:539
attributes
A map of attributes applied to every trace produced by this client.readonlyattributes:Record<string,any>
genai
readonlygenai:object
genai.batchOptions
optionalbatchOptions:BufferConfig
BatchSpanProcessor configuration. Ignored unless spanProcessor === 'batch'.
genai.spanProcessor
How GenAI spans are exported.optionalspanProcessor:"batch"|"simple"|SpanProcessor
'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.SpanProcessorinstance: a user-supplied processor. The caller owns its lifecycle; the Weave OTLP exporter targeting/agents/otel/v1/tracesis not used.
printCallLink
Prints links in terminal to Weave UI for ops.readonlyprintCallLink:boolean
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:Defined in: src/weaveClient.ts:537Api<any>
Methods
addScore()
addScore(Add a scorer result (e.g., scorer output) to a call. Used in imperative evaluation to attach scorer results to predict calls. Defined in: src/weaveClient.ts:2165predictCallId,scorerCallId,runnableRefUri,scorerOutput):Promise<string>
Parameters
predictCallId
string
ID of the predict call to attach feedback to
scorerCallId
string
ID of the scorer call that generated the feedback
runnableRefUri
string
URI of the scorer (Op or Object ref)
scorerOutput
any
Output of the scorer
Returns
Promise<string>
createCall()
createCall(Defined in: src/weaveClient.ts:1994internalCall,opRef,params,parameterNames,thisArg,currentCall,parentCall,startTime,displayName?,attributes?,eagerCallStart?):Promise<void>
Parameters
internalCall
InternalCall
opRef
any
params
any[]
parameterNames
undefined | "useParam0Object" | string[]
thisArg
any
currentCall
callId
string
childSummary
Record<string, any>
displayName?
string
opName?
string
traceId
string
parentCall
{callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
startTime
Date
displayName?
string
attributes?
Record<string, any>
eagerCallStart?
boolean = false
Returns
Promise<void>
finishCall()
finishCall(Defined in: src/weaveClient.ts:2068call,result,currentCall,parentCall,summarize,endTime,startCallPromise):Promise<void>
Parameters
call
InternalCall
result
any
currentCall
callId
string
childSummary
Record<string, any>
displayName?
string
opName?
string
traceId
string
parentCall
{callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
summarize
((result) => Record<string, any>) | undefined
endTime
Date
startCallPromise
Promise<void>
Returns
Promise<void>
finishCallWithException()
finishCallWithException(Defined in: src/weaveClient.ts:2110call,error,currentCall,parentCall,endTime,startCallPromise):Promise<void>
Parameters
call
InternalCall
error
any
currentCall
callId
string
childSummary
Record<string, any>
displayName?
string
opName?
string
traceId
string
parentCall
{callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined
endTime
Date
startCallPromise
Promise<void>
Returns
Promise<void>
flush()
flush():Deliver all buffered calls to the server. Await beforePromise<void>
process.exit().
Defined in: src/weaveClient.ts:919
Returns
Promise<void>
get()
get(Defined in: src/weaveClient.ts:1351ref):Promise<any>
Parameters
ref
ObjectRef
Returns
Promise<any>
getAgentCustomAttributes()
getAgentCustomAttributes(Discover typed custom-attribute keys observed on agent spans in the project. Each result row is oneoptions):Promise<Response<{attributes?:object[];has_more?:boolean;limit?:number;offset?:number; }>>
(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.
Defined in: src/weaveClient.ts:877
Parameters
options
limit?
number
Min
1
Max
2000
Default
offset?
number
Min
0
Default
query?
Query | null
startedAfter?
string | null
startedBefore?
string | null
Returns
Promise<Response<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>
Example
getAgents()
getAgents(List agents with aggregated stats. Defined in: src/weaveClient.ts:593options?):Promise<Response<GetAgentsResult>>
Parameters
options?
GetAgentsOptions = {}
Returns
Promise<Response<GetAgentsResult>>
Example
getAgentSpans()
getAgentSpans(Query agent spans, optionally filtered by agent name and/or a mongo-style query expression. Defined in: src/weaveClient.ts:671options):Promise<Response<GetAgentSpansResult>>
Parameters
options
GetAgentSpansOptions
Returns
Promise<Response<GetAgentSpansResult>>
Examples
getAgentSpanStats()
getAgentSpanStats(Agregations over agent spans in the project, returned as rows + column metadata suitable for time-series / bucketed visualizations.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; }>>
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.
Defined in: src/weaveClient.ts:726
Parameters
options
end?
string | null
granularity?
number | null
groupBy?
object[]
metrics
object[]
query?
Query | null
start
string
timezone?
string
Default
Returns
Promise<Response<{ bucket_type?: "number" | "time"; columns?: object[]; end: string; granularity?: number | null; rows?: Record<string, string | number | boolean | null>[]; start: string; timezone: string; }>>
Example
getAgentTurn()
getAgentTurn(Get data (including messages) for a single turn (by traceId). Defined in: src/weaveClient.ts:760options):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; }>>
Parameters
options
GetAgentTurnOptions
Returns
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; }>>
Example
getAgentTurns()
getAgentTurns(Get data (including messages) for many turns (by conversationId). Defined in: src/weaveClient.ts:793options):Promise<Response<GetAgentTurnsResult>>
Parameters
options
GetAgentTurnsOptions
Returns
Promise<Response<GetAgentTurnsResult>>
Example
getAgentVersions()
getAgentVersions(List versions for a given agent. Defined in: src/weaveClient.ts:627options):Promise<Response<GetAgentVersionsResult>>
Parameters
options
GetAgentVersionsOptions
Returns
Promise<Response<GetAgentVersionsResult>>
Example
getCall()
getCall(Defined in: src/weaveClient.ts:1228callId,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
callId
string
includeCosts?
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(Defined in: src/weaveClient.ts:1261options?):Promise<object[]>
Parameters
options?
GetCallsOptions
Returns
Promise<object[]>
Call Signature
getCalls(Defined in: src/weaveClient.ts:1262options?,includeCosts?,limit?):Promise<object[]>
Parameters
options?
CallsFilter
includeCosts?
boolean
limit?
number
Returns
Promise<object[]>
getCallsIterator()
Call Signature
getCallsIterator(Defined in: src/weaveClient.ts:1283options?,includeCosts?,limit?):AsyncIterableIterator<CallSchema>
Parameters
options?
CallsFilter
includeCosts?
boolean
limit?
number
Returns
AsyncIterableIterator<CallSchema>
Call Signature
getCallsIterator(Defined in: src/weaveClient.ts:1288options?):AsyncIterableIterator<CallSchema>
Parameters
options?
GetCallsOptions
Returns
AsyncIterableIterator<CallSchema>
getCallStack()
getCallStack(): CallStack
Defined in: src/weaveClient.ts:1901
Returns
CallStack
getCurrentAttributes()
getCurrentAttributes():Defined in: src/weaveClient.ts:1905Record<string,any>
Returns
Record<string, any>
linkPromptToRegistry()
linkPromptToRegistry(Link a published prompt version into a registry portfolio. Defined in: src/weaveClient.ts:1510prompt,options):Promise<{version_index:number|null; }>
Parameters
prompt
string | ObjectRef | Prompt
options
aliases?
string[]
targetPath
string
Returns
Promise<{ version_index: number | null; }>
pendingCallCount()
pendingCallCount(): number
Calls buffered client-side but not yet delivered to the server.
Defined in: src/weaveClient.ts:924
Returns
number
publish()
publish(Defined in: src/weaveClient.ts:1216obj,objId?):Promise<ObjectRef>
Parameters
obj
any
objId?
string
Returns
Promise<ObjectRef>
pushNewCall()
pushNewCall(): object
Defined in: src/weaveClient.ts:1909
Returns
object
currentCall
currentCall: object
currentCall.callId
callId: string
currentCall.childSummary
childSummary:Record<string,any>
currentCall.displayName
optionaldisplayName:string
currentCall.opName
optionalopName:string
currentCall.traceId
traceId: string
newStack
newStack: CallStack
parentCall
optionalparentCall:object
parentCall.callId
callId: string
parentCall.childSummary
childSummary:Record<string,any>
parentCall.displayName
optionaldisplayName:string
parentCall.opName
optionalopName:string
parentCall.traceId
traceId: string
registerCustomRuntime()
registerCustomRuntime(Register a custom runtime, replacing its complete configuration if it exists. Defined in: src/weaveClient.ts:557options):Promise<Response<{api_key_secret:string|null;base_url:string;headers:Record<string,string>;name:string;runtime_ids:object[]; }>>
Parameters
options
RegisterCustomRuntimeOptions
Returns
Promise<Response<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>
runWithAttributes()
runWithAttributes<Defined in: src/weaveClient.ts:1917T>(attributes,fn):T
Type Parameters
T
T
Parameters
attributes
Record<string, any>
fn
() =>T
Returns
T
runWithCallStack()
runWithCallStack<Defined in: src/weaveClient.ts:1913T>(callStack,fn):T
Type Parameters
T
T
Parameters
callStack
CallStack
fn
() =>T
Returns
T
saveCallEnd()
saveCallEnd(Defined in: src/weaveClient.ts:1863callEnd):void
Parameters
callEnd
object & object
Returns
void
saveCallStart()
saveCallStart(Defined in: src/weaveClient.ts:1828callStart,opts?):void
Parameters
callStart
attributes
Record<string, any>
Attributes
display_name?
string | null
Display Name
id?
string | null
Id
inputs
Record<string, any>
Inputs
op_name
string
Op Name
otel_dump?
Record<string, any> | null
Otel Dump
parent_id?
string | null
Parent Id
project_id
string
Project Id
started_at
string
Started At
Format
date-time
thread_id?
string | null
Thread Id
trace_id?
string | null
Trace Id
turn_id?
string | null
Turn Id
wb_run_id?
string | null
Wb Run Id
wb_run_step?
number | null
Wb Run Step
wb_user_id?
string | null
Wb User Id
Do not set directly. Server will automatically populate this field.
opts?
eager?
boolean
Returns
void
saveOp()
saveOp(Defined in: src/weaveClient.ts:1961op,objId?):Promise<OpRef>
Parameters
op
Op<(…args) => any>
objId?
string
Returns
Promise<OpRef>
searchAgents()
searchAgents(Full-text search across agent messages in the project. Returns hits grouped by conversation, with a preview of each matched message.options):Promise<Response<{results:object[];total_conversations?:number; }>>
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.
Defined in: src/weaveClient.ts:835
Parameters
options
agentName?
string | null
conversationId?
string | null
limit?
number
Limit
Min
0
Max
1000
Default
offset?
number
Offset
Min
0
Default
query
string
traceId?
string | null
Returns
Promise<Response<{ results: object[]; total_conversations?: number; }>>
Example
serializeAudio()
serializeAudio(Upload raw audio bytes to the Weave content store and return thedata,audioType?):Promise<{_type:"CustomWeaveType";files:Record<string,string>;load_op:string;weave_type: {type:string; }; }>
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.
Defined in: src/weaveClient.ts:1765
Parameters
data
Buffer
Raw audio bytes (WAV for best browser compatibility)
audioType?
"wav" = DEFAULT_AUDIO_TYPE
File format — currently only ‘wav’ is supported
Returns
Promise<{ _type: "CustomWeaveType"; files: Record<string, string>; load_op: string; weave_type: { type: string; }; }>
updateCall()
updateCall(Defined in: src/weaveClient.ts:2148callId,displayName):Promise<void>
Parameters
callId
string
displayName
string
Returns
Promise<void>
waitForBatchProcessing()
waitForBatchProcessing():Defined in: src/weaveClient.ts:907Promise<void>
Returns
Promise<void>