Skip to content

Repository files navigation

ChatCortex

CI PyPI version Python 3.9+ License: MIT

ChatCortex is a framework for automated synthesis and optimization of AI agent architectures — think AutoML for AI agents.

Instead of manually wiring LLM pipelines (retrieval → LLM → verifier → tool), ChatCortex treats agent design as a multi-objective architecture search problem and automatically discovers architectures that optimize cost, latency, and reliability simultaneously.

Task Specification → Architecture Search → Pareto-Optimal Architectures

Installation

pip install chatcortex

Or from source:

git clone https://github.com/siddharth1012/chatCortex
cd chatCortex
pip install -e .

Quickstart

from chatcortex import (
    TaskSpecification,
    BeamSynthesizer,
    build_demo_registry,
)

# A registry of components with cost/latency/reliability tradeoffs
registry = build_demo_registry(
    capabilities=("retrieval", "generation", "verification")
)

# The task: an ordered capability chain with hard constraints
task = TaskSpecification(
    required_capabilities=["retrieval", "generation", "verification"],
    max_cost=0.02,
    max_latency=1500,
)

# Synthesize Pareto-optimal architectures
synth = BeamSynthesizer(registry, beam_width=5)
for arch in synth.synthesize(task):
    print(
        f"cost=${arch.total_cost:.4f} "
        f"latency={arch.total_latency:.0f}ms "
        f"reliability={arch.total_reliability:.3f}"
    )

Or run the full demo comparing three synthesis strategies:

python examples/quickstart.py

To search over your own components, build a CapabilityRegistry and register ComponentMetadata describing each model, tool, or verifier — see examples/ for complete walkthroughs.

How It Works

ChatCortex is organized as a layered architecture synthesis system:

TaskSpecification → CapabilityRegistry → Synthesis Engine → AgentGraph (DAG)
    → Execution Engine → Telemetry → Evaluation Harness → Pareto Optimization

Core concepts:

  • ComponentMetadata — declarative description of an agent component (model, retriever, tool, verifier, memory) with cost per call, latency, reliability score, and privacy level.
  • CapabilityRegistry — stores components and filters candidates by capability and privacy constraints.
  • TaskSpecification — the synthesis problem: an ordered capability chain plus hard constraints (max cost, max latency, privacy) and objective weights.
  • AgentGraph — architectures represented as DAGs; cost is additive, latency sequential, reliability multiplicative.
  • Synthesizers — search strategies that map a task to an (approximate) Pareto frontier.

Available synthesizers:

Synthesizer Strategy
HeuristicSynthesizer Greedy deterministic construction
RandomSynthesizer Random baseline
BeamSynthesizer Budget-aware beam search
ParetoPartialBeamSynthesizer Beam search with per-stage Pareto pruning
ProgressiveParetoBeamSynthesizer Depth-aware beam widening (best Pareto recovery)
ExhaustiveSynthesizer Exact Pareto frontier (small spaces)

Approximation quality is measured with Pareto coverage, hypervolume loss, and average regret — see docs/BENCHMARKS.md.

Documentation

Research Context

ChatCortex is a controlled experimental platform for studying automated agent architecture synthesis: multi-objective optimization, architecture search, reliability–cost tradeoffs, and AutoML-style agent design. Experiments cover 5-stage pipelines with Pareto frontiers up to 95 architectures and evaluation budgets from 20 to 180 evaluations; progressive beam widening shows improved Pareto recovery over static beam strategies.

If you use ChatCortex in your research, please cite it (see CITATION.cff).

Roadmap

  • Component modeling, capability registry, task specification, DAG representation
  • Exact Pareto frontier computation (exhaustive search)
  • Budget-aware beam search with Pareto pruning and progressive widening
  • Graph-structured (non-chain) agent synthesis
  • Real model / tool integrations
  • Registry loading from YAML/JSON

Status

Research framework under active development (alpha). APIs may change between minor versions.

License

MIT — developed by Siddharth Saraswat

About

Multi-objective architecture search for non-hardcoded agent pipelines

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages