UNPKG

@openai/agents-openai

Version:

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

33 lines • 953 B
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. */ export 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.mjs.map