@openai/agents-core
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
26 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerPreparedAgentTools = registerPreparedAgentTools;
exports.getPublicAgent = getPublicAgent;
exports.refreshPreparedAgentTools = refreshPreparedAgentTools;
// Only SDK-created execution agents have a binding; public clones stay independent.
const preparedAgentTools = new WeakMap();
function registerPreparedAgentTools(prepared, source, capabilityTools) {
preparedAgentTools.set(prepared, { source, capabilityTools });
refreshPreparedAgentTools(prepared);
}
function getPublicAgent(agent) {
return preparedAgentTools.get(agent)?.source ?? agent;
}
function refreshPreparedAgentTools(agent) {
const binding = preparedAgentTools.get(agent);
if (!binding) {
return;
}
agent.tools = [...binding.source.tools, ...binding.capabilityTools];
// An empty synthesized array must not suppress prompt-supplied tools unless
// the application explicitly configured tools on the public agent.
agent._toolsExplicitlyConfigured =
agent.tools.length > 0 || binding.source.hasExplicitToolConfig();
}
//# sourceMappingURL=agentToolConfiguration.js.map