UNPKG

@openai/agents-core

Version:

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.

33 lines (32 loc) • 1.39 kB
import type { ToolInputParameters } from '../tool'; import { JsonObjectSchema, JsonSchemaDefinition, TextOutput } from '../types'; import type { AgentOutputType } from '../agent'; export type FunctionToolName = string & { __brand?: 'ToolName'; } & { readonly __pattern?: '^[a-zA-Z0-9_]+$'; }; /** * Convert a string to a function tool name by replacing spaces with underscores and * non-alphanumeric characters with underscores. * @param name - The name of the tool. * @returns The function tool name. */ export declare function toFunctionToolName(name: string): FunctionToolName; /** * Get the schema and parser from an input type. Supported Standard Schema and Zod values are * converted to JSON Schema and retain runtime validation. Plain JSON Schema values use JSON.parse. * @param inputType - The input type to get the schema and parser from. * @param name - The name of the tool. * @returns The schema and parser. */ export declare function getSchemaAndParserFromInputType<T extends ToolInputParameters>(inputType: T, name: string, options?: { strict?: boolean; }): { schema: JsonObjectSchema<any>; parser: (input: string) => any | Promise<any>; }; /** * Converts the agent output type provided to a serializable version */ export declare function convertAgentOutputTypeToSerializable(outputType: AgentOutputType): JsonSchemaDefinition | TextOutput;