@cognipeer/agent-sdk 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -971,23 +971,57 @@ type SubagentPolicy = {
971
971
  childContextPolicy: ChildContextPolicy;
972
972
  /** Whether ad-hoc spawns may reference the parent's tools by name. */
973
973
  allowAdhocTools: boolean;
974
+ /**
975
+ * Forward the children's streamed text to the parent's `onStream` / `stream`
976
+ * events. Off by default: a host that appends `chunk.text` would print every
977
+ * child's words as if they were the parent's answer. When on, each forwarded
978
+ * chunk carries `subagentName` / `subagentId`.
979
+ */
980
+ streamChildren?: boolean;
974
981
  };
975
982
  declare const DEFAULT_SUBAGENT_POLICY: SubagentPolicy;
976
- /** Result of a single sub-agent run (returned to the model as the tool result). */
983
+ /**
984
+ * How a child run ended.
985
+ * - `ok` — finished and produced an answer.
986
+ * - `incomplete` — stopped early (a limit, the tool-call cap, no answer): `content` is partial.
987
+ * - `blocked` — refused by policy (a `subagentStart` gate or an output guardrail).
988
+ * - `needs_input` — wanted a human (parallel fan-out cannot ask).
989
+ * - `cancelled` — the run was cancelled while the child was working.
990
+ * - `error` — threw, or its structured output failed.
991
+ */
992
+ type SubagentStatus = "ok" | "incomplete" | "blocked" | "needs_input" | "cancelled" | "error";
993
+ /** Model calls a child made, in the parent's `state.usage` shape. */
994
+ type SubagentUsage = {
995
+ perRequest: NonNullable<AgentState["usage"]>["perRequest"];
996
+ totals: NonNullable<AgentState["usage"]>["totals"];
997
+ };
998
+ /**
999
+ * Result of a single sub-agent run. The model sees a projection of it
1000
+ * (`toModelResult`: no `input`, `usage` or `durationMs`); hosts get the whole
1001
+ * thing on `subagent` events, `subagentStop` observers and the registry.
1002
+ */
977
1003
  type SubagentResult = {
978
1004
  /** Sub-agent name (registry) or role (ad-hoc). */
979
1005
  name: string;
980
1006
  mode: "registry" | "adhoc";
981
- /** The input the sub-agent was tasked with. */
982
- input: string;
983
- /** Final assistant content from the child. */
1007
+ status: SubagentStatus;
1008
+ /** The input the sub-agent was tasked with. Not echoed to the model. */
1009
+ input?: string;
1010
+ /** Final assistant content from the child (partial unless `status` is `ok`). */
984
1011
  content?: string;
985
1012
  /** Parsed structured output, when the child had an `outputSchema`. */
986
1013
  output?: any;
987
1014
  /** Latest child summary, when summarization fired. */
988
1015
  summary?: string;
989
- /** Populated when the child failed or was refused by a guard. */
1016
+ /** Set when the child produced no usable result (`error`, `blocked`, `needs_input`). */
990
1017
  error?: string;
1018
+ /** Why a result is partial or cancelled. */
1019
+ note?: string;
1020
+ /**
1021
+ * The model calls this run made. Already merged into the parent's
1022
+ * `state.usage` (each entry tagged `subagent`), so a parent budget sees them.
1023
+ */
1024
+ usage?: SubagentUsage;
991
1025
  durationMs?: number;
992
1026
  };
993
1027
  /**
@@ -2299,6 +2333,12 @@ type AgentState = {
2299
2333
  timestamp: string;
2300
2334
  turn: number;
2301
2335
  cachedInput?: number;
2336
+ /** Present when a sub-agent made this call; it was merged in from the child's run. */
2337
+ subagent?: {
2338
+ name: string;
2339
+ id: string;
2340
+ mode: "registry" | "adhoc";
2341
+ };
2302
2342
  }>;
2303
2343
  totals: Record<string, {
2304
2344
  input: number;
@@ -2667,8 +2707,14 @@ type SubagentEvent = {
2667
2707
  parallel?: boolean;
2668
2708
  /** Task input (on `start`). */
2669
2709
  input?: string;
2670
- /** Final content (on `result`). */
2710
+ /** Final content (on `result` / `error`; partial unless `status` is `ok`). */
2671
2711
  content?: string;
2712
+ /** How the child ended (on `result` and `error`). */
2713
+ status?: SubagentStatus;
2714
+ /** Why the outcome is partial or cancelled. */
2715
+ note?: string;
2716
+ /** The child's model calls (on `result` and `error`); already merged into the parent's usage. */
2717
+ usage?: SubagentUsage;
2672
2718
  error?: {
2673
2719
  message: string;
2674
2720
  };
@@ -2723,6 +2769,12 @@ type ProgressUpdate = {
2723
2769
  type StreamChunk = {
2724
2770
  text: string;
2725
2771
  isFinal?: boolean;
2772
+ /**
2773
+ * Set only on a sub-agent's chunk, and only when `subagentPolicy.streamChildren`
2774
+ * is on. A chunk without it is the top-level agent's own text.
2775
+ */
2776
+ subagentName?: string;
2777
+ subagentId?: string;
2726
2778
  };
2727
2779
  type InvokeConfig = RunnableConfig & {
2728
2780
  onEvent?: (event: SmartAgentEvent) => void;
@@ -2831,7 +2883,18 @@ type AgentInstance<TOutput = unknown> = {
2831
2883
  };
2832
2884
  type SmartAgentInstance<TOutput = unknown> = AgentInstance<TOutput>;
2833
2885
 
2834
- type SmartToolFn = (args: any) => Promise<any> | any;
2886
+ /**
2887
+ * Per-call context the tools node hands to a tool's `func` as its second
2888
+ * argument. Anything that must be true of THIS call (rather than of the tool
2889
+ * object, which sibling calls in the same turn share) belongs here.
2890
+ */
2891
+ type ToolCallContext = {
2892
+ /** The model's tool_call id for this exact call. */
2893
+ toolCallId?: string;
2894
+ cancellationToken?: any;
2895
+ signal?: AbortSignal;
2896
+ };
2897
+ type SmartToolFn = (args: any, context?: ToolCallContext) => Promise<any> | any;
2835
2898
  type ToolCachePolicy = {
2836
2899
  /** Cache scope. "run" persists for the current invoke only. */
2837
2900
  scope?: "run";
@@ -3200,13 +3263,15 @@ declare function withinDepth(currentDepth: number, policy: SubagentPolicy): {
3200
3263
  * context policy. Extracted so both `asTool` delegation and the sub-agent tools
3201
3264
  * share ONE implementation.
3202
3265
  *
3203
- * - `full` — entire parent transcript (minus its system prompt) + the input.
3204
- * - `scoped` — last user turn + the task input.
3205
- * - `minimal` — only the task input (default).
3266
+ * - `minimal` — only the task input.
3267
+ * - `scoped` — last user turn + the task input (default).
3268
+ * - `full` — entire parent transcript (minus its system prompt and the
3269
+ * current turn's unresolved tool_calls) + the task input.
3206
3270
  *
3207
- * The parent's system message is intentionally NOT carried over: the child agent
3208
- * composes its own system prompt from its `SubagentDef.systemPrompt` (or role),
3209
- * and leaking the parent's system message would suppress it.
3271
+ * `scoped` and `full` mark the transcript as background and the input as the
3272
+ * job. The parent's system message is intentionally NOT carried over: the child
3273
+ * agent composes its own system prompt from its `SubagentDef.systemPrompt` (or
3274
+ * role), and leaking the parent's system message would suppress it.
3210
3275
  */
3211
3276
  declare function seedChildMessages(policy: ChildContextPolicy, parentMessages: Message[], input: string): Message[];
3212
3277
  /**
@@ -3215,11 +3280,17 @@ declare function seedChildMessages(policy: ChildContextPolicy, parentMessages: M
3215
3280
  * or registry sub-agent can borrow a subset of the parent's capabilities.
3216
3281
  */
3217
3282
  declare function resolveSubagentTools(declared: SubagentDef["tools"] | string[] | undefined, parentTools: ToolInterface[]): Promise<ToolInterface[]>;
3218
- /** The cheap catalog block the model always sees in its system prompt. */
3283
+ /**
3284
+ * The cheap catalog block the model always sees in its system prompt: what it
3285
+ * can delegate to, how to write a task, and how to read what comes back.
3286
+ */
3219
3287
  declare function buildSubagentCatalogBlock(subagents: SubagentDef[], policy: SubagentPolicy, toolNames: {
3220
3288
  delegate: string;
3221
3289
  spawn: string;
3222
3290
  parallel: string;
3291
+ }, opts?: {
3292
+ parentToolNames?: string[];
3293
+ askUser?: boolean;
3223
3294
  }): string;
3224
3295
 
3225
3296
  /**
@@ -3230,6 +3301,10 @@ declare function buildSubagentCatalogBlock(subagents: SubagentDef[], policy: Sub
3230
3301
  * with createSmartAgent), and forward events/streaming/cancellation into each
3231
3302
  * child. Human-in-the-loop pauses inside a sequential child are surfaced to the
3232
3303
  * parent and resumed via `state.ctx.__subagentPending`.
3304
+ *
3305
+ * The `_stateRef` is shared by every call of a tool in a turn, so a call's own
3306
+ * identity (its tool_call id) comes from the per-call context the tools node
3307
+ * passes to `func`, never from the ref.
3233
3308
  */
3234
3309
  /** Config a child agent is built from. The factory lives in createSmartAgent. */
3235
3310
  type BuildChildConfig = {
@@ -3239,6 +3314,13 @@ type BuildChildConfig = {
3239
3314
  tools: ToolInterface[];
3240
3315
  outputSchema?: any;
3241
3316
  limits?: any;
3317
+ /**
3318
+ * Whether a question the child asks reaches a human: true under `delegate_to` /
3319
+ * `spawn_subagent` (the pause is surfaced and resumed), false in a parallel
3320
+ * fan-out (it ends the task as `needs_input`). Decides how the child is told
3321
+ * about asking.
3322
+ */
3323
+ interactive: boolean;
3242
3324
  };
3243
3325
  type SubagentToolDeps = {
3244
3326
  registryRef: SubagentRegistryRef;
@@ -3252,7 +3334,16 @@ type SubagentToolDeps = {
3252
3334
  spawn?: string;
3253
3335
  parallel?: string;
3254
3336
  };
3337
+ /** Names of the parent's tools an ad-hoc child may borrow, listed to the model. */
3338
+ parentToolNames?: string[];
3339
+ /** True when the parent has `humanInTheLoop.askUser`, which its children inherit. */
3340
+ canAskUser?: boolean;
3255
3341
  };
3342
+ /**
3343
+ * What the model is shown of a result: no `input` (it wrote it), no `usage` or
3344
+ * `durationMs` (bookkeeping for the host, tokens for the model to spend).
3345
+ */
3346
+ declare function toModelResult(result: SubagentResult): Omit<SubagentResult, "input" | "usage" | "durationMs">;
3256
3347
  declare function createDelegateTool(deps: SubagentToolDeps): ToolInterface;
3257
3348
  declare function createSpawnTool(deps: SubagentToolDeps): ToolInterface;
3258
3349
  declare function createParallelTool(deps: SubagentToolDeps): ToolInterface;
@@ -4382,6 +4473,18 @@ type SessionMetrics = {
4382
4473
  totalTokens: number;
4383
4474
  /** Present only when a `costEstimator` was configured. */
4384
4475
  estimatedCostUsd?: number;
4476
+ /**
4477
+ * What sub-agents spent during this run, kept apart from the figures above:
4478
+ * each child opens its own session and reports its own record, so folding
4479
+ * them in would count every child token twice in a pipeline that sums runs.
4480
+ * Present only when the run delegated.
4481
+ */
4482
+ subagentCalls?: number;
4483
+ subagentInputTokens?: number;
4484
+ subagentOutputTokens?: number;
4485
+ subagentTotalTokens?: number;
4486
+ /** Present only with a `costEstimator` and sub-agent calls. */
4487
+ subagentEstimatedCostUsd?: number;
4385
4488
  /** Executions per tool name. Opt-in — a wide tool menu makes this unbounded. */
4386
4489
  toolBreakdown?: Record<string, number>;
4387
4490
  };
@@ -5881,4 +5984,4 @@ declare class ModelRequestError extends ProviderError {
5881
5984
  constructor(init: ModelRequestErrorInit);
5882
5985
  }
5883
5986
 
5884
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
5987
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallContext, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
package/dist/index.d.ts CHANGED
@@ -971,23 +971,57 @@ type SubagentPolicy = {
971
971
  childContextPolicy: ChildContextPolicy;
972
972
  /** Whether ad-hoc spawns may reference the parent's tools by name. */
973
973
  allowAdhocTools: boolean;
974
+ /**
975
+ * Forward the children's streamed text to the parent's `onStream` / `stream`
976
+ * events. Off by default: a host that appends `chunk.text` would print every
977
+ * child's words as if they were the parent's answer. When on, each forwarded
978
+ * chunk carries `subagentName` / `subagentId`.
979
+ */
980
+ streamChildren?: boolean;
974
981
  };
975
982
  declare const DEFAULT_SUBAGENT_POLICY: SubagentPolicy;
976
- /** Result of a single sub-agent run (returned to the model as the tool result). */
983
+ /**
984
+ * How a child run ended.
985
+ * - `ok` — finished and produced an answer.
986
+ * - `incomplete` — stopped early (a limit, the tool-call cap, no answer): `content` is partial.
987
+ * - `blocked` — refused by policy (a `subagentStart` gate or an output guardrail).
988
+ * - `needs_input` — wanted a human (parallel fan-out cannot ask).
989
+ * - `cancelled` — the run was cancelled while the child was working.
990
+ * - `error` — threw, or its structured output failed.
991
+ */
992
+ type SubagentStatus = "ok" | "incomplete" | "blocked" | "needs_input" | "cancelled" | "error";
993
+ /** Model calls a child made, in the parent's `state.usage` shape. */
994
+ type SubagentUsage = {
995
+ perRequest: NonNullable<AgentState["usage"]>["perRequest"];
996
+ totals: NonNullable<AgentState["usage"]>["totals"];
997
+ };
998
+ /**
999
+ * Result of a single sub-agent run. The model sees a projection of it
1000
+ * (`toModelResult`: no `input`, `usage` or `durationMs`); hosts get the whole
1001
+ * thing on `subagent` events, `subagentStop` observers and the registry.
1002
+ */
977
1003
  type SubagentResult = {
978
1004
  /** Sub-agent name (registry) or role (ad-hoc). */
979
1005
  name: string;
980
1006
  mode: "registry" | "adhoc";
981
- /** The input the sub-agent was tasked with. */
982
- input: string;
983
- /** Final assistant content from the child. */
1007
+ status: SubagentStatus;
1008
+ /** The input the sub-agent was tasked with. Not echoed to the model. */
1009
+ input?: string;
1010
+ /** Final assistant content from the child (partial unless `status` is `ok`). */
984
1011
  content?: string;
985
1012
  /** Parsed structured output, when the child had an `outputSchema`. */
986
1013
  output?: any;
987
1014
  /** Latest child summary, when summarization fired. */
988
1015
  summary?: string;
989
- /** Populated when the child failed or was refused by a guard. */
1016
+ /** Set when the child produced no usable result (`error`, `blocked`, `needs_input`). */
990
1017
  error?: string;
1018
+ /** Why a result is partial or cancelled. */
1019
+ note?: string;
1020
+ /**
1021
+ * The model calls this run made. Already merged into the parent's
1022
+ * `state.usage` (each entry tagged `subagent`), so a parent budget sees them.
1023
+ */
1024
+ usage?: SubagentUsage;
991
1025
  durationMs?: number;
992
1026
  };
993
1027
  /**
@@ -2299,6 +2333,12 @@ type AgentState = {
2299
2333
  timestamp: string;
2300
2334
  turn: number;
2301
2335
  cachedInput?: number;
2336
+ /** Present when a sub-agent made this call; it was merged in from the child's run. */
2337
+ subagent?: {
2338
+ name: string;
2339
+ id: string;
2340
+ mode: "registry" | "adhoc";
2341
+ };
2302
2342
  }>;
2303
2343
  totals: Record<string, {
2304
2344
  input: number;
@@ -2667,8 +2707,14 @@ type SubagentEvent = {
2667
2707
  parallel?: boolean;
2668
2708
  /** Task input (on `start`). */
2669
2709
  input?: string;
2670
- /** Final content (on `result`). */
2710
+ /** Final content (on `result` / `error`; partial unless `status` is `ok`). */
2671
2711
  content?: string;
2712
+ /** How the child ended (on `result` and `error`). */
2713
+ status?: SubagentStatus;
2714
+ /** Why the outcome is partial or cancelled. */
2715
+ note?: string;
2716
+ /** The child's model calls (on `result` and `error`); already merged into the parent's usage. */
2717
+ usage?: SubagentUsage;
2672
2718
  error?: {
2673
2719
  message: string;
2674
2720
  };
@@ -2723,6 +2769,12 @@ type ProgressUpdate = {
2723
2769
  type StreamChunk = {
2724
2770
  text: string;
2725
2771
  isFinal?: boolean;
2772
+ /**
2773
+ * Set only on a sub-agent's chunk, and only when `subagentPolicy.streamChildren`
2774
+ * is on. A chunk without it is the top-level agent's own text.
2775
+ */
2776
+ subagentName?: string;
2777
+ subagentId?: string;
2726
2778
  };
2727
2779
  type InvokeConfig = RunnableConfig & {
2728
2780
  onEvent?: (event: SmartAgentEvent) => void;
@@ -2831,7 +2883,18 @@ type AgentInstance<TOutput = unknown> = {
2831
2883
  };
2832
2884
  type SmartAgentInstance<TOutput = unknown> = AgentInstance<TOutput>;
2833
2885
 
2834
- type SmartToolFn = (args: any) => Promise<any> | any;
2886
+ /**
2887
+ * Per-call context the tools node hands to a tool's `func` as its second
2888
+ * argument. Anything that must be true of THIS call (rather than of the tool
2889
+ * object, which sibling calls in the same turn share) belongs here.
2890
+ */
2891
+ type ToolCallContext = {
2892
+ /** The model's tool_call id for this exact call. */
2893
+ toolCallId?: string;
2894
+ cancellationToken?: any;
2895
+ signal?: AbortSignal;
2896
+ };
2897
+ type SmartToolFn = (args: any, context?: ToolCallContext) => Promise<any> | any;
2835
2898
  type ToolCachePolicy = {
2836
2899
  /** Cache scope. "run" persists for the current invoke only. */
2837
2900
  scope?: "run";
@@ -3200,13 +3263,15 @@ declare function withinDepth(currentDepth: number, policy: SubagentPolicy): {
3200
3263
  * context policy. Extracted so both `asTool` delegation and the sub-agent tools
3201
3264
  * share ONE implementation.
3202
3265
  *
3203
- * - `full` — entire parent transcript (minus its system prompt) + the input.
3204
- * - `scoped` — last user turn + the task input.
3205
- * - `minimal` — only the task input (default).
3266
+ * - `minimal` — only the task input.
3267
+ * - `scoped` — last user turn + the task input (default).
3268
+ * - `full` — entire parent transcript (minus its system prompt and the
3269
+ * current turn's unresolved tool_calls) + the task input.
3206
3270
  *
3207
- * The parent's system message is intentionally NOT carried over: the child agent
3208
- * composes its own system prompt from its `SubagentDef.systemPrompt` (or role),
3209
- * and leaking the parent's system message would suppress it.
3271
+ * `scoped` and `full` mark the transcript as background and the input as the
3272
+ * job. The parent's system message is intentionally NOT carried over: the child
3273
+ * agent composes its own system prompt from its `SubagentDef.systemPrompt` (or
3274
+ * role), and leaking the parent's system message would suppress it.
3210
3275
  */
3211
3276
  declare function seedChildMessages(policy: ChildContextPolicy, parentMessages: Message[], input: string): Message[];
3212
3277
  /**
@@ -3215,11 +3280,17 @@ declare function seedChildMessages(policy: ChildContextPolicy, parentMessages: M
3215
3280
  * or registry sub-agent can borrow a subset of the parent's capabilities.
3216
3281
  */
3217
3282
  declare function resolveSubagentTools(declared: SubagentDef["tools"] | string[] | undefined, parentTools: ToolInterface[]): Promise<ToolInterface[]>;
3218
- /** The cheap catalog block the model always sees in its system prompt. */
3283
+ /**
3284
+ * The cheap catalog block the model always sees in its system prompt: what it
3285
+ * can delegate to, how to write a task, and how to read what comes back.
3286
+ */
3219
3287
  declare function buildSubagentCatalogBlock(subagents: SubagentDef[], policy: SubagentPolicy, toolNames: {
3220
3288
  delegate: string;
3221
3289
  spawn: string;
3222
3290
  parallel: string;
3291
+ }, opts?: {
3292
+ parentToolNames?: string[];
3293
+ askUser?: boolean;
3223
3294
  }): string;
3224
3295
 
3225
3296
  /**
@@ -3230,6 +3301,10 @@ declare function buildSubagentCatalogBlock(subagents: SubagentDef[], policy: Sub
3230
3301
  * with createSmartAgent), and forward events/streaming/cancellation into each
3231
3302
  * child. Human-in-the-loop pauses inside a sequential child are surfaced to the
3232
3303
  * parent and resumed via `state.ctx.__subagentPending`.
3304
+ *
3305
+ * The `_stateRef` is shared by every call of a tool in a turn, so a call's own
3306
+ * identity (its tool_call id) comes from the per-call context the tools node
3307
+ * passes to `func`, never from the ref.
3233
3308
  */
3234
3309
  /** Config a child agent is built from. The factory lives in createSmartAgent. */
3235
3310
  type BuildChildConfig = {
@@ -3239,6 +3314,13 @@ type BuildChildConfig = {
3239
3314
  tools: ToolInterface[];
3240
3315
  outputSchema?: any;
3241
3316
  limits?: any;
3317
+ /**
3318
+ * Whether a question the child asks reaches a human: true under `delegate_to` /
3319
+ * `spawn_subagent` (the pause is surfaced and resumed), false in a parallel
3320
+ * fan-out (it ends the task as `needs_input`). Decides how the child is told
3321
+ * about asking.
3322
+ */
3323
+ interactive: boolean;
3242
3324
  };
3243
3325
  type SubagentToolDeps = {
3244
3326
  registryRef: SubagentRegistryRef;
@@ -3252,7 +3334,16 @@ type SubagentToolDeps = {
3252
3334
  spawn?: string;
3253
3335
  parallel?: string;
3254
3336
  };
3337
+ /** Names of the parent's tools an ad-hoc child may borrow, listed to the model. */
3338
+ parentToolNames?: string[];
3339
+ /** True when the parent has `humanInTheLoop.askUser`, which its children inherit. */
3340
+ canAskUser?: boolean;
3255
3341
  };
3342
+ /**
3343
+ * What the model is shown of a result: no `input` (it wrote it), no `usage` or
3344
+ * `durationMs` (bookkeeping for the host, tokens for the model to spend).
3345
+ */
3346
+ declare function toModelResult(result: SubagentResult): Omit<SubagentResult, "input" | "usage" | "durationMs">;
3256
3347
  declare function createDelegateTool(deps: SubagentToolDeps): ToolInterface;
3257
3348
  declare function createSpawnTool(deps: SubagentToolDeps): ToolInterface;
3258
3349
  declare function createParallelTool(deps: SubagentToolDeps): ToolInterface;
@@ -4382,6 +4473,18 @@ type SessionMetrics = {
4382
4473
  totalTokens: number;
4383
4474
  /** Present only when a `costEstimator` was configured. */
4384
4475
  estimatedCostUsd?: number;
4476
+ /**
4477
+ * What sub-agents spent during this run, kept apart from the figures above:
4478
+ * each child opens its own session and reports its own record, so folding
4479
+ * them in would count every child token twice in a pipeline that sums runs.
4480
+ * Present only when the run delegated.
4481
+ */
4482
+ subagentCalls?: number;
4483
+ subagentInputTokens?: number;
4484
+ subagentOutputTokens?: number;
4485
+ subagentTotalTokens?: number;
4486
+ /** Present only with a `costEstimator` and sub-agent calls. */
4487
+ subagentEstimatedCostUsd?: number;
4385
4488
  /** Executions per tool name. Opt-in — a wide tool menu makes this unbounded. */
4386
4489
  toolBreakdown?: Record<string, number>;
4387
4490
  };
@@ -5881,4 +5984,4 @@ declare class ModelRequestError extends ProviderError {
5881
5984
  constructor(init: ModelRequestErrorInit);
5882
5985
  }
5883
5986
 
5884
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
5987
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type ConversationPluginConfig, type ConversationStore, type CostEstimator, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StrictRestorers, type StrictTransform, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentStatus, type SubagentToolDeps, type SubagentToolNames, type SubagentUsage, type SummarizationEvent, type SummarizationMode, type SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallContext, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toModelResult, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };