/** * LLM-based steering handler that uses an LLM to provide contextual guidance. */ import { type Confirm, type Guide, type Proceed } from '../../../interventions/actions.js'; import type { Model } from '../../../models/model.js'; import type { ContentBlock, SystemPrompt } from '../../../types/messages.js'; import type { ToolUse } from '../../../tools/types.js'; import type { BeforeToolCallEvent } from '../../../hooks/events.js'; import type { LocalAgent } from '../../../types/agent.js'; import type { SteeringContextData, SteeringContextProvider } from '../providers/context-provider.js'; import { SteeringHandler } from './handler.js'; /** * Builds the evaluation prompt sent to the steering LLM. * Return a string for simple prompts, or ContentBlock[] to use cache points. */ export type PromptBuilder = (context: SteeringContextData[], toolUse?: ToolUse) => string | ContentBlock[]; /** * Configuration for the LLMSteeringHandler. */ export interface LLMSteeringHandlerConfig { /** System prompt defining the steering guidance rules. */ systemPrompt: SystemPrompt; /** Model for steering evaluation. Defaults to the parent agent's model. */ model?: Model; /** Custom prompt builder for evaluation prompts. Defaults to defaultPromptBuilder. */ promptBuilder?: PromptBuilder; /** * Context providers for populating steering context. * Defaults to [new ToolLedgerProvider()] if undefined. Pass an empty array to disable. */ contextProviders?: SteeringContextProvider[]; /** * Identifier for this handler instance. Defaults to `'strands:llm-steering-handler'`. * Override when attaching multiple LLM steering handlers to the same agent. */ name?: string; } /** * Steering handler that uses an LLM to provide contextual guidance. * * Uses natural language prompts to evaluate tool calls and produce an * intervention action. * * Only `beforeToolCall` is implemented — model-output steering is not * delegated to the LLM. Subclass and override `afterModelCall` (which * carries the narrowed `Proceed | Guide` return) to add LLM-driven * evaluation of model responses. * * @example * ```typescript * import { Agent } from '@strands-agents/sdk' * import { LLMSteeringHandler } from '@strands-agents/sdk/vended-interventions/steering' * * const handler = new LLMSteeringHandler({ * systemPrompt: `You ensure emails maintain a cheerful, positive tone.`, * }) * * const agent = new Agent({ tools: [sendEmail], interventions: [handler] }) * ``` */ export declare class LLMSteeringHandler extends SteeringHandler { readonly name: string; private readonly _promptBuilder; private readonly _configuredModel; private _agentModel; private readonly _systemPrompt; constructor(config: LLMSteeringHandlerConfig); observeAgent(agent: LocalAgent): Promise; beforeToolCall(event: BeforeToolCallEvent): Promise; private _invoke; } //# sourceMappingURL=llm.d.ts.map