State, Memory & Knowledge

Efficient coordination and accountable execution depend on more than a wallet and a scheduler—agents need a place to remember facts, replay past decisions, and store artefacts large and small. Degents ships a “memory fabric” that blends fast in-memory caches, durable journals, and vector search, all behind a single transactional API.

7.1 Memory Model

Scratchpad

Per-tick variables, prompts, intermediate tool outputs

< 1 min

In-process dict / Redis

Short-term log

Recent intents, receipts, policy verdicts

~24 h (configurable)

Append-only ring buffer (Redis Streams)

Journal

Canonical sequence of all signed events

Infinite

ACID SQL (Postgres, SQLite)

Vector memory

Semantic embeddings for unstructured text, charts, or code

Tunable

Qdrant / Weaviate

Blob store

PDFs, model checkpoints, large audit bundles

Infinite

IPFS / S3 / Filecoin

Each tier is pluggable; default drivers work out-of-the-box for quick starts, but can be swapped for enterprise back-ends (e.g., Redis → Aerospike, Postgres → Cockroach).

7.2 Unified Data API

from degents.memory import Mem # Scratchpad Mem.ephemeral.set("price_gap", 0.023) # Journal write Mem.journal.append("intent", intent_dict) # Semantic recall docs = Mem.vector.similarity_search("optimistic rollup security", k=5)

All writes return a handle that can be cited or revoked; every call may participate in a cross-tier transaction (with Mem.tx(): …) ensuring consistency between the journal and vector index.

7.3 Privacy & Encryption

At-rest encryption

AES-GCM keys stored in Hashicorp Vault; optional envelope encryption with HSM.

Row-level ACLs

Each journal record tagged with agent-ID and policy domain—only authorised agents can replay.

Zero-knowledge audit

Optional zk-SNARK proofs attest that an off-chain computation matches on-chain receipts without revealing private inputs.

Right-to-forget

GDPR-style erasure API cascades deletes through vector and blob layers, then anchors a hash of the removal proof on-chain.

7.4 Replay & Deterministic Debugging

Every decision an agent makes—prompt, policy verdict, transaction hash—lands in the journal with a monotonic sequence number. A built-in replay tool can:

  1. Fork the chain at block n.

  2. Re-inject intents in order.

  3. Compare resulting receipts to originals.

Discrepancies flag non-determinism (e.g., time-dependent oracle reads) and help tighten simulations before production.

7.5 Costs & Scaling Tiers

Local dev

SQLite · DuckDB · LiteFS

Single-file portability; zero setup.

Small fleet

Postgres + Redis (docker)

Handles up to ~50 k intents/min.

Enterprise / DAO

CockroachDB + Redis Cluster + Qdrant

Multi-region HA; transparent shard re-balancing.

Edge mesh

LiteFS (read-mostly) + Qdrant Cloud

Low-latency reads; batched writes back to HQ.

Storage drivers emit Prometheus metrics (latency, eviction, compaction) and raise back-pressure signals to the scheduler when needed.

7.6 Why It Matters

  • Fast recall of market context and prior dialogues boosts LLM reasoning quality.

  • Deterministic journals make audit, compliance, and forensics straightforward.

  • Vector search allows agents to learn from historical data rather than starting from zero each time.

  • Pluggability means teams can choose the cost-performance envelope that fits their budget or regulatory constraints.

With a robust state layer underpinning every decision, Degents agents aren’t just stateless bots—they are persistent digital entities that learn, adapt, and remain accountable over time.

Last updated