Skip to main content

API Reference

Public classes and functions exported by CFA v1.0.0.

cfa.core.kernel

NameDescription
KernelOrchestratorFull 5-phase governed execution flow
KernelOrchestrator.process(intent)KernelResultExecute the full pipeline
KernelConfigConfiguration: policy_bundle_version, backend, strict_normalization, enable_* flags

cfa.policy.engine

NameDescription
PolicyEngineEvaluates StateSignature against declarative rules
PolicyEngine.evaluate(signature)PolicyResultRun policy evaluation
PolicyEngine.from_bundle(path)PolicyEngineLoad engine from a YAML policy bundle
PolicyRuleIndividual rule: condition + action + fault_code

cfa.policy.bundle

NameDescription
PolicyBundleLoadable YAML/JSON policy bundle
PolicyBundle.from_yaml(path)PolicyBundleLoad from YAML
PolicyBundle.ruleslist[PolicyRule] — parsed rules

cfa.types

NameDescription
StateSignatureImmutable typed execution contract
StateSignature.from_dict(d)Construct from dictionary
StateSignature.to_dict()Serialize to dictionary
PolicyResultResult of policy evaluation
KernelResultComplete pipeline result
FaultGoverned failure event
DatasetRefDataset reference with governance metadata
TargetLayerEnum: BRONZE, SILVER, GOLD
DatasetClassificationEnum: PUBLIC, INTERNAL, SENSITIVE, HIGH_VOLUME

cfa.validation.static

NameDescription
StaticValidatorAnalyzes generated code before execution
StaticValidator.validate(code, sig, backend)StaticValidationResultRun static validation
ForbiddenTokenPattern that must not appear in generated code

cfa.validation.signature

NameDescription
validate_signature_data(data)SignatureValidationResultStructural validation of StateSignature
unwrap_signature_data(data)dictAccept {"signature": ...} wrappers

cfa.validation.runtime

NameDescription
RuntimeValidatorValidates execution metrics at runtime
RuntimeThresholdsConfigurable thresholds: max_cost, max_shuffle_mb, max_null_ratio

cfa.normalizer.base

NameDescription
IntentNormalizerResolves NL intent into StateSignature
RuleBasedNormalizerBackendDeterministic catalog-grounded backend
MockNormalizerBackendTest-only deterministic backend
ConfirmationOrchestratorRisk-based confirmation escalation

cfa.normalizer.llm

NameDescription
LLMNormalizerBackendLLM-powered normalization with strict mode
OpenAILMProviderOpenAI-compatible provider

cfa.audit.trail

NameDescription
AuditTrailAppend-only hash-chained event store
AuditTrail.record(...)AuditEventRecord an event
AuditTrail.verify_chain()boolVerify SHA-256 hash chain integrity
JsonLinesAuditStorageJSONL file backend

cfa.audit.context

NameDescription
ContextRegistryLive model of environment state
ContextRegistry.get_environment_state()dictCurrent state snapshot

cfa.storage

NameDescription
SqliteStorage(db_path)Unified SQLite storage for all CFA data
SqliteStorage.ensure_schema()Auto-create migrated schema
SqliteStorage.audit_append(event)Record audit event
SqliteStorage.execution_append(dict)Record execution for lifecycle
SqliteStorage.skill_upsert(hash, data)Persist skill state

cfa.observability.promotion

NameDescription
PromotionEngineLifecycle management via IFo/IFs/IFg/IDI
PromotionEngine.record_execution(record)Record execution for scoring
PromotionEngine.evaluate(hash)(SkillRecord, IndexScores)Evaluate a skill
PromotionPolicyThresholds: min_executions, ifo_threshold, ifs_threshold

cfa.observability.indices

NameDescription
IndexCalculatorComputes IFo, IFs, IFg, IDI from records
IndexScoresifo, ifs, ifg, idi + promotion_eligible, drift_detected
ExecutionRecordSingle execution data point

cfa.backends

NameDescription
BackendRegistry.singleton()Global registry (pyspark, sql, dbt)
BackendRegistry.list()list[str]List registered backends
BackendRegistry.register(name, factory)Register a new backend
BackendAdapterAbstract base for codegen backends
BackendCapabilitiesFlags + forbidden_tokens

cfa.sandbox

NameDescription
SandboxRegistry.singleton()Global registry (mock, panic)
SandboxBackendPluggable execution backend
MockSandboxBackendDeterministic test simulation
SandboxExecutorOrchestrates plan execution

cfa.runtime

NameDescription
RuntimeGateProduction governance gate
GateConfigConfiguration: policy_bundle, sandbox, execute
RuntimeGate.validate(intent)GateResultPre-execution validation

cfa.testing

NameDescription
evaluate(intent, ...)EvaluationResultConvenience wrapper for testing
assert_passed(result)Assert evaluation passed
assert_blocked(result)Assert evaluation blocked

cfa.core.conditions

NameDescription
build_condition(name)CallableBuild a named condition
register_condition(name, factory)Register a custom condition
list_conditions()list[str]List registered conditions

cfa.core.codegen

NameDescription
CodeGenBackendAbstract base for code generation
GeneratedCodeCode artifact: language, code, metadata

cfa.config

NameDescription
CfaConfig.from_yaml(path)CfaConfigLoad configuration
CfaConfig.discover() → `CfaConfigNone`