Reference¶
This section is the API reference, generated from the source code's docstrings. Each module has its own page, listing its classes, functions and constants with their full signatures.
Most applications import from a subpackage, for example from anagrapheus.timeline import ReplayPins. Each subpackage re-exports its public names, but each name is documented on the page of the module that defines it. So ReplayPins is documented under anagrapheus.timeline.replay, not under anagrapheus.timeline. The groups below say which module holds what.
The top-level package adds one function of its own, anagrapheus.register_builtin_events(registry). It registers every event type the library emits, across all subpackages, into an EventTypeRegistry. Call it once when you build your registry. Registering only some subpackages' events leads to an UnknownEventType error later, when a reader reaches an event type that was not registered.
Timeline¶
anagrapheus.timeline: The append-only event log, its SQLite store, the event-type registry, folds and projections, schema upcasting, the pin ledger, replay and recordings.
envelope:DomainEvent, the base class for your own events, and the envelope and stored forms the log keeps.registry:EventTypeRegistryandEventKey, which name and version each event type.store: the store protocols, for a backend other than SQLite.sqlite:SQLiteEventStore.folds:ProjectionFold,GenerativeFold,OwnsPosition,PreparesSynchronously,ProjectorandFoldDeterminism.upcast:Upcast,UpcastRegistryandEventReader, which bring old event schemas forward as they are read.pins:PinLedger,pin_key, thePinResolverprotocol, the pin events andis_bookkeeping, which matches them.replay:ReplayPins,PinMissandDivergence.recording:write_recording,read_recording,pin_events,RecordingandRecordingError.migrations:SchemaTooNewand the store's schema migrations.errors:TimelineErrorand its subclasses.
Provider¶
anagrapheus.provider: Model and tool calls sent through the pin ledger, and the call policy that decides when two calls are the same call.
model:PinnedModel, which wraps any pydantic-ai model.tools:pinned_tool.policy:CallPolicyand the defaultSemanticCallPolicy.stream:PinnedStreamedResponse, the stream a replay rebuilds from a pinned response.errors:ProviderError.
Beliefs¶
anagrapheus.beliefs: Per-scope beliefs as a fold over the log, belief ids minted only from declared predicates, and the entity index (entity to belief ids) that re-keying reads.
predicates:PredicateRegistryandPredicate, the only way to mint a belief id.ops:Revise,Expand,Contract, theInterpretertype that turns your events into them, andStateRef, which names a belief state an edge or a prompt part cites.events:BeliefRevised,BeliefExpandedandBeliefContracted.writer:BeliefEvents, which builds those events from a predicate and its entities.fold:BeliefFold.index:BeliefIndex.storeandsqlite: the index store protocol andSQLiteBeliefIndexStore.rekey:plan_rekeysandBeliefRekey.divergence:divergenceandDisagreement.migrationsanderrors: schema migrations, andBeliefErrorand its subclasses.
Identity¶
anagrapheus.identity: Entity identity as decisions recorded in the log, the registry folded from them, and the re-key rows a merge produces.
decisions:establish,alias,merge,split,unmergeandmint_entity_id.events: the decision events.fold:IdentityFold.registry:IdentityRegistry, includingrekeys_since.ladder:Ladder, your ordered list of stance tokens for how firmly an alias is held, used to rank candidates.vocabulary:IdentityVocabulary, which maps your own event types onto the identity decisions.storeandsqlite: the identity store protocol andSQLiteIdentityStore.migrationsanderrors: schema migrations, andIdentityErrorand its subclasses.
Chronicle¶
anagrapheus.chronicle: Consolidation of log ranges into sections that cite the range they cover, read as recent events plus older history.
fold:ChronicleFold,Summarizer,Consolidation, the unit boundariesUnitBoundaryandEventTypes, andsection_id.sections:SectionandAnchor.reading:Brief,Recent,Anchors,Prose,Retrieverandsubstring_retriever.storeandsqlite: the chronicle store protocol, with export and load, andSQLiteChronicleStore.migrations: schema migrations.
Assembly¶
anagrapheus.assembly: Prompts built only from the slices of state a role was granted, with parts that cite their sources and a budget that never sheds a binding part.
slices:EventsSlice,LogSlice,BeliefSlice,ChronicleSlice,Givenandhanded_out.parts:Part,Register,Sourcewith its variantsEventRef,SectionRef,GivenRefand the belief layer'sStateRef, andContext.assemble:assembleandBudget.render:render_labelled.errors:AssemblyErrorand its subclasses, such asNotGrantedandBudgetExceeded.