Skip to content

🧪 API & Testing Reference

The quality and deterministic stability of the Master Orchestration Protocol are guaranteed through a rigorous automated test suite covering every core architectural layer.

1. The Test Suite (8 Core Automated Tests)

Our testing matrix validates the functional guarantees of MOP through 8 targeted test gates:

  1. test_agent_registry: Verifies agent registration, role parameters, and dual-mode triggers.
  2. test_debate_engine: Validates the 6-stage debate loop and the generation of structured consensus models.
  3. test_sqlite_memory_backend: Confirms SQLite database transactions, argument writes, and history records.
  4. test_sandbox_execution: Tests the command sandbox, executing secure scripts with strict timeout limits.
  5. test_pre_flight_validation: Checks static compile verification and command whitelist parsing.
  6. test_post_flight_validation: Validates that system output satisfies precision criteria.
  7. test_emergency_rollback_trigger: Simulates file system damage and verifies that Law 3 rolls back the workspace.
  8. test_end_to_end_orchestrator_flow: Triggers the entire MOP lifecycle from ingestion, debate, and execution to storage.

2. Executing the Tests

All tests are managed via uv using the pytest runner:

bash
# Execute the full suite with verbose outputs
uv run pytest -v

Expected Output:

============================= test session starts ==============================
collected 8 items

tests/test_agent_registry.py .                                           [ 12%]
tests/test_debate_engine.py .                                            [ 25%]
tests/test_sqlite_memory.py .                                            [ 37%]
tests/test_sandbox_execution.py .                                        [ 50%]
tests/test_pre_flight.py .                                               [ 62%]
tests/test_post_flight.py .                                              [ 75%]
tests/test_emergency_rollback.py .                                       [ 87%]
tests/test_orchestrator.py .                                             [100%]

============================== 8 passed in 1.42s ===============================

3. Core Class Interfaces (API Reference)

Orchestrator

Coordinates the complete lifecycle of the Master Orchestration Protocol.

  • __init__(self, db_path: str): Configures database routes and activates registries.
  • run_workflow(self, request: str) -> dict: Ingests a workflow objective and drives it through to consensus, execution, and validation.

DebateEngine

Directs the active agent debate process.

  • initialize_debate(self, topic: str) -> None: Prepares the session context and assigns agents.
  • run_debate(self) -> dict: Executes the 6-phase debate loop and resolves the consensus.

SQLiteMemory

Manages connections and transactions against the SQLite memory store.

  • store_debate(self, debate_data: dict) -> None: Stores debate arguments and metadata.
  • find_similar_debates(self, query: str) -> list: Performs similarity lookup based on keyword matching.

Izgrađeno sa Antigravity & DocKit Premium