Skip to main content

A MapReduce-inspired framework for parallel, isolated multi-agent reasoning.

Project description

Octochains

GOSIM Spotlight 2026 License: MIT Version Octochains Logo


Octochains is a lightweight, zero-dependency Python framework for Collaborative AI Reasoning. It moves away from "monolithic" AI responses toward a parallel, multi-expert architecture that eliminates "Expert Blindspots" in high-stakes decision-making.

By broadcasting a single complex problem to a pool of isolated specialists, Octochains ensures that every angle, from clinical diagnostics to legal compliance, is evaluated independently before reaching a final consensus.



The Core Innovation

Even State-of-the-Art models (like GPT-5) can fall into "Reasoning Traps", a form of cognitive tunnel vision where the model commits to a path too early. Octochains eliminates this via a MapReduce-inspired architecture:

  1. Broadcasting: The full, complex problem is passed directly to every specialized agent in the pool.
  2. Parallel Execution: Agents operate simultaneously in isolated, threaded environments, ensuring they cannot bias each other's initial findings.
  3. The Aggregator: A final "Chief Justice" agent synthesizes these conflicting or supporting insights into a single transparent, explainable, and robust outcome.
f

Quickstart

Octochains is designed to be developer-first and model-agnostic.

1. Install

pip install octochains

2. Define an Agent

from octochains import Agent, tool

class Specialist(Agent):
    def __init__(self):
        super().__init__(
            role="Legal Expert", 
            goal="Identify liability risks"
        )

    @tool
    def check_compliance(self, text: str):
        """Analyzes text for regulatory non-compliance."""
        # Framework automatically generates JSON schema for this tool
        return "Compliant"

    def execute(self, data: str) -> str:
        # Use any LLM here (OpenAI, Gemini, Ollama, etc.)
        # The 'data' passed here is the full complex problem.
        return f"Legal Analysis: {data}"

3. Define an Aggregator

from octochains import Aggregator

class ChiefConsensusOfficer(Aggregator):
    def __init__(self):
        super().__init__(
            role="Chief Aggregator",
            goal="Synthesize expert opinions into a final verdict"
        )

    def synthesize(self, problem_data: str, agent_reports: dict[str, str]) -> str:
        """
        Receives the original problem and a dictionary of reports.
        Key: Agent Role, Value: Agent output string.
        """
        # Here you can call a high-reasoning LLM to compare the reports
        # or implement custom logic to resolve conflicts.
        verdict = "APPROVED"
        for role, report in agent_reports.items():
            if "RISK" in report.upper():
                verdict = "REJECTED"
        
        return f"Final Decision: {verdict} based on {len(agent_reports)} expert inputs."

4. Run the Parallel Engine

from octochains import Engine

# Initialize your experts and the aggregator
engine = Engine(
    agents=[legal_expert, finance_expert, tech_expert], 
    aggregator=ChiefConsensusOfficer()
)

# Broadcast the complex problem to all agents at once
report = engine.run("Full Project Alpha Investment Case File...")

print(f"Consensus: {report.consensus}")
print(f"Audit Trail: {report.traces}")

Featured Use Case: Medical Diagnostics

agentic ai for medica diagnostics

While Octochains is a universal framework, its power is best demonstrated in multidisciplinary medicine. The featured example simulates a clinical team to rule out underlying heart conditions, psychological factors, or respiratory issues that might be missed by a single-model analysis.

  • Cardiologist Agent: Focuses on arrhythmias and structural abnormalities.
  • Psychologist Agent: Identifies conditions like anxiety or panic disorders.
  • Pulmonologist Agent: Assesses respiratory causes such as asthma or COPD.

⚠️ Disclaimer: This project is for research and educational purposes only and is not intended for clinical use.


Repository Structure

The Agent & Aggregator Hub Octochains is built to be modular. We are developing an Agent & Aggregator Hub where the community can contribute, publish, and reuse specialized reasoning modules.

src/octochains/
├── __init__.py           <-- Core framework exports
├── base.py               <-- Abstract Base Classes (Agent/Aggregator)
├── engine.py             <-- Parallel Broadcast Engine
├── schema.py    
├── exceptions.py         <-- Error handling     
│
├── agents/               <-- THE AGENT HUB
│   ├── medical/          
│   │   ├── __init__.py   <-- Export: Cardiologist, Neurologist, etc.
│   │   ├── cardiology.py
│   │   └── neurology.py
│   ├── legal/
│   │   ├── __init__.py   <-- Export: Compliance, ContractExpert
│   │   └── compliance.py
│   └── finance/
│       ├── __init__.py
│       └── analyst.py
│
└── aggregators/          <-- THE AGGREGATOR LIBRARY
    ├── medical/
    │   ├── __init__.py   <-- Export: ChiefMedicalOfficer
    │   └── cmo.py
    └── logic/            <-- Standard decision-making logic
        ├── __init__.py   <-- Export: MajorityVote, WeightedConsensus
        ├── majority.py
        └── consensus.py

Demo Examples Every demo in Octochains is designed as a standalone, reproducible case study. This ensures the core framework remains lightweight while allowing specific use cases to have their own environment.

demo-examples/
└── 01-ai-agents-for-medical-diagnostics/
    ├── medical_reports/    <-- Sample patient dossiers
    ├── results/            <-- Historical audit logs of agent outputs
    ├── requirements.txt    <-- Isolated dependencies (e.g., biopython)
    └── run_demo.py         <-- Entry point for the diagnostic engine

Future Roadmap

We are expanding Octochains from a library into a comprehensive ecosystem for high-stakes AI reasoning.

  • The Agent Hub: A community-driven marketplace for pre-tuned specialist modules. Developers can build and publish their own "experts" (e.g., M&A Due Diligence, Cybersecurity Threat Hunter, or Endocrinology Specialist) for others to snap into their own chains.

License & Contact

Octochains is open-source under the MIT license. For enterprise features and custom integrations contact: ahmad.vh7@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

octochains-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

octochains-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file octochains-0.1.0.tar.gz.

File metadata

  • Download URL: octochains-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for octochains-0.1.0.tar.gz
Algorithm Hash digest
SHA256 743721f090fd5fa94e6f9de293f0863a550b16b93c23cf5ffb1dfcacec3adcfa
MD5 8bf498380beea9c4be25cbbc32dbc1cc
BLAKE2b-256 3d2bf8b1b19c50656a217cd305e6399aba9b3be6d48e26fe2d7da876b7dff242

See more details on using hashes here.

File details

Details for the file octochains-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: octochains-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for octochains-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 778ff8d7bf57df39d0fc2703d46ac06c2fe8017913855c48c1315ab3abd64db5
MD5 ada74d0cbae7c768f5aafe05f2ece0f7
BLAKE2b-256 be68271074f58fa3ed4c1274e4b5728a8564420605616d9ba0d299351ee5cdf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page