Skip to main content

ASPICE Knowledge Base & Agent Workflow evaluation tool for SDP gap analysis

Project description

aspice-eval

ASPICE evaluation engine — knowledge base, gap analysis evaluator, and reports.

Library Usage

Evaluate an SDP

from aspice_eval import evaluate_sdp, ModelConfig

result = evaluate_sdp(
    "docs/sdp.md",
    ModelConfig(
        provider="bedrock",
        model_name="us.anthropic.claude-sonnet-4-20250514-v1:0",
        region="us-east-1",
    ),
    target_level=3,
    process_groups=["SWE", "SYS"],
)

print(f"Criteria assessed: {len(result.ratings)}")
print(f"Gaps found: {len([r for r in result.ratings if r.gaps])}")
print(f"Tokens used: {result.token_usage['total_tokens']}")

Validate a Knowledge Base

from aspice_eval import validate_kb

result = validate_kb("knowledge_base")

if not result.is_valid:
    for error in result.schema_errors:
        print(f"Schema error: {error}")
    for gap in result.completeness_gaps:
        print(f"Completeness gap: {gap}")
else:
    print("Knowledge base is valid")

Extension Points

Custom Evaluator

Subclass GapAnalysisEvaluator to plug in a custom LLM provider or rule-based engine:

from aspice_eval import GapAnalysisEvaluator, ModelConfig, register_evaluator

class LocalLlamaEvaluator(GapAnalysisEvaluator):
    """Evaluator using a local Llama model."""

    def _call_model(self, prompt: str) -> str:
        # Call your local model and return JSON response
        ...

# Register the custom provider
register_evaluator("local-llama", LocalLlamaEvaluator)

# Use it via the standard factory
from aspice_eval import create_evaluator

evaluator = create_evaluator(ModelConfig(provider="local-llama"))

Custom Knowledge Base Standards

Three levels of extensibility for non-ASPICE standards:

Level 1 — Custom YAML files (no code required):

Drop a new subdirectory under the KB root with YAML files conforming to the criteria schema:

knowledge_base/
├── aspice/          # Built-in ASPICE v4.0
└── iso26262/        # Your custom standard
    ├── _metadata.yaml
    └── functional_safety.yaml
from aspice_eval import evaluate_sdp, ModelConfig

result = evaluate_sdp(
    "docs/sdp.md",
    ModelConfig(provider="bedrock", model_name="...", region="us-east-1"),
    standard="iso26262",
)

Level 2 — In-memory construction via from_dict:

from aspice_eval import KnowledgeBase

kb = KnowledgeBase.from_dict({
    "processes": [
        {
            "process_id": "SWE.1",
            "process_name": "Software Requirements Analysis",
            "criteria": [...],
        }
    ]
})
criteria = kb.get_criteria(groups=["SWE"], max_level=3)

Level 3 — Custom KB loader (pluggable schema):

For standards with fundamentally different structures, subclass KnowledgeBase and register a loader:

from aspice_eval import KnowledgeBase, register_kb_loader, CriteriaEntry

class NISTCSFKnowledgeBase(KnowledgeBase):
    """Custom loader for NIST Cybersecurity Framework."""

    def load(self, standard: str) -> None:
        # Read NIST-shaped YAML/JSON, convert to CriteriaEntry list
        ...

    def get_criteria(self, groups, max_level) -> list[CriteriaEntry]:
        # Return entries filtered by NIST "Functions" instead of ASPICE groups
        ...

register_kb_loader("nist-csf", NISTCSFKnowledgeBase)

Custom Report Renderer

Subclass ReportRenderer to output evaluation results in formats beyond Markdown and HTML:

from aspice_eval import ReportRenderer, register_renderer
from aspice_eval import EvaluationResult, CapabilityLevelResult, EvaluationConfig

class JSONReportRenderer(ReportRenderer):
    """Render evaluation results as JSON."""

    def render(self, evaluation, levels, config, kb_metadata) -> str:
        import json
        return json.dumps({
            "ratings": [
                {"criteria_id": r.criteria_id, "rating": r.rating, "gaps": r.gaps}
                for r in evaluation.ratings
            ],
        }, indent=2)

# Register and use
register_renderer("json", JSONReportRenderer)

CLI Usage

aspice-eval evaluate

# Evaluate an SDP document
aspice-eval evaluate --sdp path/to/sdp.md --target-level 2 --groups SWE,MAN

# Write report to a file
aspice-eval evaluate --sdp path/to/sdp.md --output report.md

# Use a specific AI provider
aspice-eval evaluate --sdp path/to/sdp.md --provider bedrock \
  --model us.anthropic.claude-sonnet-4-20250514-v1:0 --region us-east-1

aspice-eval validate-kb

# Validate the default knowledge base
aspice-eval validate-kb

# Validate a custom knowledge base
aspice-eval validate-kb --kb-path /path/to/knowledge_base

Installation

pip install aspice-eval

# With AI provider support
pip install "aspice-eval[bedrock]"     # Amazon Bedrock (Claude)
pip install "aspice-eval[openai]"      # OpenAI GPT-4o
pip install "aspice-eval[anthropic]"   # Anthropic Claude (direct API)
pip install "aspice-eval[all]"         # All providers

Requires Python 3.10+.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspice_eval-0.2.0.tar.gz (88.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspice_eval-0.2.0-py3-none-any.whl (71.6 kB view details)

Uploaded Python 3

File details

Details for the file aspice_eval-0.2.0.tar.gz.

File metadata

  • Download URL: aspice_eval-0.2.0.tar.gz
  • Upload date:
  • Size: 88.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aspice_eval-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a84fdd9d631152748b2259347001236db6e024c0d177acefe71381dd26f2020c
MD5 43737b5c721bb2cc7e2e1a20a1bba788
BLAKE2b-256 804f5e011c8df4bf4ae73428a7ed8dae650b326f92874039044cbb3e7297b1cd

See more details on using hashes here.

File details

Details for the file aspice_eval-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aspice_eval-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 71.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aspice_eval-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f4e334a6f333c8feea4d0e82402096ac3139c63b1da54a9cfed30eddeda69b4
MD5 609559e001c0d1107fe9fbff1c6d90ed
BLAKE2b-256 cb51f6154a7c65e952873726fd3d0b31a4e7cb8f5c19d6ecfc003d6dc16f294a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page