uv add noesis or pip install noesis. Import as import noesis as ns.
Core functions
ns.run()
Execute a baseline episode using the current session.string
required
Task or goal for the episode.
int
default:"0"
Seed for reproducibility.
bool | Intuition | None
default:"True"
True enables the default intuition policy, False disables it, or pass an Intuition implementation.dict
Metadata tags attached to the episode.
RuntimeContext
default:"None"
Optional runtime context. If provided, execution bypasses the default session.
str | Path | None
default:"None"
Workspace root to snapshot for verification.
VerifySpec | Sequence[VerifySpec] | None
default:"None"
Verification assertions to evaluate against the workspace.
"ep_01JH6Z2V9Q2K6Y6N0QZ7K2QW8C")
Example:
context is a RuntimeContext (a ports container). For metadata, prefer tags={...}.
ns.solve()
Execute an episode through a specific adapter/graph.GraphSource
required
Adapter name/import path or callable to execute the task.
Run lifecycle APIs
Use these APIs for approval gates and same-run continuation. Simple mental model:interruptandcheckpointpause a run with audit evidence.resumeemits lifecycle evidence only (run.resume).resume_runemitsrun.resumeand continues execution.
Lifecycle flow (easy)
- Noēsis enforces immutable, append-only artifacts and replay discipline.
- External tool/LLM outputs may still vary unless your environment captures/freezes them.
- Same run ID.
- Append-only artifacts preserved.
- Resume continues post-plan by default (no replan) with anchor validation.
resume_run(..., using=...)must match the persisted adapter from checkpoint/state.- For minimal runs (
ns.run(...)), omittingusingis allowed.
Common failure modes
RunSealedError: lifecycle writes and resume attempts are rejected oncefinal.jsonseals the run.CheckpointNotFoundError:resume/resume_runreference a checkpoint that does not exist.MissingCausalParentError: checkpoint/interrupt cannot anchor to a causal parent event.CheckpointConsistencyError: checkpoint anchor (event_offset,last_event_id,state_hash) no longer matches artifacts.RunLifecycleTransitionError: lifecycle mutation violates the run state-machine contract.ResumeAdapterRequiredError:resume_runrequires explicitusingfor non-minimal checkpoints.ResumeAdapterMismatchError:resume_runadapter does not match checkpoint adapter contract.
noesis.domain.run_lifecycle.
Verification helpers
Use these helpers to build verification specs forverify=....
ns.summary.read()
Load the summary for an episode.ns.events.read()
Load the event timeline for an episode.stream=True to iterate lazily.
Integrity behavior:
- Raises
noesis.trace.events.EventLogIntegrityErrorwhenevents.jsonlcontains invalid UTF-8, malformed JSON, or a non-object record. - Uses fail-closed semantics: corrupted lines are not skipped.
noesis.io.list_runs()
List recent episodes (newest first).episode_id, task, started_at, flags, success, manifest, and manifest_status (when strict_manifest=True).
In v1.0.0,
ns.list_runs() exists as a deprecated legacy alias. Prefer noesis.io.list_runs().noesis.io.last()
Get the most recent episode ID.ns.set() / ns.get()
Update or read the current configuration snapshot.runs_dir points to the episodes root directory (for example, .noesis/episodes).
Common keys: runs_dir, planner_mode (meta/minimal), direction_min_confidence, governance_mode (off/audit/enforce), governance_failure_policy, governance_timeout_ms (reserved/unused), governance_pause_on_veto, policy_aliases, learn_home, learn_mode, learn_auto_apply_min_confidence, learn_auto_apply_min_successes, intuition_mode, timeout_sec, prompt_provenance_enabled, prompt_provenance_mode, agents (reserved/unused), tasks (reserved/unused).
Intuition and policies
DirectedIntuition
Base class for policies that can emit hints, interventions, or vetoes.hint(advice, confidence=0.5, rationale=None, evidence_ids=None, target="input", scope="episode")intervene(advice, patch, confidence=0.6, rationale=None, evidence_ids=None, target="input", scope="episode")veto(advice, confidence=0.8, rationale=None, evidence_ids=None, target="plan", scope="episode")
IntuitionEvent (schema)
Fields includekind, advice, confidence, policy_id, policy_version, policy_kind, applied, rationale, evidence_ids, patch, target, scope, and blocking (plus schema_version).
NoesisVeto
Raised when a policy vetoes an episode.Governance
Pre-act governance evaluates proposed actions before execution. Configure vians.set(governance_mode=...).
GovernanceMode
GovernanceFailurePolicy
audit → fail_open, enforce → fail_closed.
GovernanceDecision
GovernanceResult
Immutable result from governance evaluation.Custom governors
Custom governor injection is not part of the v1.0.0 runtime/CLI execution surface. Governance is configured via
ns.set(governance_mode=..., governance_failure_policy=...) and uses the built-in pre-act governor.Governed side effects (pre-act gating)
ns.governed_act(...) is the operating-system boundary for side effects.
It executes through the same canonical runtime boundary used by ns.run(...) and ns.solve(...) (same finalization and sealing rules).
Event paths:
- allow/audit:
action_candidate → governance → act - enforce veto (
governance_pause_on_veto=False):action_candidate → governance → terminate(noact) - enforce veto with pause enabled (
governance_pause_on_veto=True):action_candidate → governance → run.interrupt → run.checkpoint(noact, noterminate)
- terminal outcomes (allow/audit/veto terminate): run seals with
final.jsonandmanifest.json - paused-on-veto outcomes: run stays unsealed (no
final.json/manifest.jsonyet) until continuation/termination
kind values:
shell: requiresns.set(shell_executor=...)adapter: requiresns.set(adapter_executor=...)
ns.governed_act(...) raises ValueError before actuation.
Troubleshooting ns.governed_act(...)
Internal tool invocation use cases (adapter implementers)
Noesis also exposes an internal application contract for protocol adapters:run_id + draft_id.
Execution-time failures are surfaced as typed errors from noesis.domain.tool_contract:
PreparedToolInvocationNotFoundErrorApprovalDecisionRequiredErrorApprovalDecisionBindingError
Session management
Use sessions when you need isolated configuration, explicit lifecycle control, or registered ports.SessionBuilder reads config from env/TOML; you can also inject ports before building. Within a session, run/solve behave like the module-level helpers but share the session’s config and runtime context.
Module facades
ns.summary.read(episode_id, context=None): readsummary.json.ns.events.read(episode_id, stream=False, context=None): iterate events; passstream=Trueto lazily consume.ns.context: helpers for building runtime contexts and attaching ports (advanced use — see the “Add a memory port” guide).ns.learn: learning signal emission and proposal management (see Learning section below).
Learning
The learning subsystem records proposals from episode outcomes for policy improvement.LearnMode
ns.set(learn_mode="record").
LearnStatus
LearnProposal
Dataclass for learning signals. Containskind, payload, confidence, status, and metadata.
In v1.0.0, learning proposals are emitted automatically during summary finalization when
learn_mode is enabled. When proposals are generated, they are written to learn.jsonl for the episode and tracked under learn_home.Helper functions
Episode index
EpisodeIndex
Manage an on-disk episode manifest (and optional FAISS similarity index).append(episode_id, summary_path, state_path, status, task, using, provenance=None, embedding=None)iter(include_expired=False)→ iterator ofEpisodeRecordsearch(embedding, k=5)→ similarity matches (empty if FAISS disabled)vacuum()→ prune expired records
Type definitions
IntuitionEvent
Returned by policy methods. See schema above for fields.Determinism utilities
For reproducible testing and replay, Noesis exports deterministic clock and RNG utilities:Environment variables
Next steps
CLI reference
Command-line interface documentation.
Write policies
Create intuition policies.

