This repository accompanies:
Bhargava, H. K., & Soliman, M. (in preparation). The Structure of U.S. State AI Policy: Evidence from a Multi-Dimensional Bill Classification.
The version of the code used to produce the analyses in the paper is tagged as v1.0.1-rp-submission.
The full dataset of 2,571 classified bills, validation annotations from three independent annotators, and complete database construction documentation are archived on Zenodo:
- Concept DOI (always latest): 10.5281/zenodo.20348531
- This version: 10.5281/zenodo.20348820
https://github.com/marksoliman3/Bill_Analyst_Agent/tree/main
Bill Analyst is a sophisticated yet easy-to-use tool that transforms complex legislative bills into clear, structured insights. It's like having a team of expert analysts working for you 24/7, breaking down dense legal text into actionable information.
Legislative bills are:
- 📚 Lengthy and complex (often 100+ pages of legal jargon)
- 🧩 Difficult to compare across different policy dimensions
- ⏱️ Time-consuming to analyze manually
- 🤔 Inaccessible to non-experts without legal backgrounds
Bill Analyst uses artificial intelligence to:
- ✂️ Extract the most relevant sections from lengthy bills
- 📝 Create plain-language summaries anyone can understand
- 🏷️ Score bills across key dimensions using a consistent taxonomy
- 🔄 Ensure quality through multi-agent review and revision
Our system identifies and extracts only the most relevant portions of bills, focusing on what matters most.
Complex legal language is transformed into concise, clear summaries that anyone can understand.
Each bill is analyzed across seven critical dimensions by specialized AI analysts, with a scoring scale of 0-0.5-1:
| Dimension | What It Measures |
|---|---|
| 🛡️ Product Safety, Accountability, & Risk | How the bill addresses safety testing, reliability standards, transparency, and accountability |
| 📜 AI Inputs & IP | How the bill impacts IP rights, creator compensation, and consumer data privacy |
| 🏢 Market Structure & Competition | How the bill ensures fair competition, data sharing, and computing resource allocation |
| 🔍 Specific Use & Sectoral Regulation | How the bill regulates AI in high-risk sectors, employment, and content policies |
| 🌍 Existential and Societal Risks | How the bill addresses labor markets, environmental sustainability, and democratic processes |
| ⚖️ Institutional Processes & Governance | How the bill establishes advisory bodies, regulatory frameworks, and agency authorities |
| 💰 AI Advancement & Development | How the bill allocates resources, creates incentives, and invests in infrastructure |
A specialized "Judge" agent reviews all analyses, providing feedback and triggering revisions when needed to ensure consistent, high-quality results.
Results are delivered in a clean, structured format that makes it easy to compare bills and identify trends. The output includes:
- The original bill data preserved from the input CSV
- Extracted relevant bill text and plain-language summary
- Detailed analyst results with scores and justifications
- Individual score columns for each dimension (e.g.,
market_structure_score,ai_inputs_ip_score) for easy filtering and analysis - Processing status and metadata
Bill Analyst is built as a local Python application using state-of-the-art AI technologies:
- LangGraph: Powers our multi-agent workflow with sophisticated state management
- LangChain: Provides core abstractions for agent interactions
- Pydantic: Ensures data validation and schema enforcement
- Pandas: Handles all CSV operations for input and output
- Robust JSON Parsing: Custom implementation to handle special characters in text
The system features:
- Modular "Graph of Graphs" architecture where each specialized agent operates as its own subgraph
- Enhanced error handling for reliable processing of complex legislative text
- Comprehensive context extraction that maintains structural integrity of bills
The system is designed as a "Graph of Graphs" where each specialized agent operates as its own subgraph, creating a modular, maintainable architecture.
- Python 3.10 or higher
- OpenAI API key
-
Clone the repository
git clone https://github.com/your-organization/bill-analyst.git cd bill-analyst -
Create and activate a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create a
.envfile with your OpenAI API keyOPENAI_API_KEY=your_api_key_here
-
Place your input CSV file in the
datadirectory (see format requirements below) -
Run the application
python -m src.main
-
Find your results in the
datadirectory asoutput_analysis.csv
Your input CSV should contain at minimum these columns:
Bill_Number: A unique identifier for each billBill_Text: The full text of the bill
For each bill, Bill Analyst produces:
- A concise 5-sentence summary in plain language
- Scores (0-0.5-1) across seven key dimensions
- Individual score columns for easy analysis and visualization
- Detailed justifications for each score
- Processing status and metadata
- All original data from the input file preserved
Bill Analyst runs entirely on your local machine. Your legislative data never leaves your computer except for secure API calls to the language model.
Bill Analyst: Making legislation transparent, accessible, and actionable.