Multi-agent system for HED annotation generation and validation
Project description
HEDit
Multi-agent system for converting natural language event descriptions into valid HED (Hierarchical Event Descriptors) annotations. Part of the Annotation Garden Initiative.
Features
-
Multi-Agent Architecture: Uses LangGraph to orchestrate specialized agents
- Annotation Agent: Generates HED tags using JSON schema vocabulary (short-form tags)
- Validation Agent: Validates HED compliance with detailed error feedback
- Evaluation Agent: Assesses faithfulness & suggests closest tag matches
- Assessment Agent: Identifies missing elements & dimensions
-
JSON Schema Support: Uses official HED JSON schemas with short-form tags and extensionAllowed detection
-
Intelligent Validation: Multi-stage validation with feedback loops and closest match suggestions
-
Local LLM Serving: Uses Ollama with
gpt-oss:20bmodel (20B parameters) -
GPU Acceleration: Optimized for NVIDIA RTX 4090 with CUDA support
-
Scalable: Designed for 10-15 concurrent users
-
Auto-Configuration: Model automatically pulled on first Docker start
Documentation
📚 Full Documentation - Comprehensive guides for users, deployers, and developers
Quick Links:
- Usage Guide - Getting started with HEDit
- Deployment Guide - Choose your deployment option (production, local GPU, or local dev)
- API Reference - API documentation
- Development Guide - Contribute to HEDit
Deployment Options
HEDit supports multiple deployment scenarios. Choose the one that fits your needs:
For Production (Recommended)
Deploy to a server or cloud platform with API key authentication, audit logging, and auto-updates. → See DEPLOYMENT.md and deploy/README.md
For Local GPU Development
Run completely offline with Ollama and local GPU (requires NVIDIA RTX 3090/4090+). → See docs/deployment/docker-quickstart.md
For Quick Local Testing
Use your local Python environment with OpenRouter API (no GPU needed). → See Local Development Setup below
Not sure which to choose? See the Deployment Decision Matrix
Architecture
flowchart LR
Start([Input]) --> Schema[(JSON Schema<br/>Vocabulary)]
Schema --> Ann[Annotation Agent]
Ann --> Val{Validation}
Val -->|Invalid<br/>retry| ValErr[Syntax Errors]
ValErr --> Ann
Val -->|Max attempts| Fail[Failed]
Val -->|Valid| Eval{Evaluation}
Eval -->|Not faithful| EvalErr[Tag Suggestions<br/>Extension Warnings]
EvalErr --> Ann
Eval -->|Faithful| Assess{Assessment}
Assess -->|Incomplete| AssErr[Missing Elements]
AssErr -.Optional.-> Ann
Assess -->|Complete| Success[Final Annotation]
AssErr -->|Report| Success
Success --> End([Output])
Fail --> End
style Start fill:#e1f5ff
style End fill:#e1f5ff
style Ann fill:#fff4e1
style Val fill:#ffe1e1
style Eval fill:#e1ffe1
style Assess fill:#f0e1ff
style Success fill:#e1ffe1
style Fail fill:#ffe1e1
style Schema fill:#e8e8e8
Legend:
- 🔄 Solid arrows: Automatic loops
- ⋯⋯ Dotted arrows: Optional refinement
- 🔵 Input/Output | 🟡 Annotation | 🔴 Validation | 🟢 Evaluation | 🟣 Assessment
Workflow Details
-
Annotation Loop (Automatic):
- Generates HED annotation using short-form tags
- Uses complete HED syntax rules (parentheses, curly braces, #, /)
- Considers extensionAllowed tags for extensions
- Maximum validation attempts: 5 (configurable)
-
Validation Loop (Automatic):
- Checks syntax and tag validity
- Provides specific error codes and messages
- Loops back to annotation agent if errors found
- Stops if max attempts reached
-
Evaluation Loop (Automatic):
- Assesses faithfulness to original description
- Validates tags against JSON schema vocabulary
- Suggests closest matches for invalid tags
- Warns about non-portable tag extensions
- Loops back if not faithful
-
Assessment Loop (Optional):
- Final completeness check
- Identifies missing dimensions
- Can trigger optional refinement or report only
- Configurable behavior
Installation
Docker (Recommended - Self-Contained)
- Docker with NVIDIA Container Toolkit
- Docker Compose
- All dependencies (Python, Node.js, HED schemas, validator) included in image!
Local Development
- Python 3.11+
- CUDA-capable GPU (for LLM serving)
- Node.js 18+ (for HED JavaScript validator)
- Conda (recommended)
Quick Start (Docker)
# Clone repository
cd /path/to/hedit
# Build and start (auto-pulls model and includes all HED resources)
docker-compose up -d
# Monitor first start (~10-20 min for model download)
docker-compose logs -f
# Verify
curl http://localhost:38427/health
# Open frontend
open frontend/index.html
Local Development Setup
- Create conda environment:
source ~/miniconda3/etc/profile.d/conda.sh
conda create -n hedit python=3.11 -y
conda activate hedit
- Install dependencies:
pip install -e ".[dev]"
- Clone HED resources (if not using Docker):
# NOTE: Using forked hed-schemas with fix for JSON inheritance attributes
# TODO: Revert to hed-standard/hed-schemas once upstream fix is merged
git clone -b fix/json-inheritance-attributes https://github.com/neuromechanist/hed-schemas.git ../hed-schemas
git clone https://github.com/hed-standard/hed-javascript.git ../hed-javascript
cd ../hed-javascript && npm install && npm run build && cd -
Usage
Start the Backend Server
uvicorn src.api.main:app --reload --host 0.0.0.0 --port 38427
API Endpoints
POST /annotate: Generate HED annotation from natural languagePOST /validate: Validate HED annotationGET /health: Health check- API URL:
http://localhost:38427
Development
Run Tests
pytest
Code Quality
ruff check src/ tests/
ruff format src/ tests/
Coverage Report
pytest --cov=src --cov-report=html
Project Structure
hedit/
├── src/
│ ├── agents/ # LangGraph agent implementations
│ ├── validation/ # HED validation integration
│ ├── utils/ # Helper utilities
│ └── api/ # FastAPI backend
├── frontend/ # Web UI
├── tests/ # Test suite
├── docs/ # Documentation
└── .context/
└── plan.md # Project roadmap
License
MIT
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hedit-0.6.1a0.tar.gz.
File metadata
- Download URL: hedit-0.6.1a0.tar.gz
- Upload date:
- Size: 95.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07513c49430aabc1cd5907479e8cfdb5badb1afd154cb5d25ba4927dbce870b0
|
|
| MD5 |
88be4a8c25e894cc25386b67b4d09338
|
|
| BLAKE2b-256 |
6c525dd698e992cbc2d09988ad5ca6cef6502ded24a7c7fd6e4310476bfd64b5
|
Provenance
The following attestation bundles were made for hedit-0.6.1a0.tar.gz:
Publisher:
publish.yml on Annotation-Garden/HEDit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hedit-0.6.1a0.tar.gz -
Subject digest:
07513c49430aabc1cd5907479e8cfdb5badb1afd154cb5d25ba4927dbce870b0 - Sigstore transparency entry: 767512642
- Sigstore integration time:
-
Permalink:
Annotation-Garden/HEDit@e197acbfd679f74ad015a562658a5cf95d2409ce -
Branch / Tag:
refs/tags/v0.6.1-alpha - Owner: https://github.com/Annotation-Garden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e197acbfd679f74ad015a562658a5cf95d2409ce -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hedit-0.6.1a0-py3-none-any.whl.
File metadata
- Download URL: hedit-0.6.1a0-py3-none-any.whl
- Upload date:
- Size: 80.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dd107b40efa632360d04cc084f95e9fc76f89f2df2f485755bf65089256f9c2
|
|
| MD5 |
a14cf1a4b4f5f89cd39412e381654394
|
|
| BLAKE2b-256 |
cdaf422bbf5f8e3aea7b98ff94f8a85bc817a1699b83d5911f9e642798a46d88
|
Provenance
The following attestation bundles were made for hedit-0.6.1a0-py3-none-any.whl:
Publisher:
publish.yml on Annotation-Garden/HEDit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hedit-0.6.1a0-py3-none-any.whl -
Subject digest:
2dd107b40efa632360d04cc084f95e9fc76f89f2df2f485755bf65089256f9c2 - Sigstore transparency entry: 767512653
- Sigstore integration time:
-
Permalink:
Annotation-Garden/HEDit@e197acbfd679f74ad015a562658a5cf95d2409ce -
Branch / Tag:
refs/tags/v0.6.1-alpha - Owner: https://github.com/Annotation-Garden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e197acbfd679f74ad015a562658a5cf95d2409ce -
Trigger Event:
workflow_dispatch
-
Statement type: