Runtime Models API
Status: Generated from current Python docstrings and type hints.
Runtime objects backing the authoring DSL. These are the in-memory objects that the compiler reads before lowering to Gaia IR.
gaia.engine.lang.runtime
Runtime dataclasses and helpers backing the Gaia Lang DSL.
Associate
dataclass
Associate(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), helper: Claim | None = None, a: Claim | None = None, b: Claim | None = None, p_a_given_b: float = 0.5, p_b_given_a: float = 0.5, pattern: str | None = None)
CandidateRelation
dataclass
CandidateRelation(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), claims: tuple[Claim, ...] = (), pattern: str | None = None, status: str = 'hypothesis')
Bases: Scaffold
Marks a hypothesized relation that has not been formalized yet.
a
property
a: Claim | None
Compatibility view for older binary callers.
b
property
b: Claim | None
Compatibility view for older binary callers.
proposed
property
proposed: str | None
Compatibility view for older proposed-pattern callers.
Compose
dataclass
Compose(name: str = '', version: str = '', inputs: tuple[Knowledge | str, ...] = (), actions: tuple[Action | str, ...] = (), conclusion: Claim | None = None)
Bases: Action
Action-level composition of child actions into a reviewable DAG.
structure_hash
structure_hash(input_refs: list[str], action_refs: list[str], conclusion_ref: str, warrant_refs: list[str], background_refs: list[str] | None = None) -> str
Hash the canonical compose payload used for the IR compose ID.
Source code in gaia/engine/lang/runtime/action.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
Compute
dataclass
Compute(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), conclusion: Claim | None = None, given: tuple[Claim, ...] = (), fn: Callable[..., Any] | None = None, code_hash: str | None = None)
Contradict
dataclass
Contradict(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), a: Claim | None = None, b: Claim | None = None, helper: Claim | None = None)
Decompose
dataclass
Decompose(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), whole: Claim | None = None, parts: tuple[Claim, ...] = (), formula: Any = None)
DependsOn
dataclass
DependsOn(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), conclusion: Claim | None = None, given: tuple[Claim, ...] = ())
Derive
dataclass
Derive(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), conclusion: Claim | None = None, given: tuple[Claim, ...] = ())
Directed
dataclass
Directed(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list())
Equal
dataclass
Equal(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), a: Claim | None = None, b: Claim | None = None, helper: Claim | None = None)
Exclusive
dataclass
Exclusive(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), a: Claim | None = None, b: Claim | None = None, helper: Claim | None = None)
GaiaGraph
dataclass
GaiaGraph(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict())
Base Gaia authoring graph record. Parallel to Knowledge, not a Knowledge subclass.
Infer
dataclass
Infer(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), helper: Claim | None = None, hypothesis: Claim | None = None, evidence: Claim | None = None, given: tuple[Claim, ...] = (), p_e_given_h: float | Claim = 0.5, p_e_given_not_h: float | Claim | None = 0.5, p_e_given_not_h_defaulted: bool = False)
MaterializationLink
dataclass
MaterializationLink(scaffold: Scaffold, by: tuple[GaiaGraph, ...], label: str | None = None, rationale: str = '', metadata: dict[str, Any] = dict())
Bookkeeping link from scaffold to the formal graph records that handle it.
Observe
dataclass
Observe(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), conclusion: Claim | None = None, given: tuple[Claim, ...] = ())
Reasoning
dataclass
Reasoning(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list())
Relation
dataclass
Relation(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list())
Scaffold
dataclass
Scaffold(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict())
Structural
dataclass
Structural(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list())
Support
dataclass
Support(label: str | None = None, rationale: str = '', background: list[Knowledge] = list(), metadata: dict[str, Any] = dict(), warrants: list[Claim] = list(), conclusion: Claim | None = None, given: tuple[Claim, ...] = ())
Distribution
dataclass
Distribution(content: str, *, impl: _BaseDistribution, format: str = 'markdown', **kwargs: Any)
Bases: Knowledge
Knowledge-wrapped continuous quantity with a probability distribution.
Use the family-specific factories (:func:Normal, :func:LogNormal,
:func:Beta, etc.) rather than constructing this directly โ they wrap the
matching gaia.engine.bayes.distributions._BaseDistribution subclass into
a Distribution carrying a content string + identity.
The wrapped computational object is available as .impl and exposes
logpdf / logpmf / cdf / support / model_dump via thin
delegating properties on this class.
Create a Knowledge-wrapped distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
Human-readable description of what this quantity is. |
required |
impl
|
_BaseDistribution
|
A |
required |
format
|
str
|
Content format (markdown by default). |
'markdown'
|
**kwargs
|
Any
|
Standard :class: |
{}
|
Source code in gaia/engine/lang/runtime/distribution.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
impl
property
impl: _BaseDistribution
Return the wrapped computational distribution object.
kind
property
kind: str
Distribution family identifier ("normal", "beta", ...).
params
property
params: dict[str, Any]
Return the distribution parameter dictionary.
logpdf
logpdf(x: float) -> float
Evaluate the log probability density at x (continuous).
Source code in gaia/engine/lang/runtime/distribution.py
239 240 241 | |
logpmf
logpmf(k: int) -> float
Evaluate the log probability mass at k (discrete).
Source code in gaia/engine/lang/runtime/distribution.py
243 244 245 | |
support
support() -> tuple[float, float]
Return the inclusive support bounds of the distribution.
Source code in gaia/engine/lang/runtime/distribution.py
247 248 249 | |
cdf
cdf(x: float) -> float
Cumulative distribution function P(X <= x).
Used at compile time to compute the prior of a predicate claim
(P(k > c) = 1 - dist.cdf(c)). Lazy import of scipy keeps this
out of the cold import path.
Source code in gaia/engine/lang/runtime/distribution.py
251 252 253 254 255 256 257 258 259 260 261 262 | |
model_dump
model_dump() -> dict[str, Any]
Return the JSON-serialisable distribution literal payload.
Source code in gaia/engine/lang/runtime/distribution.py
264 265 266 | |
Domain
dataclass
Domain(content: str, *, members: list[Any], format: str = 'markdown', **kwargs: Any)
Bases: Knowledge
A user-declared, finite, enumerable typed sort.
Subclasses Knowledge so it carries identity, provenance, and metadata. Lang-only: does NOT enter the package's IR-bound knowledge map.
Create a finite enumerable authoring domain.
Source code in gaia/engine/lang/runtime/domain.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
Claim
dataclass
Claim(content: str | None = None, *, prior: float | None = None, from_actions: list[Any] | None = None, formula: Any = None, kind: ClaimKind = ClaimKind.GENERAL, **kwargs: Any)
Bases: Knowledge
Proposition with prior. Participates in BP.
Create a probabilistic claim node.
Source code in gaia/engine/lang/runtime/knowledge.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
ClaimKind
Bases: Enum
Shape discriminator for the structured-content of a Claim (spec ยง4.2).
GENERAL โ default; formula optional, no structural commitments PARAMETER โ asserts a Variable takes a specific value (Equals(var, const)) QUANTIFIED โ top-level quantifier (Forall/Exists) in formula
NOT a "role" (hypothesis/prediction/observation-as-evidence) โ those live on action graph nodes. Observation is an Observe action, not a Claim kind. NOT helper-claim metadata.
Context
dataclass
Context(content: str, *, format: str = 'markdown', **kwargs: Any)
Bases: Note
Deprecated compatibility alias for Note.
Create a deprecated context note alias.
Source code in gaia/engine/lang/runtime/knowledge.py
77 78 79 80 81 82 83 | |
Knowledge
dataclass
Knowledge(content: str, format: str = 'markdown', type: str = 'knowledge', title: str | None = None, background: list[Knowledge] = list(), parameters: list[dict[str, Any]] = list(), provenance: list[dict[str, str]] = list(), metadata: dict[str, Any] = dict(), label: str | None = None, strategy: Any | None = None)
Base knowledge node. Plain text plus metadata.
Note
dataclass
Note(content: str, *, format: str = 'markdown', **kwargs: Any)
Bases: Knowledge
Non-probabilistic contextual material. Does not enter BP.
Create a non-probabilistic note.
Source code in gaia/engine/lang/runtime/knowledge.py
66 67 68 69 70 | |
Question
dataclass
Question(content: str, **kwargs: Any)
Bases: Knowledge
Open inquiry. Does not enter BP.
Create a non-probabilistic question.
Source code in gaia/engine/lang/runtime/knowledge.py
353 354 355 356 357 358 359 | |
Setting
dataclass
Setting(content: str, *, format: str = 'markdown', **kwargs: Any)
Bases: Note
Deprecated compatibility alias for Note.
Create a deprecated setting note alias.
Source code in gaia/engine/lang/runtime/knowledge.py
90 91 92 93 94 95 96 | |
Operator
dataclass
Operator(operator: str, variables: list[Knowledge] = list(), conclusion: Knowledge | None = None, reason: str = '', metadata: dict[str, Any] = dict())
A deterministic logical constraint.
Step
dataclass
Step(reason: str, premises: list[Knowledge] | None = None, metadata: dict[str, Any] | None = None)
A single reasoning step with optional premise references.
Strategy
dataclass
Strategy(type: str, premises: list[Knowledge] = list(), conclusion: Knowledge | None = None, background: list[Knowledge] = list(), reason: ReasonInput = '', metadata: dict[str, Any] = dict(), label: str | None = None, formal_expr: list[Any] | None = None, sub_strategies: list[Strategy] = list(), composition_warrant: Knowledge | None = None)
A reasoning declaration.
RoleOccurrence
dataclass
RoleOccurrence(claim: Claim, role: str, action: Action, action_type: str, action_label: str | None = None, path: tuple[str, ...] = (), source: str = 'explicit_field')
A claim role at a specific occurrence in an authored action.
Variable
dataclass
Variable(*, symbol: str, domain: PrimitiveType | Domain, value: Any | None = None, unit: str | None = None, content: str | None = None, format: str = 'markdown', **kwargs: Any)
Bases: Knowledge
A typed term referenceable by formulas, models, and actions.
Subclasses Knowledge for identity, provenance, metadata. Carries a symbol used in formulas, a domain (PrimitiveType or user-declared Domain), and an optional bound value. Binding semantics (CONSTANT / FREE / BOUND_BY_CLAIM) are inferred by Milestone B's compiler; this class stores only authored data.
Lang-only: does NOT enter the package's IR-bound knowledge map (spec ยง2.4).
Create a typed authoring variable.
Source code in gaia/engine/lang/runtime/variable.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
attach_reasoning
attach_reasoning(claim: Claim, reasoning: Reasoning) -> None
Attach a reasoning record to a claim's reverse index exactly once.
Source code in gaia/engine/lang/runtime/action.py
53 54 55 56 | |
validate_no_self_warrant
validate_no_self_warrant(reasoning: Reasoning, primary: Claim) -> None
Reject reasoning records whose primary claim/helper is also their warrant.
Source code in gaia/engine/lang/runtime/action.py
59 60 61 62 | |
compose
compose(*, name: str, version: str, background: list[Knowledge] | None = None, warrants: list[Claim] | None = None, rationale: str = '', label: str | None = None) -> Callable[[Callable[..., Claim]], Callable[..., Claim]]
Decorate a function as a Gaia action composition template.
Source code in gaia/engine/lang/runtime/composition.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
register_role_handler
register_role_handler(action_type: type[Action], handler: RoleHandler) -> None
Register role projection for an optional action subclass.
Source code in gaia/engine/lang/runtime/roles.py
52 53 54 55 56 | |
roles_for_claim
roles_for_claim(claim: Claim, graph: ActionGraph, *, include_background: bool = True, include_warrants: bool = True) -> tuple[RoleOccurrence, ...]
Return all authored action roles for claim.
Source code in gaia/engine/lang/runtime/roles.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
roles_for_package
roles_for_package(graph: ActionGraph, *, include_background: bool = True, include_warrants: bool = True) -> dict[Claim, tuple[RoleOccurrence, ...]]
Index authored action roles by claim identity.
Source code in gaia/engine/lang/runtime/roles.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |