Skip to main content
LangState separates reusable state primitives from application-specific behavior. The table below distinguishes contracts from implementations.

Mutator contract

BaseMutator.mutate(context) is asynchronous and returns MutationResult. The included LLMMutator:
  1. copies the input InterpretiveState;
  2. asks the supplied BaseLLMClient for a JSON array of extractions;
  3. validates each extraction;
  4. appends a ValueConfidence candidate; and
  5. replaces the field’s latest Inference.
Provider authentication, retries, structured-output enforcement, rate limiting, and telemetry belong to the client implementation or application layer.

Projector contracts

BaseProjectorCanonicalState requires project() and can_trigger_action(). Its schema supports resolution strategy, confidence threshold, validation errors, fields requiring confirmation, and triggered-action identifiers. BaseProjectorUI requires project(), generate_prompt(), and map_field_to_component(). UI model types are data contracts; no renderer is bundled.

Keep orchestration ownership explicit

When composing extensions, decide which layer owns the loop, current state, authentication, billing, persistence, and retries. The base LangState class stores references but does not silently take ownership of those concerns.