Skip to content

Python API

import factlang as fl

Everything in fl.__all__ is public API, and so is the __all__ of each public package: fl.ir, fl.sql, fl.connectors, fl.types, fl.syntax (factlang.syntax) and factlang.agent. Import from those paths; any other module path (factlang.semantics.…, factlang.ir.primitives, factlang.connectors.base, …) is internal and may move. The package follows SemVer from 0.1.0; the language itself is versioned separately (fl.LANGUAGE_VERSION == "1.0").

Stable API

The following are public API under SemVer: no breaking change within a 0.x minor series. Libraries built on FactLang, schema profilers in particular, may depend on them.

item
factlang.ir primitives (ColumnAggregate, CompositeKeyAggregate, ValueMembership, KeyOverlap, PatternCoverage, MetadataQuery), their fields and result columns, Metric, SampleSpec IR primitives
Checker.measure, Checker.ameasure, Checker.estimate, fl.measure, Measurement, CostEstimate Raw measurement
fl.parse_filter, fl.sql.render_filter, fl.sql.render_join, RenderedFragment Fragments
fl.connectors.run_metadata (also fl.run_metadata) Metadata SQL
fl.Ident, fl.TableRef, fl.ColumnRef, fl.EdgeRef (also in fl.ir) IR primitives
fl.check_pack, fl.Catalog (the catalog protocol) Packs, Catalogs
fl.discover_packs(): {name: factory} for every pack installed under the factlang.packs entry-point group Packs
fl.types.LiteralKind, fl.types.ValueType, fl.types.register_type (also importable as from factlang.types import …) Value types
fl.sql.Param (a typed bind parameter) Fragments
fl.connectors.Connector, AsyncConnector, QueryResult, ExecutionError Connectors
factlang.syntax.FILTER_KEYWORDS: the words reserved inside a WHERE filter (the filter-keyword set only, not every keyword of the language) Filters
factlang.syntax.needs_quoting, factlang.syntax.quote_name: whether a name must be quoted in FactLang source, and its quoted form Writing names from code
fl.ir.register_primitive, fl.ir.unregister_primitive (fl.ir.PRIMITIVE_LOWERINGS is read-only by convention: change it only through these two) IR primitives
Report.verified and Report.ok Verdicts

The metric aliases (row_count non_null distinct_keys max_rows_per_key min_value max_value sum_value avg_value duplicate_keys server_now) are a wire format and do not change at all.

One-call helpers

lint

lint(text: str, *, pack: ContractPack | None = None, catalog: Catalog | None = None) -> DiagnosticBag

Every front-end diagnostic of text (parse + analysis); never executes anything.

The bag remembers text, so fl.lint(text).render() prints caret diagnostics.

format

format(text: str) -> str

The canonical form of text. Raises ValueError (with the rendered diagnostics) when text does not parse: formatting it would silently drop the broken lines.

compile

compile(text: str, *, dialect: str, pack: ContractPack | None = None) -> list[RenderedProbe]

Each claim's own probe for dialect, in source order, without a warehouse.

Unprobeable (semantic) claims have no SQL and are skipped. Any invalid claim, or a claim that cannot be rendered for dialect, raises ValueError naming every such claim and its diagnostic codes.

check

check(text: str, *, connector: Connector | AsyncConnector, **checker_kwargs: Any) -> Outcome | Report

Check text on connector: the Outcome when it holds exactly one claim, else the Report. checker_kwargs go to :class:~factlang.engine.Checker.

measure

measure(plans: ProbePlan, *, connector: Connector | AsyncConnector, **checker_kwargs: Any) -> Measurement
measure(plans: Sequence[ProbePlan], *, connector: Connector | AsyncConnector, **checker_kwargs: Any) -> list[Measurement]
measure(plans: ProbePlan | Sequence[ProbePlan], *, connector: Connector | AsyncConnector, **checker_kwargs: Any) -> Measurement | list[Measurement]

Run IR primitives with no claim (R1, B3): one plan gives one Measurement, a sequence of plans a list (fused like Checker.measure). Never raises for a failure.

parse_filter

parse_filter(text: str, *, catalog: Catalog | None = None, table: TableRef | None = None) -> tuple[FilterExpr | None, DiagnosticBag]

Parse and analyse a bare spec 4.5 condition (R6), with or without a leading WHERE.

Parameters are p1, p2, ... in source order. With a catalog and a table the columns are checked as in a claim. The filter is None when there is any error.

parse

parse(source: str) -> ParseResult

Tokenize and parse source; never raises.

needs_quoting

needs_quoting(name: str) -> bool

True iff writing name bare in FactLang source would not denote that exact name.

A bare name must match [A-Za-z_][A-Za-z0-9_$]* (ASCII), must not be an uppercase word (at least one letter and no lowercase letter: such a word starts the attribute section or is read as a keyword) and must not be WHERE, USE or a member of FILTER_KEYWORDS (case-sensitive). deleted, Status and order need no quotes; ID, NULL, order items and 2fa do. Quoting is always safe: when in doubt (a non-ASCII letter, say) the answer is True.

quote_name

quote_name(name: str) -> str

The FactLang double-quoted form of name: " + name with " doubled + ".

Raises ValueError for an empty name and for a name holding a carriage return or a newline (a quoted identifier cannot span lines) or NUL (no warehouse identifier can hold it; rendering would refuse it as FL502).

fl.check with a single claim returns an Outcome; with any other number it returns a Report. To get document-level diagnostics (a broken USE line, for instance) always use Checker.check, which returns a Report.

Report.verified is the flag to gate on: every outcome that is not UNPROBEABLE is PASS, there is at least one such outcome, and no error diagnostic was raised. Report.ok is weaker: it only rules out FAIL, ERROR and INVALID, so a report with NO_DATA outcomes, or with nothing measured at all, is ok but not verified.

Checking

Checker

Checker(connector: Connector | AsyncConnector | None = None, *, dialect: str | None = None, pack: ContractPack | None = None, catalog: Catalog | None = None, concurrency: int = 4, timeout_s: float | None = 60, max_bytes: int | None = None, fuse: bool = True, prefer: Prefer = 'native')

Checks FactLang documents against one warehouse (spec 9.3).

dialect defaults to the connector's. With a connector and no catalog, names are checked (and catalog verbs answered) through CachedCatalog(WarehouseCatalog(connector)) (spec 6.1). concurrency probes run at once (a thread pool; acheck an asyncio semaphore). max_bytes enables the dry-run cost guard (FL701). A connector that does not enforce timeout_s is backstopped: no answer TIMEOUT_GRACE_S after the timeout is FL702.

check

check(text: str) -> Report

Check every claim of text. Raises ValueError only when a rendered probe must run and the Checker has no connector (a configuration error, not a claim outcome).

acheck async

acheck(text: str) -> Report

compile

compile(text: str) -> list[RenderedProbe | Outcome]

Each claim's own (unfused) probe, or its outcome when it has none; never executes.

A catalog verb compiles to the MetadataQuery probe of its table.

measure

measure(plans: Sequence[ProbePlan]) -> list[Measurement]

Run raw IR primitives (R1); sampled plans allowed. Never raises for a failure.

ameasure async

ameasure(plans: Sequence[ProbePlan]) -> list[Measurement]

estimate

estimate(items: str | Sequence[ProbePlan]) -> list[CostEstimate]

Dry-run prices of each probeable claim (text) or plan (R5). Never executes.

Claims are analysed without a catalog (any catalog may execute metadata queries); invalid, unprobeable and catalog claims are skipped.

offline_catalog

offline_catalog() -> Catalog | None

The catalog to analyse with when nothing may be executed: the one the host gave, or None when this Checker built its own warehouse catalog (that one runs queries). Use it to build a sibling Checker for another dialect without touching the warehouse.

Report dataclass

Report(outcomes: tuple[Outcome, ...], diagnostics: DiagnosticBag)

Ordered outcomes of one document plus every diagnostic raised while checking it.

ok property

ok: bool

No FAIL, ERROR or INVALID outcome and no error diagnostic (e.g. a broken USE directive, which is not an outcome of its own).

verified property

verified: bool

Every claim that can be measured was measured and PASSed: no FAIL, ERROR, INVALID or NO_DATA outcome, no error diagnostic, and at least one outcome that is not UNPROBEABLE. Stricter than :attr:ok, which tolerates NO_DATA and a report with nothing measured (e.g. an empty document).

Outcome dataclass

Outcome(claim_text: str, canonical_text: str, semantic_hash: str, verb: str, verdict: Verdict, explanation: str, facts: Mapping[str, object], evidence: Evidence | None, diagnostics: tuple[dict[str, object], ...])

to_dict

to_dict() -> dict[str, object]

JSON-safe dict: Decimal -> str, temporals -> ISO-8601 (datetimes in UTC), tuples -> lists, enums -> their value.

Verdict

Bases: str, Enum

Evidence dataclass

Evidence(sql: str | None = None, params: tuple[object, ...] = (), dialect: str | None = None, tier: str | None = None, duration_ms: float | None = None, bytes_processed: int | None = None, fused_with: tuple[str, ...] = (), sample: SampleSpec | None = None, method: str = 'exact')

Measurement dataclass

Measurement(plan: ProbePlan, payload: dict[str, object] | None, verdict_hint: Verdict | None, evidence: Evidence | None, error: Diagnostic | None)

A raw measurement (R1): payload is exactly what a contract's derive would get.

error is None or the Diagnostic (FL7xx, or FL4xx/FL5xx when the plan could not be rendered); verdict_hint is ERROR on an error, NO_DATA when the probe returned no rows, else None.

CostEstimate dataclass

CostEstimate(semantic_hash_or_plan_key: str, sql: str | None, bytes: int | None, method: Literal['dry_run', 'unknown'])

A dry-run price (R5): the claim's semantic hash or the plan's canonical key, the display SQL (None when the plan cannot be rendered), the bytes and how they were obtained.

key property

key: str

Read-only alias of :attr:semantic_hash_or_plan_key.

Contracts and packs

standard_pack

standard_pack() -> ContractPack

A fresh ("standard", "1.0") pack holding every verb in _MODULES.

ContractPack

ContractPack(name: str, version: str, *, parent: ContractPack | None = None)

A named, versioned set of contracts (spec 10).

A child pack from extend resolves names it does not hold in its parent at lookup time; its own writes (register, override, alias, remove) never touch the parent.

verb

verb(name: str, *, summary: str = '', operands: Sequence[OperandSpec], attrs: Iterable[AttrSpec] = (), filterable: bool = False, requires: Iterable[tuple[str, str]] = ()) -> ContractBuilder

register

register(contract: Contract) -> None

override

override(contract: Contract) -> None

alias

alias(new: str, target: str) -> None

remove

remove(name: str) -> None

extend

extend(name: str, version: str) -> ContractPack

merge

merge(other: ContractPack, on_conflict: OnConflict = 'error') -> ContractPack

Add other's verbs (aliases stay aliases). error is atomic.

get

get(name: str) -> Contract | None

names

names() -> list[str]

contracts

contracts() -> list[Contract]

Contract dataclass

Contract(spec: VerbSpec, derive: Derive, decide: Predicate, examples: tuple[Example, ...], plan: Plan | None = None, catalog_facts: CatalogFacts | None = None, unprobeable_reason: str | None = None, fact_names: tuple[str, ...] = ())

One claim kind. Exactly one of plan/catalog_facts/unprobeable_reason.

fact_names declares every fact derive can produce (checked by FL600).

Example dataclass

Example(source: str, valid: bool = True, expect: str | None = None)

An executable example. An invalid one names the diagnostic code it must raise; a valid one may name a (non-error) diagnostic it must emit.

check_pack

check_pack(pack: ContractPack) -> list[str]

Every completeness problem of pack (incl. inherited verbs), [] if none.

Codes: FL600/FL601 (decide reads undeclared facts/attributes), FL602 (too few examples), FL603 (an example does not behave as declared, or its plan/catalog function raises), FL604 (an incomplete decorator-built contract; reported, never raised, and the other contracts are still checked), FL404 (a sampled plan), FL605 (a valid example with a WHERE whose plan drops the filter). Aliases are checked through their target.

discover_packs

discover_packs() -> dict[str, Callable[[], ContractPack]]

Pack factories from the factlang.packs entry-point group; loaded on first call.

Operand

Shorthands for the common operand specs (spec 10): Operand.column() etc.

AttrSpec dataclass

AttrSpec(name: str, type: str, required: bool = False, ops: tuple[str, ...] = (), doc: str = '')

ops == (): an operator is forbidden; otherwise one of ops is required.

Predicates

Compare dataclass

Compare(fact: str, op: str, value: object = None, attr: str | None = None)

fact <op> value or fact <op> claim[attr] (exactly one of value/attr).

CompareUsingClaimOp dataclass

CompareUsingClaimOp(fact: str, attr: str)

fact <op> claim[attr] where op is the operator the author wrote (bare: ==).

Within dataclass

Within(fact: str, attr: str, tolerance_attr: str = 'TOLERANCE', abs_attr: str = 'ABS_TOLERANCE')

Answer verbs (spec 6.4): fact <op> claim[attr] with the claim's tolerance band.

op is the operator the author wrote on attr (bare: ==). The band is max(TOLERANCE * |target|, ABS_TOLERANCE) over the attributes present (0 when neither is: exact, math.isclose when a float is involved). With a band b: == |a-t| <= b; != |a-t| > b; >= a >= t-b; > a > t-b; <= a <= t+b; < a < t+b. Arithmetic is in Decimal (a float via Decimal(str(x))).

And dataclass

And(*items: Predicate)

Or dataclass

Or(*items: Predicate)

Not dataclass

Not(item: Predicate)

WhenClaimHas dataclass

WhenClaimHas(attr: str, then: Predicate, otherwise: Predicate)

then when the claim carries attr, else otherwise (use Always()).

IR

ColumnAggregate dataclass

ColumnAggregate(table: TableRef, column: Ident | None, metrics: tuple[Metric, ...], filter: FilterExpr | None = None, sample: SampleSpec | None = None)

CompositeKeyAggregate dataclass

CompositeKeyAggregate(table: TableRef, columns: tuple[Ident, ...], metrics: tuple[Metric, ...], filter: FilterExpr | None = None, sample: SampleSpec | None = None)

ValueMembership dataclass

ValueMembership(table: TableRef, column: Ident, declared: tuple[str, ...], split: str | None = None, report_limit: int = 20, filter: FilterExpr | None = None, sample: SampleSpec | None = None)

KeyOverlap dataclass

KeyOverlap(left: tuple[ColumnRef, ...], right: tuple[ColumnRef, ...], cast_to: str | None = None, measure_multiplicity: bool = False, filter: FilterExpr | None = None, right_filter: FilterExpr | None = None, sample: SampleSpec | None = None, right_sample: SampleSpec | None = None)

Join key overlap. filter/sample apply to the left side, right_* to the right.

PatternCoverage dataclass

PatternCoverage(table: TableRef, column: Ident, pattern: str, filter: FilterExpr | None = None, sample: SampleSpec | None = None)

Case-folded LIKE coverage over non-NULL values.

MetadataQuery dataclass

MetadataQuery(table: TableRef, column: Ident | None = None)

Catalog metadata of a table (or one column). Never sampled.

SampleSpec dataclass

SampleSpec(method: SampleMethod, fraction: Decimal, seed: int = 0, key: tuple[Ident, ...] = ())

How a raw measurement samples its input (Amendment B, B1). Never used by verdicts.

Metric

Bases: Enum

register_primitive

register_primitive(cls: type, *, lower: Callable[..., object], replace: bool = False) -> None

Register a primitive class and its lowering. Raises on a duplicate unless replace.

unregister_primitive

unregister_primitive(cls: type) -> None

Remove the registration of primitive cls; raises KeyError if it has none.

The supported way to undo :func:register_primitive (in a test's teardown, say); do not mutate PRIMITIVE_LOWERINGS directly.

SQL

render_filter

render_filter(filter: FilterExpr, *, dialect: str | DialectProfile, table: TableRef | None = None, alias: str | None = None, param_prefix: str = 'p', prefer: Literal['native', 'sqlglot'] = 'native') -> RenderedFragment

A resolved filter as a bindable boolean expression (R6), columns qualified by alias.

table (optional) is checked against the dialect's identifier rules and table-part limit (FL502/FL505). Parameters are named <param_prefix>1, …. A dialect without a native profile (or prefer="sqlglot") goes through the sqlglot bridge.

render_join

render_join(edges: Sequence[EdgeRef | JoinEdge], dialect: str | DialectProfile, *, filters: Mapping[TableRef, FilterExpr] | None = None, aliases: Mapping[TableRef, str] | None = None, param_prefix: str = 'p', prefer: Literal['native', 'sqlglot'] = 'native') -> RenderedFragment

FROM a JOIN b ON … [WHERE …] for a join path (R6), bindable, never executed here.

The left-most table's filter is the WHERE; every other table's filter is ANDed into the ON of the join that brings it in (see :func:~factlang.sql.fragment.lower_join). A dialect without a native profile (or prefer="sqlglot") goes through the bridge.

RenderedFragment dataclass

RenderedFragment(sql_template: str, params: tuple[Param, ...], dialect: str, tier: str)

A rendered boolean expression or FROM … JOIN … clause with typed parameters.

inline

inline(quote_string: Callable[[str], str] | None = None, style: LiteralStyle | None = None) -> str

Display text with literals inlined for self.dialect (FL507 when unsafe).

RenderedProbe dataclass

RenderedProbe(sql_template: str, params: tuple[Param, ...], arity: Arity, plan: ProbePlan | None, dialect: str, tier: str)

One executable SELECT for one plan: neutral template + typed parameters.

plan is None only for host-authored metadata SQL (connectors.run_metadata); every probe rendered by FactLang carries the plan it was rendered from.

inline

inline(quote_string: Callable[[str], str] | None = None, style: LiteralStyle | None = None) -> str

Display SQL with literals inlined, spelled for self.dialect unless style says otherwise; FL507 when a value cannot be inlined safely.

register_profile

register_profile(profile: DialectProfile, *, replace: bool = False) -> None

Register a native profile under profile.name; a duplicate raises unless replace.

native_dialects

native_dialects() -> list[str]

Names of every registered native profile, sorted.

Connectors

Connector

Bases: Protocol

Executes rendered probes. dialect names a profile; paramstyle is the driver's.

A connector may also define dry_run_bytes(probe) -> int | None (spec 18 R5): price a probe without executing it. It is optional; use :func:dry_run_bytes to call it.

QueryResult dataclass

QueryResult(rows: list[dict[str, Any]] = list(), bytes_processed: int | None = None)

ExecutionError

ExecutionError(message: str, *, code: str | None = None)

Bases: Exception

A probe (or metadata query) could not be executed; code is an FL7xx code.

ExecutionError("FL702 timed out") takes the code from the message; ExecutionError("timed out", code="FL702") prefixes it. str(error) always starts with the code.

run_metadata

run_metadata(connector: Connector, sql: str, params: Sequence[Param] | Mapping[str, object] = (), *, timeout_s: float | None = None) -> QueryResult

Execute host-authored catalog metadata SQL through connector (spec 9.1, R8).

sql marks bind parameters with neutral {{name}} tokens, exactly as a rendered probe does, and params supplies them (Param objects, or a {name: value} mapping whose families are inferred). They are bound with the connector's paramstyle, never spliced. The guard (:func:check_metadata_sql) runs first and raises ExecutionError FL703 before anything executes. Execution, timeouts and error mapping are the connector's own (FL700/FL702). This is not a claim: it yields rows, never an Outcome. The probe passed to the connector has plan=None, and the rows keep the labels the warehouse returned (no lower-casing).

Through :class:~factlang.connectors.SQLAlchemyConnector, whose text() would read :word as a bind parameter even inside a string literal, every : in sql is escaped before binding, so literals such as 'a:b' and casts such as x::text reach the driver unchanged. A {{name}} token immediately after a : (x::{{t}}) cannot be bound by text(); neither can a token glued to a word character (a{{t}}, {{t}}b) or to another token ({{a}}{{b}}). SQLAlchemyConnector refuses those with FL700 before executing; separate them with a space.

T-SQL (tsql or an alias such as mssql/sqlserver/synapse/fabric, and, failing closed, any dialect with no native profile), where statements may need no separator: only a SELECT is accepted, and it runs wrapped as SELECT * FROM (<sql>) AS fl_meta_q. So there is no WITH/SHOW, no ORDER BY without TOP (SQL Server rejects it in a derived table), every result column needs a distinct name, and no quote character may appear: no string literals and no quoted identifiers (' " [ ]); pass values, and compare odd names, as parameters.

DBAPIConnector

DBAPIConnector(connection: Any, dialect: str, paramstyle: str | None = None)

Executes probes on a PEP 249 connection.

paramstyle defaults to the driver module's paramstyle (else qmark). Each probe runs on a fresh cursor, closed afterwards. With timeout_s the statement is cancelled through the cursor's interrupt()/cancel() (duckdb, pyodbc), else the connection's (sqlite3, psycopg), when the driver has one, and reported as FL702.

Checker runs probes from several threads. Statements on one connection run concurrently only when that is safe: duckdb (cursor() is an independent duplicate connection), or a driver declaring PEP 249 threadsafety >= 2 whose cursors have their own cancel hook (trino). Otherwise they are serialised by one lock per connection object, shared by every connector wrapping it: a level-1 driver (pymysql, pyodbc; clickhouse-connect, which overstates its level) would interleave two statements, and with only a connection-level cancel (psycopg) one probe's timeout would cancel another's statement. Waiting for the lock counts against timeout_s; running out while waiting is FL702.

CallableConnector

CallableConnector(fn: HostFn, dialect: str, paramstyle: str = 'qmark')

Wraps fn(sql, params) -> rows; params is a tuple or dict per paramstyle.

The host function cannot be given the timeout, so it is the host's to enforce; a TimeoutError (or any timeout-shaped error) it raises becomes FL702, any other exception FL700. An ExecutionError it raises passes through unchanged.

SQLAlchemyConnector

SQLAlchemyConnector(engine: Any)

Executes probes through a SQLAlchemy engine: text() with named binding.

connect

connect(dsn: str) -> SQLAlchemyConnector

A connector for a SQLAlchemy URL (postgresql+psycopg://…, duckdb:///…).

BigQueryConnector

BigQueryConnector(client: Any, *, default_project: str | None = None, default_dataset: str | None = None, maximum_bytes_billed: int | None = None)

dry_run_bytes

dry_run_bytes(probe: RenderedProbe) -> int | None

Bytes BigQuery would process for probe (a dry-run job; nothing executes).

Catalogs

Catalog

Bases: Protocol

NullCatalog

Knows nothing: every answer is unknown.

StaticCatalog

StaticCatalog(tables: Mapping[str, Mapping[str, str]])

Authoritative in-memory catalog keyed by dotted table key.

Unquoted parts of a reference match case-insensitively; a quoted part matches exactly. The fullest key is tried first (catalog.schema.table, then schema.table, then table).

CachedCatalog

CachedCatalog(inner: Catalog, ttl_s: float = 300, max_tables: int = 10000, clock: Callable[[], float] = time.monotonic)

TTL + LRU cache over another catalog; None answers are cached too.

Thread-safe: the cache is guarded by a lock, which is not held while the inner catalog is asked (two threads missing the same entry may both ask; the later answer is kept).

table_exists

table_exists(ref: TableRef) -> bool | None

The inner catalog's answer; AssertionError if it is not True/False/None (raised explicitly, so it holds under python -O too).

columns

columns(ref: TableRef) -> dict[str, str] | None

A copy of the inner catalog's answer; AssertionError if it is neither a dict nor None (raised explicitly, so it holds under python -O too).

WarehouseCatalog

WarehouseCatalog(connector: Connector, *, timeout_s: float | None = None, memo_s: float = 60.0, clock: Callable[[], float] = time.monotonic)

Answers table_exists/columns from the warehouse's own catalog.

An empty answer means the table does not exist (False). When the question cannot be asked or answered (rendering fails, the query fails with FL700, rows lack column_name/data_type) the answer is None (unknown), never False; the error is kept in :attr:errors. columns is also None when the dialect has no native profile, as its type names cannot then be mapped to families.

A timeout (FL702) is not an answer: it is raised, so a caching wrapper does not store a transient failure as "unknown" for its whole TTL.

One query serves one table_exists and one columns call for the same ref: the result is memoised until the other method has used it, or for at most memo_s seconds, so table_exists followed by columns (as CachedCatalog asks) costs one query. The memo is guarded by a lock, so one instance may serve several threads.

native_columns

native_columns(ref: TableRef) -> dict[str, str] | None

{column name: native type} (empty when the table does not exist), or None.

Always queries; it does not use or fill the memo.

Value types

ValueType dataclass

ValueType(name: str, accepts: frozenset[LiteralKind], coerce: Callable[[Literal], object] | None = None, validate: Callable[[object], str | None] | None = None)

register_type

register_type(vt: ValueType, *, replace: bool = False) -> None

Agent surface

tool_definitions

tool_definitions(pack: ContractPack | None = None) -> list[dict[str, Any]]

The three tool specs for pack (default: the standard pack).

handle_tool_call

handle_tool_call(name: str, arguments: dict[str, Any], checker: Checker, *, max_claims: int | None = DEFAULT_MAX_CLAIMS) -> dict[str, object]

Run tool name with arguments on checker; a JSON-safe dict, never raises.

factlang_check and factlang_explain refuse more than max_claims claims (too_many_claims, counted by :func:count_claims before any analysis); None removes the cap. factlang_lint is never capped: it runs no SQL.

verb_reference

verb_reference(pack: ContractPack | None = None, style: Style = 'markdown') -> str

The reference of every verb in pack (default: the standard pack).