UNPKG

agentlang

Version:

The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans

33 lines 946 B
import { makeFqName } from '../util.js'; const AgentFlows = new Map(); const FlowRegistry = new Map(); export function registerFlow(name, flow) { FlowRegistry.set(name, flow); return name; } function getFlow(name) { return FlowRegistry.get(name); } export function registerAgentFlow(agentName, flowSpecName) { let currentFlows = AgentFlows.get(agentName); if (currentFlows) { currentFlows.push(flowSpecName); } else { currentFlows = new Array(); currentFlows.push(flowSpecName); } AgentFlows.set(agentName, currentFlows); return agentName; } // Return the first flow registered with the agent. export function getAgentFlow(agentName, moduleName) { const currentFlows = AgentFlows.get(agentName); if (currentFlows) { return getFlow(currentFlows[0]); } else { return getFlow(makeFqName(moduleName, agentName)); } } //# sourceMappingURL=flows.js.map