@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
115 lines (114 loc) • 3.71 kB
TypeScript
/**
* Network Orchestrator - High-level orchestration of agent networks
*
* The Orchestrator manages:
* - Network lifecycle (creation, execution, shutdown)
* - Multi-network coordination
* - Network-level policies and constraints
* - Resource management and scaling
*/
import type { NeuroLink } from "../../neurolink.js";
import type { AgentNetwork } from "../agentNetwork.js";
import { MessageBus } from "../communication/message-bus.js";
import type { AgentNetworkConfig, HierarchicalNetworkConfig, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk, HierarchicalExecutionTrace, CoordinationStrategy, OrchestrationMode, NetworkState, NetworkInfo, OrchestratorConfig } from "../../types/index.js";
/**
* Network Orchestrator - Central controller for agent networks
*/
export declare class NetworkOrchestrator {
private neurolink;
private networks;
private networkInfo;
private coordinators;
private messageBus;
private config;
private emitter;
private executionQueue;
private activeExecutions;
constructor(neurolink: NeuroLink, config?: OrchestratorConfig);
/**
* Create a new agent network
*/
createNetwork(config: AgentNetworkConfig, mode?: OrchestrationMode): Promise<AgentNetwork>;
/**
* Create a hierarchical network
*/
createHierarchicalNetwork(config: HierarchicalNetworkConfig, parentNetworkId?: string): Promise<AgentNetwork>;
/**
* Get a network by ID
*/
getNetwork(networkId: string): AgentNetwork | undefined;
/**
* Get network info
*/
getNetworkInfo(networkId: string): NetworkInfo | undefined;
/**
* Get all networks
*/
getAllNetworks(): NetworkInfo[];
/**
* Execute a network
*/
executeNetwork(networkId: string, input: NetworkExecutionInput, options?: NetworkExecutionOptions): Promise<NetworkExecutionResult>;
/**
* Internal network execution
*/
private executeNetworkInternal;
/**
* Queue an execution request
*/
private queueExecution;
/**
* Process queued executions
*/
private processExecutionQueue;
/**
* Stream network execution
*/
streamNetwork(networkId: string, input: NetworkExecutionInput, options?: NetworkExecutionOptions): AsyncIterable<NetworkStreamChunk>;
/**
* Execute hierarchical network with delegation
*/
executeHierarchical(networkId: string, input: NetworkExecutionInput, options?: NetworkExecutionOptions): Promise<HierarchicalExecutionTrace>;
/**
* Pause a network
*/
pauseNetwork(networkId: string): void;
/**
* Resume a network
*/
resumeNetwork(networkId: string): void;
/**
* Shutdown a network
*/
shutdownNetwork(networkId: string): Promise<void>;
/**
* Coordinate multiple networks
*/
coordinateNetworks(networkIds: string[], task: string, strategy?: CoordinationStrategy): Promise<Map<string, NetworkExecutionResult>>;
/**
* Get orchestrator statistics
*/
getStats(): {
totalNetworks: number;
activeExecutions: number;
queuedExecutions: number;
totalExecutions: number;
networksByState: Record<NetworkState, number>;
};
/**
* Get the shared message bus
*/
getMessageBus(): MessageBus;
/**
* Subscribe to orchestrator events
*/
on(event: string, handler: (...args: unknown[]) => void): void;
/**
* Unsubscribe from orchestrator events
*/
off(event: string, handler: (...args: unknown[]) => void): void;
/**
* Shutdown the orchestrator
*/
shutdown(): Promise<void>;
}