Skip to main content

Crate terraphim_orchestrator

Crate terraphim_orchestrator 

Source
Expand description

Multi-agent orchestration with scheduling, budgeting, and compound review.

This crate provides the core orchestration engine for managing fleets of AI agents with features for resource scheduling, cost tracking, and coordinated review workflows.

§Core Components

  • AgentOrchestrator: Main orchestrator running the “dark factory” pattern
  • DualModeOrchestrator: Real-time and batch processing modes with fairness scheduling
  • CompoundReviewWorkflow: Multi-agent review swarm with persona-based specialization
  • Scheduler: Time-based and event-driven task scheduling
  • HandoffBuffer: Inter-agent state transfer with TTL management
  • CostTracker: Budget enforcement and spending monitoring
  • NightwatchMonitor: Drift detection and rate limiting

§Example

use terraphim_orchestrator::{AgentOrchestrator, OrchestratorConfig};

let config = OrchestratorConfig::default();
let mut orchestrator = AgentOrchestrator::new(config).await?;

// Run the orchestration loop
orchestrator.run().await?;

Re-exports§

pub use agent_run_record::AgentRunRecord;
pub use agent_run_record::ExitClass;
pub use agent_run_record::ExitClassification;
pub use agent_run_record::ExitClassifier;
pub use agent_run_record::RunTrigger;
pub use compound::CompoundReviewResult;
pub use compound::CompoundReviewWorkflow;
pub use compound::ReviewGroupDef;
pub use compound::SwarmConfig;
pub use concurrency::ConcurrencyController;
pub use concurrency::FairnessPolicy;
pub use concurrency::ModeQuotas;
pub use config::AgentDefinition;
pub use config::AgentLayer;
pub use config::CompoundReviewConfig;
pub use config::ConcurrencyConfig;
pub use config::GiteaOutputConfig;
pub use config::MentionConfig;
pub use config::NightwatchConfig;
pub use config::OrchestratorConfig;
pub use config::PreCheckStrategy;
pub use config::TrackerConfig;
pub use config::TrackerStates;
pub use config::WebhookConfig;
pub use config::WorkflowConfig;
pub use cost_tracker::AgentMetrics;
pub use cost_tracker::BudgetVerdict;
pub use cost_tracker::CostSnapshot;
pub use cost_tracker::CostTracker;
pub use cost_tracker::ExecutionMetrics;
pub use dispatcher::DispatchTask;
pub use dispatcher::Dispatcher;
pub use dispatcher::DispatcherStats;
pub use dual_mode::DualModeOrchestrator;
pub use error::OrchestratorError;
pub use handoff::HandoffBuffer;
pub use handoff::HandoffContext;
pub use handoff::HandoffLedger;
pub use mention::parse_mentions;
pub use mention::resolve_mention;
pub use mention::DetectedMention;
pub use mention::MentionCursor;
pub use mention::MentionTracker;
pub use metrics_persistence::InMemoryMetricsPersistence;
pub use metrics_persistence::MetricsPersistence;
pub use metrics_persistence::MetricsPersistenceConfig;
pub use metrics_persistence::MetricsPersistenceError;
pub use metrics_persistence::PersistedAgentMetrics;
pub use mode::IssueMode;
pub use mode::TimeMode;
pub use nightwatch::dual_panel_evaluate;
pub use nightwatch::validate_certificate;
pub use nightwatch::Claim;
pub use nightwatch::CorrectionAction;
pub use nightwatch::CorrectionLevel;
pub use nightwatch::DriftAlert;
pub use nightwatch::DriftMetrics;
pub use nightwatch::DriftScore;
pub use nightwatch::DualPanelResult;
pub use nightwatch::NightwatchMonitor;
pub use nightwatch::RateLimitTracker;
pub use nightwatch::RateLimitWindow;
pub use nightwatch::ReasoningCertificate;
pub use output_poster::OutputPoster;
pub use persona::MetapromptRenderError;
pub use persona::MetapromptRenderer;
pub use persona::PersonaRegistry;
pub use scheduler::ScheduleEvent;
pub use scheduler::TimeScheduler;

Modules§

adf_commands
ADF Command Parser using terraphim-automata
agent_run_record
Structured agent run records with KG-boosted exit classification.
compound
concurrency
Global concurrency controller with fairness.
config
control_plane
Control-plane routing decision layer for ADF agent dispatch.
cost_tracker
dispatcher
Unified dispatch queue for both time-driven and issue-driven modes.
dual_mode
Dual-mode orchestrator with full integration.
error
flow
handoff
kg_router
KG-driven model routing using markdown-defined rules.
learning
Shared Learning Store for ADF agents.
mention
Mention detection and resolution for @adf:name comments.
metrics_persistence
Metrics persistence for agent cost and performance tracking.
mode
Agent execution modes.
nightwatch
output_poster
Posts agent output to Gitea issues after agent exit.
persona
provider_probe
Provider availability probing with per-provider circuit breakers.
scheduler
scope
webhook
Gitea webhook handler for real-time mention dispatch.

Structs§

AgentOrchestrator
The main orchestrator that runs the dark factory.
AgentStatus
Status of a single agent in the fleet.

Enums§

PreCheckResult
Result of evaluating a pre-check strategy before spawning an agent.