Skip to content

apomesh-orchestrator

apomesh-orchestrator is the orchestrator layer: the control-plane gRPC daemon that implements the ApomeshDaemon service, plus the substrate-side OrchestratorRuntime that holds session state and coordinates dispatch. It follows substrate-first discipline — the gRPC handler is a thin adapter that receives wire envelopes, calls into apomesh-substrate and the session coordinator, and emits responses; the business logic lives in the substrate crate. The crate is a library split from its binary (which lives in apomesh-orchestrator-bin) so integration tests construct the same daemon the binary serves. Touch it for control-plane behaviour: the RPC surface, the session workflow, cost aggregation, the coordinator seam.

  • Layer: orchestrator. See The orchestrator and Coordination loops.
  • Depends on: apomesh-protocol (the wire it serves), apomesh-substrate (with the mcp feature — the business logic it delegates to), and apomesh-substrate-catalog.
  • Consumed by: apomesh-orchestrator-bin (the binary that wires the concrete strategies), the REST API, SmartChat, and both verticals (for the SessionEntry coordinator seam).
  • OrchestratorDaemon — the ApomeshDaemon gRPC service impl; its handlers translate-and-delegate to the substrate.
  • OrchestratorRuntime — the session-state holder and dispatch coordinator that outlives any single RPC.
  • The transport-blind session workflowcreate_session_workflow, the substrate-side entry both the gRPC handler and the REST route call.
  • The coordinator seam — the SessionEntry trait and SessionStrategyRegistry (one coordinator per session; skeletons compose only by nesting sub-sessions).
  • Cost aggregation, the agent tree, and built-in coordinatorsCostAggregator / TenantCostAggregator, the reconstructed AgentTree, and the debate / parallel-sample multi-coordinator skeletons.

OrchestratorDaemon::new() builds a default daemon (null auth, no strategy registry) — the shape a test fixture uses; production layers the registry and auth backends on with the builder methods.

use apomesh_orchestrator::OrchestratorDaemon;
// A default daemon: `NullSessionAuth`, no registry. Production wires a
// `SessionStrategyRegistry` and real auth via `with_registry` /
// `with_session_auth` before serving.
let daemon = OrchestratorDaemon::new();