Skip to main content
weave / SubAgent

Hierarchy

  • SpanBase SubAgent

Table of contents

Accessors

Methods

Accessors

model

get model(): string

Returns

string

Defined in

src/genai/subagent.ts:78

name

get name(): string

Returns

string

Defined in

src/genai/subagent.ts:74

Methods

addEvent

Deprecated. Record this data via setAttributes instead. OpenTelemetry is phasing out the Span Event API (Span.addEvent). This method still works and existing span-event data stays valid. See https://opentelemetry.io/blog/2026/deprecating-span-events/Example
span.addEvent('context_compacted', {: 12});
addEvent(name, attributes?, startTime?): this Add a named event to the span. Useful for marking non-span moments such as context compaction, tool-loop detection, or guardrail trips. Warns and no-ops after end(). Mirrors OTel Span.addEvent.

Parameters

NameType
namestring
attributes?Attributes
startTime?TimeInput

Returns

this

Inherited from

SpanBase.addEvent

Defined in

src/genai/spanBase.ts:82

end

end(opts?): void Read current field values (to reflect mutations made via record() since start) and close the span. Idempotent. Pass error to mark it as failed; pass endTime to backdate the close.

Parameters

NameType
opts?SpanEndOptions

Returns

void

Defined in

src/genai/subagent.ts:153

record

record(opts): this Bulk-set any fields. Replaces (does not merge).

Parameters

NameType
optsObject
opts.agentDescription?string
opts.agentId?string
opts.agentVersion?string
opts.model?string
opts.name?string
opts.systemInstructions?string[]

Returns

this

Defined in

src/genai/subagent.ts:117

setAttributes

setAttributes(attributes): this Set multiple attributes on the span at once. Warns and no-ops after end(). Mirrors OTel Span.setAttributes (and the Python SDK’s set_attributes).

Parameters

NameType
attributesAttributes

Returns

this Example
span.setAttributes({'weave.tag': 'prod', 'gen_ai.response.id': id});

Inherited from

SpanBase.setAttributes

Defined in

src/genai/spanBase.ts:63

create

create(opts): SubAgent

Parameters

NameType
optsSubAgentInit & ChildSpanContext

Returns

SubAgent

Defined in

src/genai/subagent.ts:93