Table of contents
Constructors
Properties
Methods
- addScore
- createCall
- finishCall
- finishCallWithException
- get
- getAgentCustomAttributes
- getAgentSpanStats
- getAgentSpans
- getAgentTurn
- getAgentTurns
- getAgentVersions
- getAgents
- getCall
- getCallStack
- getCalls
- getCallsIterator
- getCurrentAttributes
- linkPromptToRegistry
- publish
- pushNewCall
- runWithAttributes
- runWithCallStack
- saveCallEnd
- saveCallStart
- saveOp
- searchAgents
- serializeAudio
- updateCall
- waitForBatchProcessing
Constructors
constructor
• new WeaveClient(«destructured»): WeaveClient
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› projectId | string |
› settings? | Partial<Settings> |
› traceServerApi | Api<any> |
Returns
WeaveClient
Defined in
src/weaveClient.ts:459Properties
projectId
• projectId:string
Defined in
src/weaveClient.ts:456settings
• settings:Settings
Defined in
src/weaveClient.ts:457traceServerApi
• traceServerApi:Api<any>
Defined in
src/weaveClient.ts:455Methods
addScore
▸ addScore(predictCallId, scorerCallId, runnableRefUri, scorerOutput): Promise<string>
Add a scorer result (e.g., scorer output) to a call.
Used in imperative evaluation to attach scorer results to predict calls.
Parameters
| Name | Type | Description |
|---|---|---|
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>
Defined in
src/weaveClient.ts:1727createCall
▸ createCall(internalCall, opRef, params, parameterNames, thisArg, currentCall, parentCall, startTime, displayName?, attributes?): Promise<void>
Parameters
| Name | Type |
|---|---|
internalCall | InternalCall |
opRef | any |
params | any[] |
parameterNames | ParameterNamesOption |
thisArg | any |
currentCall | CallStackEntry |
parentCall | undefined | CallStackEntry |
startTime | Date |
displayName? | string |
attributes? | Record<string, any> |
Returns
Promise<void>
Defined in
src/weaveClient.ts:1570finishCall
▸ finishCall(call, result, currentCall, parentCall, summarize, endTime, startCallPromise): Promise<void>
Parameters
| Name | Type |
|---|---|
call | InternalCall |
result | any |
currentCall | CallStackEntry |
parentCall | undefined | CallStackEntry |
summarize | undefined | (result: any) => Record<string, any> |
endTime | Date |
startCallPromise | Promise<void> |
Returns
Promise<void>
Defined in
src/weaveClient.ts:1630finishCallWithException
▸ finishCallWithException(call, error, currentCall, parentCall, endTime, startCallPromise): Promise<void>
Parameters
| Name | Type |
|---|---|
call | InternalCall |
error | any |
currentCall | CallStackEntry |
parentCall | undefined | CallStackEntry |
endTime | Date |
startCallPromise | Promise<void> |
Returns
Promise<void>
Defined in
src/weaveClient.ts:1672get
▸ get(ref): Promise<any>
Parameters
| Name | Type |
|---|---|
ref | ObjectRef |
Returns
Promise<any>
Defined in
src/weaveClient.ts:1025getAgentCustomAttributes
▸ getAgentCustomAttributes(options): Promise<Response<GetAgentCustomAttributesResult>>
Discover typed custom-attribute keys observed on agent spans in the
project. Each result row is one (source, key, value_type) triple plus
a count of how many spans carry it, which is what the spans
query/group/stats APIs use to reference custom attrs.
Filter the spans considered by passing query (a structured span
filter), startedAfter / startedBefore (ISO-8601), or both. Use
limit / offset to page through the discovered keys.
Parameters
| Name | Type |
|---|---|
options | GetAgentCustomAttributesOptions |
Returns
Promise<Response<GetAgentCustomAttributesResult>>
Example
Defined in
src/weaveClient.ts:772getAgentSpanStats
▸ getAgentSpanStats(options): Promise<Response<GetAgentSpanStatsResult>>
Agregations over agent spans in the project, returned as rows + column
metadata suitable for time-series / bucketed visualizations.
start (required) and end define the time window. Each entry in
metrics declares a field to extract and how to aggregate it (sum,
avg, count, percentiles, etc.). Pass granularity (seconds) to
bucket rows by time, or groupBy to break results out per agent /
provider / model / etc. query filters the underlying spans before
aggregation.
Parameters
| Name | Type |
|---|---|
options | GetAgentSpanStatsOptions |
Returns
Promise<Response<GetAgentSpanStatsResult>>
Example
Defined in
src/weaveClient.ts:621getAgentSpans
▸ getAgentSpans(options): Promise<Response<GetAgentSpansResult>>
Query agent spans, optionally filtered by agent name and/or a mongo-style
query expression.
Parameters
| Name | Type |
|---|---|
options | GetAgentSpansOptions |
Returns
Promise<Response<GetAgentSpansResult>>
Example
Example
Defined in
src/weaveClient.ts:566getAgentTurn
▸ getAgentTurn(options): Promise<Response<AgentTraceChatRes>>
Get data (including messages) for a single turn (by traceId).
Parameters
| Name | Type |
|---|---|
options | GetAgentTurnOptions |
Returns
Promise<Response<AgentTraceChatRes>>
Example
Defined in
src/weaveClient.ts:655getAgentTurns
▸ getAgentTurns(options): Promise<Response<GetAgentTurnsResult>>
Get data (including messages) for many turns (by conversationId).
Parameters
| Name | Type |
|---|---|
options | GetAgentTurnsOptions |
Returns
Promise<Response<GetAgentTurnsResult>>
Example
Defined in
src/weaveClient.ts:688getAgentVersions
▸ getAgentVersions(options): Promise<Response<GetAgentVersionsResult>>
List versions for a given agent.
Parameters
| Name | Type |
|---|---|
options | GetAgentVersionsOptions |
Returns
Promise<Response<GetAgentVersionsResult>>
Example
Defined in
src/weaveClient.ts:522getAgents
▸ getAgents(options?): Promise<Response<GetAgentsResult>>
List agents with aggregated stats.
Parameters
| Name | Type |
|---|---|
options | GetAgentsOptions |
Returns
Promise<Response<GetAgentsResult>>
Example
Defined in
src/weaveClient.ts:488getCall
▸ getCall(callId, includeCosts?): Promise<Call>
Parameters
| Name | Type | Default value |
|---|---|---|
callId | string | undefined |
includeCosts | boolean | false |
Returns
Promise<Call>
Defined in
src/weaveClient.ts:902getCallStack
▸ getCallStack():CallStack
Returns
CallStack
Defined in
src/weaveClient.ts:1482getCalls
▸ getCalls(options?): Promise<Call[]>
Parameters
| Name | Type |
|---|---|
options? | GetCallsOptions |
Returns
Promise<Call[]>
Defined in
src/weaveClient.ts:935 ▸ getCalls(options?, includeCosts?, limit?): Promise<Call[]>
Parameters
| Name | Type |
|---|---|
options? | CallsFilter |
includeCosts? | boolean |
limit? | number |
Returns
Promise<Call[]>
Defined in
src/weaveClient.ts:936getCallsIterator
▸ getCallsIterator(options?, includeCosts?, limit?): AsyncIterableIterator<CallSchema, any, any>
Parameters
| Name | Type |
|---|---|
options? | CallsFilter |
includeCosts? | boolean |
limit? | number |
Returns
AsyncIterableIterator<CallSchema, any, any>
Defined in
src/weaveClient.ts:957 ▸ getCallsIterator(options?): AsyncIterableIterator<CallSchema, any, any>
Parameters
| Name | Type |
|---|---|
options? | GetCallsOptions |
Returns
AsyncIterableIterator<CallSchema, any, any>
Defined in
src/weaveClient.ts:962getCurrentAttributes
▸ getCurrentAttributes():Record<string, any>
Returns
Record<string, any>
Defined in
src/weaveClient.ts:1486linkPromptToRegistry
▸ linkPromptToRegistry(prompt, options): Promise<LinkAssetToRegistryRes>
Link a published prompt version into a registry portfolio.
Parameters
| Name | Type |
|---|---|
prompt | RegistryLinkable |
options | LinkPromptToRegistryOptions |
Returns
Promise<LinkAssetToRegistryRes>
Defined in
src/weaveClient.ts:1181publish
▸ publish(obj, objId?): Promise<ObjectRef>
Parameters
| Name | Type |
|---|---|
obj | any |
objId? | string |
Returns
Promise<ObjectRef>
Defined in
src/weaveClient.ts:890pushNewCall
▸ pushNewCall():Object
Returns
Object
| Name | Type |
|---|---|
currentCall | CallStackEntry |
newStack | CallStack |
parentCall? | CallStackEntry |
Defined in
src/weaveClient.ts:1490runWithAttributes
▸ runWithAttributes<T>(attributes, fn): T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
attributes | Record<string, any> |
fn | () => T |
Returns
T
Defined in
src/weaveClient.ts:1498runWithCallStack
▸ runWithCallStack<T>(callStack, fn): T
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
callStack | CallStack |
fn | () => T |
Returns
T
Defined in
src/weaveClient.ts:1494saveCallEnd
▸ saveCallEnd(callEnd): void
Parameters
| Name | Type |
|---|---|
callEnd | EndedCallSchemaForInsert |
Returns
void
Defined in
src/weaveClient.ts:1477saveCallStart
▸ saveCallStart(callStart): void
Parameters
| Name | Type |
|---|---|
callStart | StartedCallSchemaForInsert |
Returns
void
Defined in
src/weaveClient.ts:1472saveOp
▸ saveOp(op, objId?): Promise<OpRef>
Parameters
| Name | Type |
|---|---|
op | Op<(…args: any[]) => any> |
objId? | string |
Returns
Promise<OpRef>
Defined in
src/weaveClient.ts:1537searchAgents
▸ searchAgents(options): Promise<Response<SearchAgentsResult>>
Full-text search across agent messages in the project. Returns hits
grouped by conversation, with a preview of each matched message.
query is the full-text search term. Pass an empty string to retrieve
all messages matching the structured filters (agentName,
conversationId, traceId) without text matching. Use limit /
offset to page through results.
Parameters
| Name | Type |
|---|---|
options | SearchAgentsOptions |
Returns
Promise<Response<SearchAgentsResult>>
Example
Defined in
src/weaveClient.ts:730serializeAudio
▸ serializeAudio(data, audioType?): Promise<SerializedFileBlob>
Upload raw audio bytes to the Weave content store and return the
CustomWeaveType placeholder that can be embedded in a call output.
Use this when building call outputs manually (e.g. via saveCallEnd)
where the automatic serialization pipeline from finishCall is not used.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
data | Buffer<ArrayBufferLike> | undefined | Raw audio bytes (WAV for best browser compatibility) |
audioType | "wav" | DEFAULT_AUDIO_TYPE | File format — currently only ‘wav’ is supported |
Returns
Promise<SerializedFileBlob>
Defined in
src/weaveClient.ts:1424updateCall
▸ updateCall(callId, displayName): Promise<void>
Parameters
| Name | Type |
|---|---|
callId | string |
displayName | string |
Returns
Promise<void>
Defined in
src/weaveClient.ts:1710waitForBatchProcessing
▸ waitForBatchProcessing():Promise<void>
Returns
Promise<void>