Skip to main content

Crate brainwires_agents

Crate brainwires_agents 

Source
Expand description

Brainwires Agents - Agent orchestration, coordination, and lifecycle management

This crate provides the multi-agent infrastructure for autonomous task execution:

§Core Components

  • CommunicationHub - Inter-agent messaging bus with 50+ message types
  • FileLockManager - File access coordination with deadlock detection
  • ResourceLockManager - Scoped resource locking with heartbeat-based liveness
  • OperationTracker - Operation tracking with heartbeat-based liveness checking
  • ValidationLoop - Quality checks before agent completion (Bug #5 prevention)
  • TaskManager - Hierarchical task decomposition and dependency tracking
  • TaskQueue - Priority-based task scheduling with dependency awareness

§Coordination Patterns

  • ContractNet - Bidding protocol for agent negotiation
  • Saga - Compensating transactions for distributed operations
  • OptimisticConcurrency - Optimistic locking with version-based conflict detection
  • WaitQueue - Queue-based coordination primitives
  • MarketAllocation - Market-based task allocation
  • ThreeStateModel - State snapshots for rollback support

§Analysis & Validation

  • ResourceChecker - Conflict detection and resolution
  • ValidationAgent - Rule-based validation
  • Confidence - Response confidence scoring
  • WorktreeManager - Git worktree management for agent isolation

§Feature Flags

  • tools - Enable validation tool integration (check_duplicates, verify_build, check_syntax)

Re-exports§

pub use agent_hooks::AgentLifecycleHooks;
pub use agent_hooks::ConversationView;
pub use agent_hooks::DefaultDelegationHandler;
pub use agent_hooks::DelegationRequest;
pub use agent_hooks::DelegationResult;
pub use agent_hooks::IterationContext;
pub use agent_hooks::IterationDecision;
pub use agent_hooks::ToolDecision;
pub use runtime::AgentExecutionResult;
pub use runtime::AgentRuntime;
pub use runtime::run_agent_loop;
pub use communication::AgentMessage;
pub use communication::CommunicationHub;
pub use communication::ConflictInfo;
pub use communication::ConflictType;
pub use communication::GitOperationType;
pub use confidence::ConfidenceFactors;
pub use confidence::ResponseConfidence;
pub use confidence::extract_confidence;
pub use confidence::quick_confidence_check;
pub use file_locks::FileLockManager;
pub use file_locks::LockType;
pub use operation_tracker::OperationTracker;
pub use resource_checker::ConflictCheck;
pub use resource_checker::ResourceChecker;
pub use resource_locks::ResourceLockGuard;
pub use resource_locks::ResourceLockManager;
pub use resource_locks::ResourceScope;
pub use resource_locks::ResourceType as ResourceLockType;
pub use task_manager::TaskManager;
pub use task_manager::format_duration_secs;
pub use task_queue::TaskQueue;
pub use worktree::WorktreeManager;
pub use access_control::AccessControlManager;
pub use access_control::ContentionStrategy;
pub use access_control::LockBundle;
pub use access_control::LockPersistence;
pub use git_coordination::GitCoordinator;
pub use git_coordination::GitLockRequirements;
pub use git_coordination::GitOperationLocks;
pub use git_coordination::GitOperationRunner;
pub use git_coordination::get_lock_requirements;
pub use git_coordination::git_tools;
pub use plan_executor::ExecutionApprovalMode;
pub use plan_executor::ExecutionProgress;
pub use plan_executor::PlanExecutionConfig;
pub use plan_executor::PlanExecutionStatus;
pub use plan_executor::PlanExecutorAgent;
pub use task_orchestrator::FailurePolicy;
pub use task_orchestrator::OrchestrationResult;
pub use task_orchestrator::TaskOrchestrator;
pub use task_orchestrator::TaskOrchestratorConfig;
pub use task_orchestrator::TaskSpec;
pub use workflow::WorkflowBuilder;
pub use workflow::WorkflowContext;
pub use workflow::WorkflowResult;
pub use contract_net::ContractNetManager;
pub use market_allocation::MarketAllocator;
pub use optimistic::OptimisticController;
pub use saga::SagaExecutor;
pub use state_model::StateModelProposedOperation;
pub use state_model::StateSnapshot;
pub use state_model::ThreeStateModel;
pub use wait_queue::WaitQueue;
pub use context::AgentContext;
pub use execution_graph::ExecutionGraph;
pub use execution_graph::RunTelemetry;
pub use execution_graph::StepNode;
pub use execution_graph::ToolCallRecord;
pub use pool::AgentPool;
pub use pool::AgentPoolStats;
pub use system_prompts::judge_agent_prompt;
pub use system_prompts::planner_agent_prompt;
pub use system_prompts::reasoning_agent_prompt;
pub use system_prompts::simple_agent_prompt;
pub use cycle_orchestrator::CycleOrchestrator;
pub use cycle_orchestrator::CycleOrchestratorConfig;
pub use cycle_orchestrator::CycleOrchestratorResult;
pub use cycle_orchestrator::CycleRecord;
pub use cycle_orchestrator::MergeStrategy;
pub use judge_agent::JudgeAgent;
pub use judge_agent::JudgeAgentConfig;
pub use judge_agent::JudgeContext;
pub use judge_agent::JudgeVerdict;
pub use judge_agent::MergeStatus;
pub use judge_agent::WorkerResult;
pub use planner_agent::DynamicTaskPriority;
pub use planner_agent::DynamicTaskSpec;
pub use planner_agent::PlannerAgent;
pub use planner_agent::PlannerAgentConfig;
pub use planner_agent::PlannerOutput;
pub use planner_agent::SubPlannerRequest;
pub use task_agent::FailureCategory;
pub use task_agent::TaskAgent;
pub use task_agent::TaskAgentConfig;
pub use task_agent::TaskAgentResult;
pub use task_agent::TaskAgentStatus;
pub use task_agent::spawn_task_agent;
pub use validator_agent::ValidatorAgent;
pub use validator_agent::ValidatorAgentConfig;
pub use validator_agent::ValidatorAgentResult;
pub use validator_agent::ValidatorAgentStatus;
pub use validator_agent::spawn_validator_agent;
pub use brainwires_core;
pub use brainwires_tool_system;
pub use validation_loop::*;

Modules§

access_control
Unified access control manager for inter-agent coordination
agent_hooks
Agent Loop Hooks - Granular control over the agent execution loop
communication
Inter-agent communication hub and message types
confidence
Response Confidence Extraction
context
Agent Context - environment for autonomous task execution
contract_net
Contract-Net Protocol for Task Allocation
cycle_orchestrator
Cycle Orchestrator - Plan→Work→Judge loop
execution_graph
Execution DAG and telemetry for TaskAgent runs
file_locks
File locking system for multi-agent coordination
git_coordination
Git operation coordination for multi-agent systems
judge_agent
Judge Agent - LLM-powered cycle evaluator
market_allocation
Market-Based Resource Allocation with Priority Bidding
operation_tracker
Operation tracker with heartbeat-based liveness checking
optimistic
Optimistic Concurrency with Conflict Resolution
plan_executor
Plan Executor Agent - Executes plans by orchestrating task execution
planner_agent
Planner Agent - LLM-powered dynamic task planner
pool
Agent Pool - Manages a pool of background task agents
prelude
Prelude module for convenient imports
resource_checker
Cross-resource conflict detection
resource_locks
Resource locking system for build/test/git coordination
runtime
Agent Runtime - Generic execution loop for autonomous agents
saga
Saga-Style Compensating Transactions
state_model
Three-State Model for comprehensive state tracking
system_prompts
System prompts for task agents with structured reasoning
task_agent
TaskAgent - Autonomous agent that executes a task in a loop using AI + tools
task_manager
Task Manager - Manages a tree-structured task list
task_orchestrator
Task Orchestrator - Bridges TaskManager and AgentPool
task_queue
Priority-based task queue for agent scheduling
validation_agent
Independent Validation Agent for operation verification
validation_loop
Validation Loop - Enforces quality checks before agent completion
validator_agent
ValidatorAgent - Standalone read-only agent that runs external validators
wait_queue
Wait queue implementation for resource coordination
workflow
Workflow Graph Builder — Declarative DAG-based workflow pipelines
worktree
Git Worktree Management for Agent Isolation

Enums§

PreHookDecision
Decision returned by a ToolPreHook before a tool call.

Traits§

ToolPreHook
Pluggable pre-execution hook for semantic tool validation.