Quick Start Guide
Get up and running with OACP in minutes. Add governance, voting, and audit trails to your LangGraph workflows.
Installation
# Clone the repository
git clone https://github.com/Aaditya17032002/OACP.git
cd OACP
pip install -e .
# Install dependencies
pip install langgraphVisit the GitHub repository for the latest updates, issues, and contributions.
Basic Usage
Add OACP governance to your LangGraph nodes using decorators:
from oacp import with_oacp, decision_contract, vote, VoteDecision
from langgraph.graph import StateGraph
# Add governance to a function
@with_oacp(
role="researcher",
invariants=["factual_accuracy", "comprehensive_coverage"],
log_inputs=True,
log_outputs=True
)
def research_node(state: dict) -> dict:
"""Research node with OACP governance."""
# Your research logic here
return {"research_results": "..."}
# Node requiring consensus
@with_oacp(
role="synthesizer",
contract=decision_contract(
required_approvers=["researcher", "analyst", "critic"],
strategy="unanimous",
timeout_seconds=30
)
)
def synthesis_node(state: dict) -> dict:
"""Synthesis node requiring unanimous approval."""
# Your synthesis logic here
return {"final_report": "..."}
# Voting function
def reviewer_vote(run_id: str, output: dict):
vote(
run_id=run_id,
voter_id="reviewer",
decision=VoteDecision.APPROVE,
reason="Output meets quality standards"
)Key Concepts
@with_oacp Decorator
Adds governance to any function with role assignment, invariant checking, and optional consensus requirements.
Decision Contracts
Define voting requirements with required approvers, voting strategy (unanimous/majority/weighted), and timeout settings.
Vote Function
Cast votes with APPROVE, REJECT, or ABSTAIN decisions, including reasons and improvement suggestions.
Event Storage
Persistent audit trail with file, SQLite, or PostgreSQL backends for complete workflow traceability.