CoBRA AI Agent

by AISmithLabโ€ข 97โ€ขโ€ข Scannedโ€ขClaim this listingโ€ขRequest removal
Research & Analysisagent based modelingai agentai toolshcillm agent

[๐Ÿ† CHI26 Best Paper] CoBRA: Reproducible control of LLM agent behavior via classic social science experiments

CoBRA is an open-source ai agent by AISmithLab, written mainly in Python, with 97 GitHub stars and the MIT license. Its code was last updated Apr 21, 2026.

<p align="center"> <img src="figures/Cobra.png" alt="CoBRA Logo" width="400"/> </p> <p align="center"> <a href="https://chi2026.acm.org/"><img src="https://img.shields.io/badge/๐Ÿ†_CHI_2026-Best_Paper_Award-gold.svg" alt="CHI 2026 Best Paper Award"></a> <a href="https://arxiv.org/abs/2509.13588"><img src="https://img.shields.io/badge/arXiv-2509.13588-b31b1b.svg" alt="arXiv"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License"></a> <img src="https://img.shields.io/badge/๐Ÿšง_Status-Under_Active_Development-orange.svg" alt="Under Active Development"> </p> <h3 align="center"><em>Toward Precise and Consistent Agent Behaviors across Models Anchored by Validated Social Science Knowledge</em></h3> <p align="center"> ๐ŸŒ <b>Project Page</b>: <a href="https://cobra.clawder.ai">cobra.clawder.ai</a> &nbsp;|&nbsp; ๐Ÿ“„ <b>Paper</b>: <a href="https://arxiv.org/abs/2509.13588">arXiv 2509.13588</a> </p> <p align="center"><strong>If you find CoBRA useful, please star โญ this repo to help others discover it!</strong></p> <p align="center"> <a href="README.md"><img src="https://img.shields.io/badge/lang-English-blue.svg" alt="English"></a> <a href="README_zh-CN.md"><img src="https://img.shields.io/badge/lang-็ฎ€ไฝ“ไธญๆ–‡-red.svg" alt="็ฎ€ไฝ“ไธญๆ–‡"></a> </p>

<video src="https://github.com/user-attachments/assets/028ca8f4-6edd-426e-b436-2c3b796d81a0" controls width="700"></video>

๐Ÿ’ก What is Cognitive Bias?

Systematic deviations from rational judgment in human cognition and decision-making. For example, Framing Effect: "90% survival rate" vs. "10% mortality rate" โ€” logically identical, yet people make different choices based on how information is framed.


Reproducibility and controllability are fundamental to scientific research. Yet implicit natural language descriptions โ€” the dominant approach for specifying social agent behaviors in nearly all LLM-based social simulations โ€” often fail to yield consistent behavior across models or capture the nuances of the descriptions.

CoBRA (Cognitive Bias Regulator for Social Agents) is a novel toolkit that lets researchers explicitly specify desired nuances in LLM-based agents and obtain consistent behavior across models.

Through CoBRA, we show how to operationalize validated social science knowledge as reusable "gym" environments for AI โ€” an approach that generalizes to richer social and affective simulations.

<p align="center"> <img src="figures/fig1.png" alt="CoBRA Overview" width="800"/> <br> <em>The problem and our solution: from inconsistent agent behaviors under implicit specifications to explicit, quantitative control.</em> </p>

At the heart of CoBRA is a novel closed-loop system with two core components:

  • Cognitive Bias Index โ€” measures the cognitive bias of a social agent by quantifying its reactions in validated classic social science experiments
  • Behavioral Regulation Engine โ€” aligns the agent's behavior to exhibit controlled cognitive bias, via three control methods:
    • Prompt Engineering (input space control)
    • Representation Engineering (activation space control)
    • Fine-tuning (parameter space control)
<p align="center"> <img src="figures/fig2.png" alt="CoBRA Workflow" width="800"/> <br> <em>Example: A researcher specifies a target bias level โ†’ CoBRA measures it via classic experiments โ†’ iteratively adjusts the agent until it reliably exhibits the desired bias.</em> </p>

Quick Start (3 Steps)

# 1. Install dependencies
pip install -r requirements.txt

# 2. Navigate to the unified bias control module
cd examples/unified_bias

# 3. Run a bias experiment
python pipelines.py --bias authority --method repe-linear --model Mistral-7B

That's it. The system will measure and control the agent's Authority Effect bias.

Repository Structure

CoBRA/
โ”œโ”€โ”€ control/                    # Core bias control engine
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ unified_bias/           # Main entry point (START HERE)
โ”‚   โ”‚   โ”œโ”€โ”€ pipelines.py        # Unified experiment runner
โ”‚   โ”‚   โ”œโ”€โ”€ run_pipelines.py    # CLI interface
โ”‚   โ”‚   โ”œโ”€โ”€ ablation/           # Ablation studies
โ”‚   โ”‚   โ””โ”€โ”€ README.md           # Full usage guide
โ”‚   โ”œโ”€โ”€ authority/              # Authority Effect utils
โ”‚   โ”œโ”€โ”€ bandwagon/              # Bandwagon Effect utils
โ”‚   โ”œโ”€โ”€ confirmation/           # Confirmation Bias utils
โ”‚   โ””โ”€โ”€ framing/                # Framing Effect utils
โ”œโ”€โ”€ generator/                  # Data generation utilities
โ”œโ”€โ”€ data_generated/             # Generated experimental data
โ”œโ”€โ”€ webdemo/                    # Web demonstration interface
โ””โ”€โ”€ requirements.txt            # Python dependencies

Key Components

ComponentDescriptionDocumentation
Cognitive Bias IndexMeasures bias strength via classic experimentsdata/data_README.md
Behavioral Regulation EngineThree control methods (Prompt/RepE/Finetune)control/control_README.md
Unified PipelineRun full experiments with one commandexamples/unified_bias/README.md
Ablation StudiesTest model/persona/temperature sensitivityexamples/unified_bias/ablation/README.md
Data GeneratorCreate custom bias scenarios and responsesgenerator/README.md

Supported Biases & Experiments

Bias TypeParadigmsData DirectoryControl Range
Authority EffectMilgram Obedience, Stanford Prisondata/authority/0-4 scale
Bandwagon EffectAsch's Line, Hotel Toweldata/bandwagon/0-4 scale
Confirmation BiasWason Selection, Biased Informationdata/confirmation/0-4 scale
Framing EffectAsian Disease, Investment/Insurancedata/framing/0-4 scale

Citation

If you use CoBRA in your research, please cite our paper:

@article{liu2025cobra,
  title={CoBRA: Programming Cognitive Bias in Social Agents Using Classic Social Science Experiments},
  author={Liu, Xuan and Shang, Haoyang and Jin, Haojian},
  journal={arXiv preprint arXiv:2509.13588},
  year={2025}
}

Paper Link: https://arxiv.org/abs/2509.13588

License

MIT License - see LICENSE for details

Contact

For questions, please contact the corresponding author Xuan Liu at xul049@ucsd.edu, or file a GitHub Issue to report bugs and request features.


Need help? Check examples/unified_bias/README.md for detailed walkthroughs. The finetuning code is in the finetuning branch.

CoBRA alternatives

View more โ†’

Similar ai agents in Research & Analysis, ranked by GitHub stars. Compare licence, recent activity and scan status before you choose.

NameStarsLicenceLast updatedScan
CoBRA (this page)
AISmithLab
97MITApr 21, 2026Scanned, no flagged issues
Hermes Agent
NousResearch
259kMITNov 1, 2026Scanned, no flagged issues
Anything LLM
Mintplex-Labs
68kMITOct 30, 2026Scanned, no flagged issues
Khazix Skills
KKKKhazix
22kMITOct 1, 2026Scanned, no flagged issues
Hermes Webui
nesquena
19kMITNov 1, 2026Scanned, no flagged issues
DocsGPT
arc53
18kMITNov 1, 2026Scanned, no flagged issues