AegisSOC includes a layered testing strategy designed to validate:
- Multi-agent wiring
- Session and state persistence
- Structured observability
- Guardrail behavior (mock + real LLM)
- Scenario-driven evaluation
All tests use Python pytest and are compatible with ADK 1.18.0.
AegisSOC includes four major categories of tests:
Validates:
- InMemorySessionService
- Stateful agent execution
- Multi-turn interactions
File: tests/test_phase3_sessions.py
Run:
python -m pytest tests/test_phase3_sessions.py -qValidates:
- StructuredEvent model
- State["events"] correctness
- Logging of tool calls, agent outputs, guardrail responses
File: tests/test_phase5_observability.py
Run:
python -m pytest tests/test_phase5_observability.py -qValidates:
- System behavior against benign, suspicious, malicious, ambiguous, and prompt-injection scenarios
- Use of observability for verifying output
File: tests/test_phase6_evaluation.py
Run:
python -m pytest tests/test_phase6_evaluation.py -qNote:
If the LLM produces no final action in a scenario, the test may be skipped or marked xfail. This is documented and expected due to LLM variance.
Validates the actual guardrail microservice with real reasoning:
- Action Normalization
- Fake Execution Detection
- Prompt Injection Detection
File: tests/test_guardrail_logic.py
Prerequisite: Ensure guardrail microservice is running first:
python -m guardrail_agent.appRun:
python -m pytest tests/test_guardrail_logic.py -qThese tests hit the Guardrail Agent (A2A microservice) at localhost:8001.
Due to a known asyncio / httpx event loop cleanup issue in:
- Windows
- Python 3.13
- pytest-asyncio
…it is recommended to run tests individually:
python -m pytest tests/test_phase3_sessions.py -q
python -m pytest tests/test_phase5_observability.py -q
python -m pytest tests/test_phase6_evaluation.py -q
python -m pytest tests/test_guardrail_logic.py -qFor convenience:
python run_tests.pyThis script:
- Runs pytest programmatically
- Captures output to
test_result.txt - Improves reliability on Windows
| Phase | File | Expected Result |
|---|---|---|
| Phase 3 | test_phase3_sessions.py | 1 PASSED |
| Phase 5 | test_phase5_observability.py | 1 PASSED |
| Phase 6 | test_phase6_evaluation.py | PASS / SKIP (depending on LLM output) |
| Phase 6.5 | test_guardrail_logic.py | 3 PASSED individually |
Event loop closed:
RuntimeError: Event loop is closed
- Harmless
- Related to async teardown
- Run tests individually
Guardrail not reachable:
Ensure guardrail microservice is running:
python -m guardrail_agent.appInvalid / missing API key:
Check .env:
GOOGLE_API_KEY=your_api_key_hereAegisSOC's testing framework covers:
- structural correctness
- safety boundaries
- LLM normalization behavior
- injection detection
- system-wide evaluation
This layered strategy is aligned with best practices in AI security engineering.