Skip to main content

Documentation Index

Fetch the complete documentation index at: https://wb-21fd5541-update-reference-docs-34.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

weave / SubAgent A nested agent invocation — used when the current agent hands work to another named agent (e.g. a planner calling a researcher). Emits an invoke_agent span tagged with the sub-agent’s name and (optionally) its model. Created by weave.startSubagent() (or turn.startAgent(), or llm.startAgent()) and terminated with end(). Example
const sub = weave.startSubagent({name: 'researcher', model: 'gpt-4o'});
try {
  // ... orchestrate the sub-agent's LLM/Tool calls ...
} finally {
  sub.end();
}

Table of contents

Properties

Methods

Properties

model

Readonly model: string

Defined in

genai/subagent.ts:41

name

Readonly name: string

Defined in

genai/subagent.ts:40

Methods

end

end(opts?): void Close the SubAgent span. Idempotent. Pass error to mark it as failed.

Parameters

NameType
opts?Object
opts.error?Error

Returns

void

Defined in

genai/subagent.ts:65

create

create(opts): SubAgent

Parameters

NameType
optsSubAgentInit & ChildSpanContext

Returns

SubAgent

Defined in

genai/subagent.ts:44