Skip to content

Latest commit

Β 

History

101 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agent A11y (Agent Accessibility)

Go CI Go Lint Go SAST Docs Docs Visualization License

Go accessibility auditing toolkit for WCAG 2.0, 2.1, and 2.2 compliance testing.

Features

  • βœ… WCAG Compliance Testing - Supports WCAG 2.0, 2.1, and 2.2 at levels A, AA, and AAA
  • πŸ” Multiple Audit Modes - Single page, site crawling, and user journey testing
  • πŸͺ“ axe-core Integration - Industry-standard accessibility testing via axe-core
  • πŸ€– LLM-as-a-Judge - Optional AI evaluation to reduce false positives
  • πŸ“Š Report Formats - JSON, HTML, Markdown, VPAT 2.4, WCAG-EM, OpenACR, CSV
  • πŸ”Œ MCP Server - Model Context Protocol integration for AI assistants
  • 🌐 HTTP API - REST API for programmatic access
  • 🀝 Multi-Agent Spec - Integration with multi-agent workflows

Installation

go install github.com/plexusone/agent-a11y/cmd/agent-a11y@latest

Prerequisites

  • Go 1.25+
  • Chrome/Chromium browser (for browser-based testing)

Quick Start

CLI Usage

# Audit a single page (outputs agent-optimized JSON by default)
agent-a11y audit https://example.com

# Human-readable output
agent-a11y audit https://example.com --human

# With design system integration for token suggestions
agent-a11y audit https://example.com --design-system /path/to/design-system/

# With source mapping (maps findings to source files)
agent-a11y audit https://localhost:3000 --source-map ./dist/

# Audit with site crawling
agent-a11y audit https://example.com --crawl --depth 2

# Specify WCAG level and version
agent-a11y audit https://example.com --level AA --version 2.2

# Output to file with format (human-readable formats)
agent-a11y audit https://example.com --human -o report.html --format html

# Enable LLM evaluation (reduces false positives)
agent-a11y audit https://example.com --llm-provider anthropic --llm-model claude-sonnet-4-20250514

Agent-Optimized Output: The default output is structured JSON with actionable fix patterns for coding agents. Use --human for human-readable reports.

Validation Loop

Validate that accessibility issues have been fixed:

# Create baseline from first audit
agent-a11y validate https://example.com --save-baseline -o baseline.json

# After coding agent applies fixes, validate
agent-a11y validate https://example.com --baseline baseline.json

# CI mode: fail if regressions introduced
agent-a11y validate https://example.com --baseline baseline.json --fail-on-regression

Go Library

package main

import (
    "context"
    "fmt"
    "log"

    a11y "github.com/plexusone/agent-a11y"
)

func main() {
    // Create auditor
    auditor, err := a11y.New(
        a11y.WithLevel(a11y.LevelAA),
        a11y.WithVersion(a11y.Version22),
    )
    if err != nil {
        log.Fatal(err)
    }
    defer auditor.Close()

    // Audit a page
    result, err := auditor.AuditPage(context.Background(), "https://example.com")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(result.Summary())
    // WCAG 2.2 Level AA: Conformant (Score: 95/100, Issues: 0 critical, 0 serious, 1 moderate, 2 minor)
}

CLI Commands

Command Description
audit <url> Run accessibility audit on a URL
serve Start HTTP API server
mcp serve Start MCP server for AI assistants
compare <before> <after> Compare accessibility between two URLs
demo list List available demo sites
demo run [name] Run demo audit on sample sites
version Show version information

Output Formats

Format Flag Description
JSON --format json Machine-readable JSON output
HTML --format html Interactive HTML report
Markdown --format markdown Markdown report
VPAT --format vpat VPAT 2.4 accessibility conformance report
WCAG-EM --format wcag WCAG-EM evaluation report
OpenACR --format openacr OpenACR machine-readable accessibility report
CSV --format csv CSV export of findings

Configuration

Create a config file at ~/.agent-a11y.yaml or specify with --config:

wcag:
  level: AA
  version: "2.2"

browser:
  headless: true
  timeout: 30s

llm:
  enabled: true
  provider: anthropic
  model: claude-sonnet-4-20250514

crawl:
  depth: 2
  maxPages: 50
  delay: 500ms

LLM Providers

agent-a11y supports multiple LLM providers for AI-assisted evaluation:

Provider Environment Variable
Anthropic ANTHROPIC_API_KEY
OpenAI OPENAI_API_KEY
Google GOOGLE_API_KEY
xAI XAI_API_KEY
Ollama (local, no key required)

MCP Server

Run as an MCP server for integration with AI assistants:

agent-a11y mcp serve

Add to your Claude Desktop config:

{
  "mcpServers": {
    "a11y": {
      "command": "agent-a11y",
      "args": ["mcp", "serve"]
    }
  }
}

HTTP API

Start the API server:

agent-a11y serve --port 8080

Endpoints:

Method Endpoint Description
POST /api/v1/audits Create a new audit job
GET /api/v1/audits List all audit jobs
GET /api/v1/audits/{id} Get audit job status and results
DELETE /api/v1/audits/{id} Cancel an audit job
GET /api/v1/audits/{id}/report Get audit report (JSON or HTML)
GET /api/v1/audits/{id}/openacr Get OpenACR report (YAML or JSON)
GET /api/v1/health Health check

OpenACR API

Get an OpenACR report for a completed audit:

# Get as YAML (default)
curl http://localhost:8080/api/v1/audits/{id}/openacr

# Get as JSON
curl http://localhost:8080/api/v1/audits/{id}/openacr?format=json

# With custom metadata
curl "http://localhost:8080/api/v1/audits/{id}/openacr?product_name=MyApp&product_version=1.0.0&author_email=a11y@example.com"

Multi-Agent Integration

agent-a11y integrates with the multi-agent-spec for use in multi-agent workflows:

result, _ := auditor.AuditPage(ctx, url)

// Convert to AgentResult for multi-agent workflows
agentResult := result.AgentResult()

// Get narrative for reports
narrative := result.Narrative()

Examples

See the examples directory:

  • basic - Simple single-page audit
  • multi-agent - Multi-agent workflow integration

Development

# Run tests
go test -v ./...

# Run linter
golangci-lint run

# Build CLI
go build -o agent-a11y ./cmd/agent-a11y

License

MIT

About

Go accessibility auditing toolkit for WCAG 2.0, 2.1, and 2.2 compliance testing.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages