Skip to content

Documentation Index

spanforge (spanforge) — The reference implementation of the spanforge Standard (RFC-0001), the open event-schema standard for compliance and governance of agentic AI systems.
Current release: 2.0.14Changelog · PyPI

This index links to every documentation page in this folder.


Getting Started

PageDescription
QuickstartCreate your first event, sign a chain, and export — in 5 minutes
InstallationInstall from PyPI, optional extras, and dev setup
Runtime Governance GA GuideThe end-to-end Phase 1–6 control-plane story: GA services, policy actions, replay/simulation, operator workflow, and evidence exports
GA Release NotesThe May 2, 2026 GA scope, what shipped, and what stayed out of scope

User Guide

PageDescription
User GuideOverview of all user guide topics
EventsEvent envelope, event types, serialisation, validation, ULIDs
Tracing APITrace, start_trace(), async context managers, span.add_event(), error categories, timeout deadline
HMAC Signing & Audit ChainsSign events, build tamper-evident chains, detect tampering
PII RedactionSensitivity levels, redaction policies, PII detection
Compliance & Tenant IsolationCompatibility checklist, chain integrity, tenant isolation, ComplianceMappingEngine, evidence packages, regulatory framework mappings (EU AI Act, ISO 42001, NIST AI RMF, GDPR, SOC 2), HMAC-signed attestations, consent/HITL/model-registry/explainability clause integration, model owner & risk-tier enrichment, explanation_coverage_pct metric
Export Backends & EventStreamJSONL, Webhook, OTLP, Datadog, Grafana Loki, Cloud exporters; EventStream; Kafka source
Governance, Consumer Registry & DeprecationsBlock/warn event types, declare schema dependencies, track deprecations
Migration Guidev2 migration roadmap, deprecation records, v1_to_v2() scaffold
Debugging & Visualizationprint_tree(), summary(), visualize(), and sampling controls
Metrics & Analyticsmetrics.aggregate(), MetricsSummary, TraceStore, get_trace()
Semantic CacheSemanticCache, @cached decorator, InMemoryBackend, SQLiteBackend, RedisBackend
Linting & Static Analysisrun_checks(), AO001–AO005 error codes, flake8 plugin, CI integration
Audit Service (sf-audit)sf_audit.append(), schema keys, T.R.U.S.T. scorecard, chain verification, GDPR Article 30, BYOS routing
Alert Routing Service (sf-alert)sf_alert.publish(), topic registry, deduplication, rate limiting, escalation policy, maintenance windows, sinks (Slack, Teams, PagerDuty, OpsGenie, VictorOps, Incident.io, SMS, Webhook)
Gate Pipeline (sf-gate)sf_gate.evaluate(), YAML pipeline runner, 6 gate executors, PRRI gate, trust gate, artifact store, CI/CD integration (Phase 8)
Runtime Governance GA GuideCore GA services, policy actions, operator workflow, replay/simulation, evidence packaging
Runtime Governance ContractsStable GA service contracts, policy actions, evidence contract, and failure/fallback semantics
Replay, Simulation, and CalibrationPhase 3 workflow for replay, candidate simulation, policy comparison, and false-positive review
Evidence Export GuideOperator packages, enterprise packages, JSONL archives, SIEM export, and OpenInference bridge
Enterprise IntegrationsOpenAI, Anthropic, Azure OpenAI, LangChain, LangGraph, OTLP, JSONL, SIEM, and OpenInference coverage
Runtime Governance ComparisonPositioning and comparison for the runtime-governance control-plane story
RAG Tracingsf_rag.trace_query(), retrieval scoring, grounding, session lifecycle, privacy controls (Phase 13)
User Feedbacksf_feedback.submit(), rating enums (NPS/CSAT/thumbs), T.R.U.S.T. integration (Phase 13)
SSO & IdentitySFIdentityClient — SAML 2.0, SCIM 2.0, OIDC PKCE, SSO session delegation, session revocation (Phase 13 / v2.0.14)

API Reference

PageModule
API ReferenceModule summary and full listing
eventspanforge.event — Event envelope and serialisation
typesspanforge.types — EventType enum, custom type validation
signingspanforge.signing — HMAC signing and AuditStream
redactspanforge.redact — Redactable, RedactionPolicy, PII helpers
compliancespanforge.compliance — Compatibility and isolation checks
exportspanforge.export — OTLP, Webhook, JSONL, Datadog, Grafana Loki, Cloud backends
streamspanforge.stream — EventStream multiplexer with Kafka support
validatespanforge.validate — JSON Schema validation
migratespanforge.migrate — Migration scaffold, SunsetPolicy, v2_migration_roadmap()
consumerspanforge.consumer — ConsumerRegistry, IncompatibleSchemaError
governancespanforge.governance — EventGovernancePolicy, GovernanceViolationError
deprecationsspanforge.deprecations — DeprecationRegistry, warn_if_deprecated()
integrationsspanforge.integrations — LangChain, LlamaIndex, OpenAI, CrewAI adapters
tracespanforge._traceTrace class and start_trace()
debugspanforge.debugprint_tree(), summary(), visualize()
metricsspanforge.metricsaggregate(), MetricsSummary, LatencyStats
storespanforge._storeTraceStore and MCP trace access functions
hooksspanforge._hooksHookRegistry, hooks singleton, sync and async lifecycle hooks
testingspanforge.testingMockExporter, capture_events(), assert_event_schema_valid(), trace_store()
autospanforge.autosetup() / teardown() integration auto-discovery
ulidspanforge.ulid — ULID generation and helpers
exceptionsspanforge.exceptions — Exception hierarchy
modelsspanforge.models — Pydantic v2 model layer
cachespanforge.cacheSemanticCache, @cached, backends, CacheEntry, CacheBackendError
lintspanforge.lintrun_checks(), LintError, AO001–AO005, flake8 plugin, CLI
httpspanforge.http — HTTP trace viewer and /traces endpoint
iospanforge.io — Event I/O helpers (read/write JSONL)
pluginsspanforge.plugins — Plugin discovery and loading
schemaspanforge.schema — Schema utilities and version helpers
regressionspanforge.regression — Regression detection and alerting
statsspanforge.stats — Statistical helpers and summary functions
evalspanforge.eval — Evaluation scorers and dataset management
consentspanforge.consent — Consent tracking and data-subject management
hitlspanforge.hitl — Human-in-the-loop review queues
model_registryspanforge.model_registry — Model registration, risk tiers, ownership
explainspanforge.explain — Explainability records and coverage metrics
presidio_backendspanforge.presidio_backend — Presidio-based PII detection backend
costspanforge.cost — Cost tracking and budget management
identityspanforge.sdk.identitySFIdentityClient, API keys, sessions, TOTP, magic links, SAML 2.0 ACS, SCIM 2.0 User/Group CRUD, OIDC PKCE relying party, SSO session delegation
secretsspanforge.secretsSecretsScanner, SecretsScanResult, SecretHit, 20-pattern registry, SARIF output
piispanforge.sdk.piiSFPIIClient, PII scanning, anonymisation, GDPR Art.17 erasure, CCPA DSAR, HIPAA safe harbor, DPDP consent gate, PIPL entity types (Phase 3)
auditspanforge.sdk.auditSFAuditClient, HMAC chain, schema key registry, T.R.U.S.T. scorecard, Article 30, BYOS routing (Phase 4)
cecspanforge.sdk.cecSFCECClient, signed ZIP compliance bundles, 5-framework clause mapping, verify_bundle(), generate_dpa(), get_bundle(), reissue_download_url(), HMAC signing, BYOS detection (Phase 5)
observespanforge.sdk.observeSFObserveClient, span export (OTLP/Datadog/Grafana/Splunk/Elastic/local), emit_span(), annotation store, W3C TraceContext, OTel GenAI attrs, sampling strategies, health probes (Phase 6)
alertspanforge.sdk.alertSFAlertClient, topic-based publish, deduplication, rate limiting, escalation policy, maintenance windows, circuit breakers, 6 sink integrations (Phase 7)
gatespanforge.sdk.gateSFGateClient, GateRunner YAML engine, 6 gate executors, PRRI evaluation, trust gate, GateArtifact store (Phase 8)
explainspanforge.sdk.explainSFExplainClient, runtime explanation records
policyspanforge.sdk.policy — runtime policy bundles, decisions, replay, simulation, review
scopespanforge.sdk.scopeSFScopeClient, capability enforcement
rbacspanforge.sdk.rbacSFRBACClient, role enforcement
lineagespanforge.sdk.lineageSFLineageClient, provenance capture
operatorspanforge.sdk.operatorSFOperatorClient, operator inspect/export workflow
configspanforge.sdk.config.halluccheck.toml parser, SFConfigBlock, SFServiceToggles, SFLocalFallbackConfig, load_config_file(), validate_config(), validate_config_strict() (Phase 9)
registryspanforge.sdk.registryServiceRegistry singleton, health checks, background checker, status_response(), ServiceHealth, ServiceStatus (Phase 9)
fallbackspanforge.sdk.fallback — 8 local fallback implementations: pii_fallback(), secrets_fallback(), audit_fallback(), observe_fallback(), alert_fallback(), identity_fallback(), gate_fallback(), cec_fallback() (Phase 9)
trustspanforge.sdk.trustSFTrustClient, T.R.U.S.T. five-pillar scorecard, SVG badge, history time-series, configurable weights (Phase 10)
pipelinesspanforge.sdk.pipelines — 5 HallucCheck pipeline integrations (Phase 10)
enterprisespanforge.sdk.enterpriseSFEnterpriseClient, multi-tenancy, encryption, air-gap, health probes (Phase 11)
securityspanforge.sdk.securitySFSecurityClient, OWASP audit, STRIDE threat model, dependency scanning, secrets-in-logs (Phase 11)
testing_mocksspanforge.testing_mocks — 11 mock service clients, mock_all_services() context manager, _MockBase call recording (Phase 12)
sdk-referenceSDK reference overview — all 11 service clients, configuration, testing, CLI quick reference (Phase 12)
ragspanforge.sdk.ragSFRAGClient, session lifecycle, retrieval/generation tracing (Phase 13)
feedbackspanforge.sdk.feedbackSFFeedbackClient, rating enums, NPS/CSAT/thumbs, T.R.U.S.T. linking (Phase 13)
identityspanforge.sdk.identitySFIdentityClient, SAML 2.0, SCIM 2.0, OIDC PKCE, SSO session delegation/revocation, SCIMUser, SCIMGroup, OIDCAuthRequest, SSOSession (Phase 13 / v2.0.14)

Namespace Payload Catalogue

PageNamespacePurpose
Namespace indexOverview and quick-reference table
tracellm.trace.*Model inputs, outputs, latency, token counts
costllm.cost.*Per-event cost estimates and budget tracking
cachellm.cache.*Cache hit/miss, key, TTL, backend metadata
diffllm.diff.*Prompt/response delta between two events
evalllm.eval.*Scoring, grading, and human-feedback payloads
fencellm.fence.*Perimeter checks, topic constraints, allow/block lists
guardllm.guard.*Safety classifier outputs and block decisions
promptllm.prompt.*Prompt versioning, template rendering, variable sets
redact_nsllm.redact.*PII detection and redaction audit records
templatellm.template.*Template registry metadata and render snapshots
auditllm.audit.*HMAC audit chain events
retrievalllm.retrieval.*RAG query, chunk, generation, and session payloads
feedbackllm.feedback.*User feedback rating payloads and summaries

Command-Line Interface

PageDescription
CLIspanforge command reference: check, check-compat, validate, audit-chain, audit, scan, migrate, inspect, stats, list-deprecated, migration-roadmap, check-consumers, compliance, cost, dev, module, serve, init, quickstart, report, eval, migrate-langsmith, ui, consent, hitl, model, explain, secrets, gate, config, trust, enterprise, security, doctor

Demos

PageDescription
Runtime Governance DemoTrace-to-operator-package walkthrough using the GA runtime-governance services
Enterprise Evidence DemoEnterprise deployment and evidence-packaging walkthrough

Deployment Architecture

PageDescription
Reference ArchitecturesSelf-hosted, Kubernetes, and air-gapped deployment references used by enterprise evidence packages
Air-Gapped DeploymentNo-egress deployment guidance
Kubernetes DeploymentSelf-hosted Kubernetes and Helm deployment guidance

Development

PageDescription
ContributingDev setup, code standards, PR checklist
ChangelogVersion history and release notes