Skip to content

SoftwareDevLabs/requirementAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

requirementAgent β€” Multi-Domain Requirements Engineering Agent

Production-ready autonomous AI agent for safety-critical requirements engineering across automotive, defence, medtech, and railways domains.


🎯 Overview

requirementAgent is a LangGraph-based multi-agent system that automates the complete requirements engineering lifecycle for mission-critical software systems. It provides mathematically rigorous verification, automated safety analysis, and full bidirectional traceability β€” all while supporting both local (Ollama, LM Studio) and cloud (NVIDIA NIM, OpenRouter, Anthropic, OpenAI, Cerebras, Groq, Gemini, Azure OpenAI, AWS Bedrock) LLM providers.

Key Capabilities

Capability Description
EARS Parsing Syntactic validation, auto-rewrite, and ambiguity detection per Easy Approach to Requirements Syntax
Formal Verification EARS β†’ LTL/CTL β†’ SMT-LIB v2 β†’ Z3 SMT solver for contradiction detection and edge-case synthesis
Safety Analysis Automated Functional Hazard Assessment (FHA) per ISO 26262, IEC 62304, EN 50128, DO-178C
Threat Modeling STRIDE analysis + MITRE ATT&CK mapping + security controls verification
Traceability Bidirectional SYS.2 ↔ SWE.1 ↔ SWE.2 ↔ SWE.3 ↔ Code ↔ Tests matrices
Multi-Provider LLM 12+ providers with intelligent routing, circuit breakers, and cost control
Four-Tier Memory Working, Episodic, Semantic (vector+graph), Procedural (CoALA architecture)
Observability Full Langfuse tracing, evaluation datasets, cost tracking, PII masking
Interoperability A2A, AGNTCY ACP, OASF schema, OpenWiki documentation
Compliance EU AI Act (high-risk), EU CRA (Class II), GDPR, ASPICE v4.0

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           requirementAgent                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚ Ingest   β”‚β†’ β”‚ EARS     β”‚β†’ β”‚ Formal   β”‚β†’ β”‚ Safety/  β”‚β†’ β”‚ Trace    β”‚       β”‚
β”‚  β”‚ Node     β”‚  β”‚ Parser   β”‚  β”‚ Verify   β”‚  β”‚ Security β”‚  β”‚ Compiler β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚       β”‚           β”‚            β”‚            β”‚            β”‚                  β”‚
β”‚       β–Ό           β–Ό            β–Ό            β–Ό            β–Ό                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                    LangGraph Orchestrator                             β”‚   β”‚
β”‚  β”‚  β€’ State management  β€’ HITL gates  β€’ Checkpointing  β€’ Retry logic    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                    β”‚                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  LLM Router (12 providers)         β”‚  Memory Manager (4 tiers)             β”‚
β”‚  β€’ OpenAI, Anthropic, Groq         β”‚  β€’ Working (in-context)              β”‚
β”‚  β€’ NVIDIA NIM, Cerebras, Groq      β”‚  β€’ Episodic (vector + time-series)   β”‚
β”‚  β€’ Gemini, Azure OpenAI, Bedrock   β”‚  β€’ Semantic (vector + knowledge graph)β”‚
β”‚  β€’ Ollama, LM Studio (local)       β”‚  β€’ Procedural (skills + heuristics)  β”‚
β”‚                                    β”‚                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Observability                     β”‚  Interoperability                     β”‚
β”‚  β€’ Langfuse (traces, evals, cost)  β”‚  β€’ A2A (Agent2Agent)                 β”‚
β”‚  β€’ OTel export for AGNTCY          β”‚  β€’ ACP (Agent Connect Protocol)      β”‚
β”‚  β€’ PII masking                     β”‚  β€’ OASF (Open Agentic Schema)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Supported Domains & Standards

Domain Safety Standard Security Standard Quality Standard Criticality Levels
Automotive ISO 26262 ISO 21434 ASPICE v4.0 QM, ASIL-A–D
Defence/Aerospace DO-178C, MIL-STD-882E NIST SP 800-53, CNSSI 1253 IEEE 29148 DAL A–E
Medtech IEC 62304 FDA Cybersecurity Guidance ISO 13485 Class A–C
Railways EN 50128/50657 CLC/TS 50701 CENELEC SIL 0–4

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Z3 SMT solver (pip install z3-solver)
  • (Optional) Local LLM: Ollama or LM Studio

Installation

# Clone and install
git clone https://github.com/SoftwareDevLabs/requirementAgent.git
cd requirementAgent
pip install -r requirements.txt

# Install Z3 for formal verification
pip install z3-solver

# Configure environment
cp .env.template .env
# Edit .env with your API keys

Configuration

# config.yml - Key sections
agent:
  name: "requirementAgent"
  version: "1.0.0"
  role: ["provider"]  # EU AI Act role

llm:
  router:
    default_provider: "openrouter"
    task_routing:
      formal_verification: "anthropic:claude-3.5-sonnet"
      ears_parsing: "openrouter:google/gemini-flash-1.5"
      safety_analysis: "openai:gpt-4o"
    fallback_chain: ["openrouter", "anthropic", "openai", "groq", "ollama"]
    cost_budget_usd_per_day: 50.0

memory:
  episodic:
    backend: "postgres-pgvector"
    retention_days: 90
  semantic:
    backend: "mem0"
    graph_backend: "neo4j"

protocols:
  a2a:
    enabled: true
    signed: true
  acp:
    enabled: true

Running

# Start the agent server
python -m src.agents.requirement_agent

# Or run a quick validation
python examples/automotive_braking_example.py

πŸ’» Usage Examples

Basic Requirements Validation

import asyncio
from src.agents.requirement_agent import create_requirement_agent

async def main():
    agent = create_requirement_agent({
        "domain": "automotive",
        "config": {"llm": {"router": {"default_provider": "openrouter"}}}
    })
    
    requirements = [
        {"id": "REQ-001", "text": "The braking system shall apply brakes within 100 milliseconds"},
        {"id": "REQ-002", "text": "When obstacle detected, the collision avoidance system shall initiate emergency braking"},
        {"id": "REQ-003", "text": "While vehicle speed > 10 km/h, the door control shall lock all doors"},
    ]
    
    result = await agent.run(requirements, domain="automotive")
    
    # Access compliance package
    pkg = result["compliance_package"]
    print(f"EARS Compliance: {pkg['compliance_evidence']['ears_compliance_rate']:.1%}")
    print(f"Formal Consistency: {pkg['formal_verification']['is_consistent']}")
    print(f"Hazards Found: {pkg['compliance_evidence']['hazards_identified']}")
    print(f"Threats Found: {pkg['compliance_evidence']['threats_identified']}")

asyncio.run(main())

Streaming with Progress Updates

async for chunk in agent.run_streaming(requirements, domain="medtech"):
    if "current_phase" in chunk:
        print(f"Phase: {chunk['current_phase']}")
    if "compliance_package" in chunk:
        print("βœ… Complete!")

Formal Verification Only

from src.pipeline.formal_verifier import create_formal_verifier
from src.pipeline.ears_parser import create_ears_parser

ears = create_ears_parser()
verifier = create_formal_verifier({"timeout_ms": 30000})

# Parse and verify
reqs = [ears.parse("The valve shall remain closed when pressure high")]
validated = [ears.validate(r) for r in reqs]
result = verifier.verify_requirements(validated)

if result.is_consistent:
    print("βœ… No contradictions found")
else:
    print(f"❌ Contradiction: {result.unsat_core}")
    print(f"Counterexample: {result.model}")

Safety & Security Audit

from src.pipeline.safety_auditor import create_fh_analyzer, create_threat_analyzer

fha = create_fh_analyzer("automotive")
threat = create_threat_analyzer("automotive")

fha_result = fha.analyze(validated_reqs)
threat_result = threat.analyze(validated_reqs)

print(f"Hazards: {len(fha_result.hazards)}")
print(f"Threats: {len(threat_result.threats)}")
print(f"MITRE Techniques: {list(threat_result.mitre_mapping.keys())}")

πŸ“ Repository Structure

requirementAgent/
β”œβ”€β”€ config.yml                 # Main configuration
β”œβ”€β”€ .env.template              # Environment template
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ setup.py                   # Package setup
β”œβ”€β”€ SPEC.md                    # Technical specification
β”œβ”€β”€ CHANGELOG.md               # Version history
β”œβ”€β”€ README.md                  # This file
β”œβ”€β”€ docs/                      # Documentation
β”‚   β”œβ”€β”€ architecture.md
β”‚   β”œβ”€β”€ configuration.md
β”‚   β”œβ”€β”€ deployment.md
β”‚   └── extension.md
β”œβ”€β”€ memory/                    # Domain knowledge bases
β”‚   β”œβ”€β”€ automotive/
β”‚   β”œβ”€β”€ defence/
β”‚   β”œβ”€β”€ medtech/
β”‚   └── railways/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   └── requirement_agent.py    # LangGraph orchestrator
β”‚   β”œβ”€β”€ llm/
β”‚   β”‚   β”œβ”€β”€ schemas.py              # Message/Tool/Completion types
β”‚   β”‚   β”œβ”€β”€ router.py               # Intelligent provider routing
β”‚   β”‚   └── providers/              # 12 provider implementations
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   β”œβ”€β”€ __init__.py             # 4-tier memory manager
β”‚   β”‚   β”œβ”€β”€ working.py              # In-context working memory
β”‚   β”‚   β”œβ”€β”€ episodic.py             # Vector + time-series
β”‚   β”‚   β”œβ”€β”€ semantic.py             # Vector + knowledge graph
β”‚   β”‚   └── procedural.py           # Skills + heuristics
β”‚   β”œβ”€β”€ pipeline/
β”‚   β”‚   β”œβ”€β”€ ears_parser.py          # EARS syntactic validator
β”‚   β”‚   β”œβ”€β”€ formal_verifier.py      # LTLβ†’Z3 verification
β”‚   β”‚   β”œβ”€β”€ safety_auditor.py       # FHA + STRIDE + MITRE
β”‚   β”‚   └── trace_compiler.py       # Bidirectional traceability
β”‚   β”œβ”€β”€ protocols/
β”‚   β”‚   └── a2a_acp.py              # A2A/ACP/OASF interfaces
β”‚   └── observability/
β”‚       └── langfuse.py             # Tracing, evals, cost tracking
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/
β”‚   β”‚   └── pipeline/               # EARS, formal, safety tests
β”‚   β”œβ”€β”€ integration/
β”‚   β”‚   └── test_full_pipeline.py   # End-to-end tests
β”‚   └── smoke/                      # Quick health checks
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ automotive_braking_example.py
β”‚   β”œβ”€β”€ medtech_infusion_pump.py
β”‚   β”œβ”€β”€ railways_signaling.py
β”‚   └── defence_flight_control.py
└── .github/workflows/              # CI/CD pipelines

πŸ§ͺ Testing

# Run all tests
pytest

# Unit tests only
pytest tests/unit/

# Integration tests
pytest tests/integration/

# Smoke tests
pytest tests/smoke/

# With coverage
pytest --cov=src --cov-report=html

# Specific test file
pytest tests/unit/pipeline/test_ears_parser.py -v

Test Coverage Targets

Layer Target
Unit β‰₯ 85%
Integration β‰₯ 70%
E2E β‰₯ 60%

πŸ”§ Configuration Reference

LLM Provider Setup

Provider Env Var Base URL Models
OpenAI OPENAI_API_KEY https://api.openai.com/v1 gpt-4o, gpt-4o-mini, o1
Anthropic ANTHROPIC_API_KEY https://api.anthropic.com claude-3.5-sonnet, haiku, opus
OpenRouter OPENROUTER_API_KEY https://openrouter.ai/api/v1 300+ models
NVIDIA NIM NVIDIA_NIM_API_KEY https://integrate.api.nvidia.com/v1 Nemotron, Llama
Cerebras CEREBRAS_API_KEY https://api.cerebras.ai/v1 Llama 3.1 70B/405B
Groq GROQ_API_KEY https://api.groq.com/openai/v1 Llama, Mixtral, Gemma
Gemini GEMINI_API_KEY https://generativelanguage.googleapis.com 1.5 Pro/Flash
Azure OpenAI AZURE_OPENAI_API_KEY https://{resource}.openai.azure.com GPT-4o, GPT-4o-mini
AWS Bedrock AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY Regional Claude, Llama, Nova
Ollama OLLAMA_BASE_URL (default: http://localhost:11434/v1) Local Any GGUF
LM Studio LM_STUDIO_BASE_URL (default: http://localhost:1234/v1) Local Any GGUF

πŸ“¦ Deployment

Docker

# Dockerfile included
docker build -t requirementagent .
docker run -p 8000:8000 --env-file .env requirementagent

Kubernetes

# k8s/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: requirementagent
spec:
  replicas: 3
  template:
    spec:
      containers:
      - name: requirementagent
        image: requirementagent:latest
        envFrom:
        - secretRef:
            name: requirementagent-secrets

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests
  4. Run full test suite (pytest)
  5. Submit PR with description

Code Standards

  • Type hints required for all public APIs
  • Docstrings in Google style
  • Line length ≀ 100 chars
  • Imports sorted: stdlib β†’ third-party β†’ local
  • Tests required for new functionality

πŸ“„ License

Apache 2.0 β€” See LICENSE.md


πŸ™ Acknowledgments

  • Z3 Theorem Prover (Microsoft Research) β€” Formal verification backbone
  • LangGraph (LangChain) β€” Workflow orchestration
  • Langfuse β€” Observability platform
  • EARS (Alistair Mavin) β€” Requirements syntax standard
  • CoALA (Sumers et al., Princeton) β€” Four-tier memory architecture
  • A2A/ACP/OASF (Linux Foundation/AGNTCY) β€” Interoperability protocols

πŸ“ž Support


Built with ❀️ by SoftwareDevLabs for the safety-critical engineering community.

About

This is agent designed to help manage requirements within software development lifecycle for mission critical software development.

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors