Reconstructive retrieval and source documents
Adapt-1’s retrieval is reconstructive. It combines similarity with associative completion and learned relations to recover relevant context from retained evidence. Later evidence and corrections can change what a query recovers. Mechanisms describes how that state evolves. An application can optionally combine State with retrieval-augmented generation (RAG). Use external source retrieval to fetch original passages from a document collection when the task needs exact wording or citations. Keep source identifiers with the retrieved evidence and use State for continuing context and reasoning across interactions.Preserve source records
Keep original timestamps, source references, artifact digests, and verification identities with each record. For generic State writes, put source metadata incontext. Maintain an application ledger that maps each source event to its returned memory ID and write receipt. Resolve retrieved memory IDs through this ledger and use original artifacts for exact quotations and integrity checks.
Reconnect from a fresh client with the same authorized bearer identity to retrieve retained records. Verify record IDs, source metadata, and digests against the application ledger.
Work through a project change
A project assistant has a launch review date and a dependency that affects readiness. The migration schedule changes during the project.
The example stores these records separately and queries with a question about launch dependencies and timing. It then corrects the migration date to 15 October and repeats the same query. Both reads set
update_memory_state: false so the comparison isolates the record correction.
Use the API key from the quickstart. Save the following as state_project.py and run python state_project.py. Each run adds three records to the State associated with that key.
state_project.py
Inspect the change
The program prints the actual responses before and after correction. Inspectmemory_context for the relevant project records and reasoning when returned. include_reasoning: true requests structured reasoning alongside context.
A project application can use the returned context and reasoning in its review interface, with the supporting records available for inspection. Continue storing new project information and correct existing records when their content changes.
Choose a read operation
Query, search, and explain default to
update_memory_state: true. Set it to false for a read-only comparison. Explain a result describes the response fields and their limits.
Manage the record lifecycle
All operations above use
POST. Inspect each batch result before retrying: records stored before a later failure remain stored. The compatibility alias /api/v1/batch_store remains available.
Preserve correction history
For annotations stored through/api/v1/memory/store, preserve history separately from the replacement:
- Preserve the original annotation and its source artifact outside State.
- Store a separate correction record with its own ID, the target annotation ID, original and replacement text, timestamp, source reference and SHA-256 digest, and verifier identity.
- Call
/api/v1/memory/correctwith the original memory ID, complete replacement content, and allcontextfields to retain. - Check
storage_result.accepted,storage_result.action, andstorage_result.memory_id. Retrieve the corrected annotation and separate correction record, and verify both against their sources.
Scope, summaries, and pruning options
Scope, summaries, and pruning options
Hosted identity follows the bearer token. The body value
session_id: ignored satisfies the compatibility contract and has no effect on tenant selection./memory/state also accepts summary_only: true. When pruning, set max_records, optional max_bytes, and include_unique deliberately. Inspect the dry-run candidates before applying them with dry_run: false.A Domain is useful when events, relations, targets, or action outcomes need a stable task contract. State and Domain histories have different reset boundaries; see Operations and retries.Explain the result
Inspect evidence, support, and unresolved information.
Create a task-scoped learner
Add a Domain when you need a separate, observable prediction target.
