Add function processOutput to AgentDefinition and typing for an agent's output (#10447)

This commit is contained in:
Silvio Junior
2025-10-03 13:21:08 -04:00
committed by GitHub
parent 3f79d7e5bb
commit ee3e4017c3
7 changed files with 162 additions and 139 deletions

View File

@@ -15,6 +15,7 @@ import type {
SubagentActivityEvent,
} from './types.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import { type z } from 'zod';
const INPUT_PREVIEW_MAX_LENGTH = 50;
const DESCRIPTION_MAX_LENGTH = 200;
@@ -29,10 +30,9 @@ const DESCRIPTION_MAX_LENGTH = 200;
* live output stream.
* 4. Formatting the final result into a {@link ToolResult}.
*/
export class SubagentInvocation extends BaseToolInvocation<
AgentInputs,
ToolResult
> {
export class SubagentInvocation<
TOutput extends z.ZodTypeAny,
> extends BaseToolInvocation<AgentInputs, ToolResult> {
/**
* @param params The validated input parameters for the agent.
* @param definition The definition object that configures the agent.
@@ -41,7 +41,7 @@ export class SubagentInvocation extends BaseToolInvocation<
*/
constructor(
params: AgentInputs,
private readonly definition: AgentDefinition,
private readonly definition: AgentDefinition<TOutput>,
private readonly config: Config,
messageBus?: MessageBus,
) {