This guide shows how to use CodeAssistBench with both Strands (default) and OpenHands (optional) agent frameworks.
Due to externally-managed Python environments, you MUST use a virtual environment:
# 1. Create virtual environment in CodeAssistBench directory
python3 -m venv venv
# 2. Activate virtual environment
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Install CodeAssistBench in development mode
pip install -e .
# 5. Install Strands framework (if available locally)
# Navigate to Strands-Science directory and install:
pip install -e strands-1.12.0/
pip install -e tools/
# 7. Verify installation
python -c "from src.cab_evaluation.agents.agent_factory import AgentFactory; print('β
Setup complete!')"Note: Always activate the virtual environment before running CodeAssistBench:
source venv/bin/activate # Run this each time you start a new terminal sessionsample_issue.json- Single issue for individual evaluationsample_dataset.jsonl- Multiple issues for batch processingstrands_agent_example.py- Code examples and demonstrations
Default model (sonnet37 for all agents):
python -m cab_evaluation.cli single examples/sample_issue.jsonCustom model for all agents:
python -m cab_evaluation.cli single examples/sample_issue.json \
--agent-models '{"maintainer": "sonnet37", "user": "haiku", "judge": "sonnet37"}'Output: cab_result_<issue_id>.json
Default models:
python -m cab_evaluation.cli generation examples/sample_issue.jsonCustom models for generation:
python -m cab_evaluation.cli generation examples/sample_issue.json \
--agent-models '{"maintainer": "sonnet37", "user": "haiku"}'Output: generation_result_<issue_id>.json
Default model:
python -m cab_evaluation.cli evaluation generation_result_1234.jsonCustom model for evaluation:
python -m cab_evaluation.cli evaluation generation_result_1234.json \
--agent-models '{"judge": "sonnet37"}'Output: evaluation_result_<issue_id>.json
Process entire dataset:
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonlFilter by language and custom models:
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--language python \
--agent-models '{"maintainer": "sonnet37", "user": "sonnet37", "judge": "sonnet37"}'Batch processing with resume:
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--batch-size 5 \
--resume \
--output-dir results_strandssonnet37- Claude 3.7 Sonnet (default) - Best for complex reasoninghaiku- Claude 3.5 Haiku - Fast and cost-effectivesonnet- Claude 3.7 Sonnet (alias)thinking- Sonnet with thinking capabilitiesdeepseek- DeepSeek R1 modelllama- Meta Llama 3.3 70B
Generation Workflow (Maintainer + User):
{
"maintainer": "sonnet37", // Complex technical responses
"user": "haiku" // Faster user simulation
}Evaluation Workflow (Judge):
{
"judge": "sonnet37" // Detailed evaluation and reasoning
}Complete Workflow (All Agents):
{
"maintainer": "sonnet37", // Technical problem solving
"user": "haiku", // User interaction simulation
"judge": "sonnet37" // Comprehensive evaluation
}All agents now have access to:
- File Operations: Read, write, and modify files
- Command Execution: Safe bash command execution
- Repository Analysis: Advanced code exploration
- AWS Integration: Direct AWS service interaction
- Advanced Reasoning: Enhanced thinking capabilities
- Prompt Caching: Automatic caching for cost reduction
- Cost Tracking: Detailed token usage and cost analysis
- Metrics Collection: Performance and efficiency monitoring
- Read-Only Mode: Safe operations only
- Command Restrictions: Built-in safety for bash execution
- Graceful Fallback: Works even without Strands framework
CodeAssistBench supports three agent frameworks for the Maintainer agent:
- β Built-in, no extra installation
- β Supports all 3 agents (Maintainer, User, Judge)
- β Optimized with prompt caching
- β Fast and cost-effective
- π§ Alternative framework for Maintainer agent only
- π§ Specialized for complex code generation tasks
- π§ Uses OpenHands SDK for repository exploration
- π§ Alternative framework for Maintainer agent only
- π§ Uses Amazon Q CLI for AWS-native workflows
- π§ Subprocess-based integration
OpenHands:
# Install OpenHands support
pip install -e .[openhands]
# Set API key
export ANTHROPIC_API_KEY="your-key-here"Q-CLI:
# Install Q-CLI following AWS documentation
# Verify installation
q --version
# Configure AWS credentials (if not already done)
aws configure
# Test Q-CLI
q chat --model claude-sonnet-4.5 "Hello"
# No additional Python packages needed for Q-CLIStrands (default):
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--agent-models '{"maintainer": "sonnet37", "user": "haiku", "judge": "sonnet37"}'OpenHands maintainer:
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--agent-models '{"maintainer": "claude-sonnet-4-5-20250929", "user": "haiku", "judge": "sonnet37"}' \
--agent-framework '{"maintainer": "openhands"}'Q-CLI maintainer:
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--agent-models '{"maintainer": "claude-sonnet-4.5", "user": "haiku", "judge": "sonnet37"}' \
--agent-framework '{"maintainer": "qcli"}'from cab_evaluation import create_cab_evaluator
# Strands (default)
evaluator = create_cab_evaluator(
agent_model_mapping={"maintainer": "sonnet37", "user": "haiku", "judge": "sonnet37"}
)
# OpenHands maintainer
evaluator = create_cab_evaluator(
agent_model_mapping={"maintainer": "claude-sonnet-4-5-20250929", "user": "haiku", "judge": "sonnet37"},
agent_framework_mapping={"maintainer": "openhands"}
)
# Q-CLI maintainer
evaluator = create_cab_evaluator(
agent_model_mapping={"maintainer": "claude-sonnet-4.5", "user": "haiku", "judge": "sonnet37"},
agent_framework_mapping={"maintainer": "qcli"}
)| Framework | Format | Example |
|---|---|---|
| Strands | Short names | "sonnet37", "haiku" |
| OpenHands | Full model ID | "claude-sonnet-4-5-20250929" |
| Q-CLI | Q-CLI model names | "claude-sonnet-4.5", "claude-haiku-4.5" |
Q-CLI Available Models:
claude-sonnet-4.5claude-sonnet-4claude-haiku-4.5qwen3-coder-480bAuto(default)
Check available models: q chat --model invalid 2>&1 | grep Available
| Feature | Strands | OpenHands | Q-CLI |
|---|---|---|---|
| Installation | Included | pip install openhands |
External CLI |
| Agent Support | All 3 agents | Maintainer only | Maintainer only |
| Speed | Fast | Moderate | Fast |
| Metrics | Full token tracking | Full token tracking | Basic metrics only |
| Best For | General evaluation | Complex code tasks | AWS Q integration |
OpenHands not found:
pip install openhands openhands-sdk openhands-toolsOpenHands API key not set:
export ANTHROPIC_API_KEY="your-key-here"Q-CLI not found:
# Install Q-CLI following AWS documentation
# Verify installation
q --version
# If command not found, ensure Q-CLI is in PATH
which qQ-CLI timeout errors:
# Increase timeout in Python API
evaluator = create_cab_evaluator(
agent_model_mapping={"maintainer": "claude-sonnet-4.5"},
agent_framework_mapping={"maintainer": "qcli"},
agent_framework_config={"qcli_timeout": 600} # 10 minutes
)Q-CLI model not available:
# Check available models
q chat --model invalid 2>&1 | grep Available
# Use a supported model
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--agent-models '{"maintainer": "claude-sonnet-4.5"}' \
--agent-framework '{"maintainer": "qcli"}'Import errors:
- System automatically falls back to Strands
- No action needed
# Install Q-CLI (follow AWS docs), then verify
q --version
q chat --model claude-sonnet-4.5 "test"# CLI
python -m cab_evaluation.cli dataset examples/sample_dataset.jsonl \
--agent-models '{"maintainer": "claude-sonnet-4.5", "user": "haiku", "judge": "sonnet37"}' \
--agent-framework '{"maintainer": "qcli"}'
# Python API
evaluator = create_cab_evaluator(
agent_model_mapping={"maintainer": "claude-sonnet-4.5", "user": "haiku", "judge": "sonnet37"},
agent_framework_mapping={"maintainer": "qcli"}
)claude-sonnet-4.5(recommended)claude-haiku-4.5(fast)Auto(default)
- No token usage tracking
- No cache metrics
- Basic metadata only (execution time, return code)
Create custom configuration:
python -m cab_evaluation.cli config examples/custom_config.jsonFor safe repository analysis:
from cab_evaluation.agents.agent_factory import AgentFactory
factory = AgentFactory()
maintainer = factory.create_maintainer_agent(
model_name="sonnet37",
read_only=True # Only safe operations
)Enable detailed logging:
python -m cab_evaluation.cli single examples/sample_issue.json \
--log-level DEBUG \
--log-file strands_debug.log{
"number": 1234,
"title": "[Bug]: Issue description",
"created_at": "ISO timestamp",
"closed_at": "ISO timestamp",
"commit_id": "git commit hash",
"labels": ["bug", "docker"],
"url": "GitHub issue URL",
"body": "Detailed issue description with markdown",
"author": "username",
"comments": [
{
"user": "maintainer_username",
"created_at": "ISO timestamp",
"body": "Response content with code examples"
}
],
"satisfaction_conditions": [
"Condition 1: What the user needs to be satisfied",
"Condition 2: Technical requirements",
"Condition 3: Additional expectations"
],
"_classification": {
"category": "Needs Docker build environment | Does not need build environment",
"timestamp": "completion timestamp"
}
}Each line contains one complete issue JSON object as shown above.
{
"issue_id": "1234",
"user_satisfied": true/false,
"satisfaction_status": "FULLY_SATISFIED|PARTIALLY_SATISFIED|NOT_SATISFIED",
"total_conversation_rounds": 3,
"conversation_history": [...],
"agent_model_mapping": {...}
}{
"issue_id": "1234",
"verdict": "CORRECT|PARTIALLY_CORRECT|INCORRECT",
"alignment_score": {
"satisfied": 3,
"total": 3,
"percentage": 100.0
},
"docker_results": {...},
"agent_model_mapping": {...}
}- Use appropriate models: sonnet37 for complex reasoning, haiku for speed
- Enable caching: Automatic with Strands framework
- Monitor costs: Check logs for token usage and cost tracking
- Batch processing: Use reasonable batch sizes for large datasets
- Resume capability: Use
--resumefor interrupted dataset processing
- Import errors: Ensure Strands framework is available in Python path
- Model access: Verify AWS credentials for Bedrock model access
- Permission errors: Check file permissions for read/write operations
- Tool failures: Review logs for specific tool execution errors
If Strands framework is unavailable, agents automatically fall back to standard LLM service with reduced capabilities but full compatibility.
- Try the sample files with different model combinations
- Monitor the enhanced logging and metrics
- Experiment with read-only mode for safe operations
- Use the tool capabilities for repository analysis and code exploration