UNPKG

@openai/agents-core

Version:

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

28 lines • 1.04 kB
export const OUTPUT_GUARDRAIL_BLOCKED_TOOL_OUTPUT = 'Output withheld by an output guardrail.'; async function resolveOutputGuardrailBlockedMessage(configured, args) { if (typeof configured === 'string') { return configured.length > 0 ? configured : args.defaultMessage; } try { const resolved = await configured(args); if (typeof resolved === 'string' && resolved.length > 0) { return resolved; } } catch { // Formatter failures fail closed without exposing error details. } return args.defaultMessage; } export function createOutputGuardrailBlockedMessageResolver(configured, state) { if (configured === undefined) { return undefined; } return (guardrailName) => resolveOutputGuardrailBlockedMessage(configured, { defaultMessage: OUTPUT_GUARDRAIL_BLOCKED_TOOL_OUTPUT, guardrailName, agent: state._currentAgent, runContext: state._context, }); } //# sourceMappingURL=outputGuardrailBlockedMessage.mjs.map