UNPKG

@openai/agents-openai

Version:

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

36 lines • 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getHostedAgentMetadata = getHostedAgentMetadata; function isRecord(value) { return typeof value === 'object' && value !== null; } function unwrapHostedValue(value) { if (!isRecord(value)) { return undefined; } if (isRecord(value.toolCall)) { return unwrapHostedValue(value.toolCall); } if (isRecord(value.providerData) && isRecord(value.providerData.agent)) { return value.providerData; } return value; } /** * Reads hosted-agent attribution without affecting local tool routing. */ function getHostedAgentMetadata(value) { const item = unwrapHostedValue(value); if (!item || !isRecord(item.agent)) { return undefined; } const agentName = item.agent.agent_name; if (typeof agentName !== 'string' || agentName.length === 0) { return undefined; } return { agentName, ...(typeof item.phase === 'string' ? { phase: item.phase } : {}), }; } //# sourceMappingURL=metadata.js.map