Agent Orchestration Helpers (items/orchestration.ts)

librechat · client/src/components/SidePanel/Agents/Tools/items/orchestration.ts · typescript · MIT
ai, automation, lang:typescript, tag:graph

Utility functions for managing agent handoff graph edges and subagent enablement configuration in multi-agent workflows.

// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import type { AgentSubagentsConfig, GraphEdge } from 'librechat-data-provider';

/** Match the SDK: untyped, unconditional one-to-many edges default to direct. */
export function isHandoffEdge(edge: GraphEdge): boolean {
  const sourceCount = Array.isArray(edge.from) ? edge.from.length : 1;
  const destinationCount = Array.isArray(edge.to) ? edge.to.length : 1;
  const defaultDirect =
    edge.edgeType == null && edge.condition == null && sourceCount === 1 && destinationCount > 1;
  return edge.edgeType !== 'direct' && !defaultDirect;
}

/** Persist the explicit flag while retaining the roster, graphs, and granular settings. */
expor

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key