Skip to main content

A framework for parallel, isolated multi-agent reasoning.

Project description

Octochains

GOSIM Spotlight 2026 License: BSL 1.1 Version

Octochains Logo

Octochains is a lightweight, zero-dependency Python framework for Collaborative AI Reasoning.It is purpose-built for Decomposable Tasks, complex problems that require independent, multi-perspective analysis.

By shifting from monolithic responses to Parallel Isolated Reasoning, Octochains ensures that every angle of a decision, from clinical diagnostics to financial risk, is evaluated in threaded isolation, preventing logical contamination and "Expert Blindspots."

Scientifically Validated Performance

Octochains is built on the architectural principles validated in the 2026 study "Towards a Science of Scaling Agent Systems" (Google Research / MIT).

Research confirms that for analytical, decomposable tasks, a Parallel Isolated architecture (the core of Octochains) delivers a massive performance delta over standard sequential or single-agent models:

Benchmark Task Domain Performance Gain vs. Single-Agent
Finance-Agent (FAB) Decomposable Financial Reasoning +80.8% 🚀
Workbench Structured Business Planning +57.2%
PlanCraft Sequential Automation (Use Single-Agent Instead)

Why Octochains?

Standard AI chains suffer from "Cognitive Tunnel Vision", where a model commits to a logical path too early. Octochains eliminates this via:

  • Parallel Isolation: Expert nodes operate in private threads with zero awareness of peers, preventing "logical contamination."
  • Centralized Verification: A specialized "Chief Justice" aggregator synthesizes reports, identifying conflicts and evidence gaps before delivering a verdict.
  • Audit-First Design: Every decision generates a 100% traceable log of expert rationale, meeting EU AI Act requirements for monitorable AI.

Octochains Anathomy

https://github.com/user-attachments/assets/ede601fd-0a08-451f-b783-67d854767bb8


Quickstart

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

1. Install

pip install octochains

2. Bring Your Own LLM (Zero-Dependency)

Octochains requires an LLMCallable: a standard Python function that takes a prompt: str and returns an output (string, dictionary, or object).

import openai

client = openai.Client(api_key="sk-...")

def my_llm(prompt: str) -> str:
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": prompt}],
        temperature=0.3
    )
    return response.choices[0].message.content

3. Define Agent

from octochains import Agent, tool

class Specialist(Agent):
    def __init__(self):
        super().__init__(
            role="Legal Expert", 
            goal="Identify liability risks",
            input_description="A business proposal document.",
            llm_callable=my_llm
        )

    @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:
        # Base class automatically handles the double-blind isolation prompt
        # and dynamically injects your @tool schemas!
        prompt = self._build_prompt(data)
        return self.llm_callable(prompt)

4. Define an Aggregator

from octochains import Aggregator
from typing import Any

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

    def execute(self, agent_reports: dict[str, str]) -> Any:
        """
        Receives a dictionary of reports.
        Key: Agent Role, Value: Agent output string.
        Can return a string, or natively return a structured JSON/Pydantic object!
        """
        # Helper method cleanly formats the raw dictionary
        compiled_reports = self._format_reports(agent_reports)
        
        prompt = f"""
        Role: {self.role}
        Goal: {self.goal}
        Reports:{compiled_reports}
        FINAL VERDICT:
        """
        return self.llm_callable(prompt)

5. Run the Parallel Engine

from octochains import Engine

# Initialize your experts and the aggregator
legal_expert = Specialist()
# finance_expert = FinanceSpecialist()
# tech_expert = TechSpecialist()

engine = Engine(
    agents=[legal_expert], # Add as many agents as you need
    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}")

Architecture & Strategy

Octochains is designed for high-stakes environments where "vibe-based" AI isn't enough. It excels in Medical Diagnostics, Legal Audits, and Strategic Business and Financial Analysis.

Repository Structure

  • /src/octochains/engine.py: The high-performance parallel execution engine.
  • /src/octochains/agents/: A growing library of specialized experts (Finance, Legal, Medical and etc.).
  • /src/octochains/aggregators/: Standardized synthesis logic (Majority Vote, Weighted Consensus, etc.).

Future Roadmap

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

  • Community-driven marketplace for pre-tuned specialists Agents.

License

Octochains is Fair-code, distributed under the Business Source License 1.1.

  • Individuals & Internal Use: Free to use for personal projects, research, and internal business workflows.
  • Commercial Providers: You cannot offer Octochains as a managed SaaS or sell a commercial wrapper of the engine without a license.
  • The Guarantee: On May 10, 2030, this version automatically becomes Apache 2.0 (Open Source).

To access the Enterprise Reasoning Features, 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.2.0.tar.gz (12.9 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.2.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: octochains-0.2.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for octochains-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f440c436076afa0c6535713b5adf8f10870f379aba29e58e95e1a4cb339de2e8
MD5 ed5a96f7296a56eb8d7882b1d494cc0d
BLAKE2b-256 cffc4dcadc8756196c5420aa47f30ec55b2de25afc20f949cd72e4e89ff4c692

See more details on using hashes here.

Provenance

The following attestation bundles were made for octochains-0.2.0.tar.gz:

Publisher: release.yml on ahmadvh/octochains

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: octochains-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for octochains-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56aa054dd8157b427d23729fa77d422acd13aa0133d796a5576001c737c4f948
MD5 a6c91db673c6a1d9daa0b1ec916c5a2f
BLAKE2b-256 0910d676585b4de7c8bfcf84e9f857746d769db4183a2e32a692be691c715988

See more details on using hashes here.

Provenance

The following attestation bundles were made for octochains-0.2.0-py3-none-any.whl:

Publisher: release.yml on ahmadvh/octochains

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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