Skip to content

Bingo-W/TRUCE

Repository files navigation

TRUCE: From Interaction Trajectories to Prompt Rules

This repository contains the code for From Interaction Trajectories to Prompt Rules: Credit Assignment for Multi-Agent Prompt Optimization.

TRUCE, short for Trajectory-based Rule Credit Estimation, is a framework for prompt optimization in LLM-based multi-agent systems. TRUCE links outcome feedback to informative sub-trajectories, estimates credit for prompt-defined behavioral rules, and applies localized rule edits while preserving fixed agent roles and interaction structures.

Code repository: https://github.com/Bingo-W/TRUCE

Overview

LLM-based multi-agent systems often specify agent behavior with natural-language prompts. When roles and interaction structures are fixed, the main optimization challenge is credit assignment: useful or harmful behaviors may emerge only across long, noisy interaction trajectories. Outcome-level feedback alone is often too coarse for targeted prompt updates.

TRUCE addresses this by:

  • identifying informative sub-trajectories from multi-agent interaction histories;
  • assigning trajectory-aware credit to prompt-defined behavioral rules;
  • converting credit signals into localized rule edits;
  • aggregating edits across tasks for iterative prompt refinement.

Installation

Requirements:

  • Python >= 3.9 and < 3.12
  • Linux or macOS
  • CPU-only execution is sufficient for most examples

Using Poetry:

curl -sSL https://install.python-poetry.org | python3 -
poetry install --no-root
poetry run python -c "import sys; print(sys.version)"

Using pip:

python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .

LLM Configuration

Configure model credentials through environment variables or a local .env file. Do not hardcode API keys in source files.

cp .env.template .env
# Edit .env with your own credentials.

Common variables:

  • OPENAI_API_KEY
  • TOGETHERAI_API_KEY
  • OPENAI_BASE_URL
  • TOGETHERAI_BASE_URL

Quick Start

Run a single configuration:

python marble/main.py --config_path marble/configs/test_config_reasoning.yaml

Run the optimization pipeline:

TRUCE_DATASET_DIR=marble/configs/coding_configs \
TRUCE_OUTPUT_DIR=exp/truce_demo \
python -m truce.optimization_pipeline

Run batch experiments:

python -m truce.run_exp_batch \
  --config-dir marble/configs/coding_configs \
  --output-dir exp/truce_batch

Data and Configurations

Example configurations are included under marble/configs/. The pipeline expects YAML task configurations.

If using JSONL task sources from multiagentbench/, convert them with:

python multiagentbench/jsonl2yaml.py \
  --input multiagentbench/coding/coding_main.jsonl \
  --output-dir marble/configs/test_config

Generated outputs, logs, local database state, and experiment artifacts should not be committed. See .gitignore for ignored paths.

Relationship to MARBLE

This repository builds on components from MARBLE, a benchmark and framework for multi-agent systems. If you use the MARBLE benchmark components, please also follow the citation and license requirements of the upstream MARBLE project.

Citation

@inproceedings{wu2026truce,
  title={From Interaction Trajectories to Prompt Rules: Credit Assignment for Multi-Agent Prompt Optimization},
  author={Wu, Bin and Xu, Haoran and Zhuang, Xiang and Chen, Zonghao and Li, Zhu and Yilmaz, Emine and Zhang, Qiang},
  booktitle={Proceedings of the 43rd International Conference on Machine Learning},
  year={2026},
  note={To appear}
}

License

This repository is released under the MIT License. See LICENSE and NOTICE.md for copyright and attribution information.

About

Official implementation of TRUCE: Trajectory-based Rule Credit Estimation for Multi-Agent Prompt Optimization.

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages