pip install agentdatabase==0.4.1 Copy PIP instructions
A governed memory layer for Python agents. AgentDB stores agent memories with provenance, applies optional write policies, ranks retrieved records, tracks conflicts, and provides adapters for feeding governed context into agent runtimes.
AgentDB is a local Python library backed by SQLite. It complements an agent runtime; it is not a hosted service, a vector database, or a replacement for the model provider.
The current storage implementation is embedded SQLite. There is no Postgres/cloud backend or HTTP MCP transport. The gateway dispatcher is in-memory; the audit log is stored separately in SQLite.
python3 -m venv .venv source .venv/bin/activate python -m pip install -e '.[dev,mcp]' Optional extras (the distribution name is agentdatabase):
python -m pip install 'agentdatabase[local-embed]' # local sentence-transformer embeddings python -m pip install 'agentdatabase[mcp]' # stdio MCP server python -m pip install 'agentdatabase[providers]' # Anthropic provider client python -m pip install 'agentdatabase[notifications]' # Slack notifications python -m pip install 'agentdatabase[evolution]' # WikiSkill and SkillOpt bridges Email notifications use the Python standard library. The notifications extra is needed for Slack.
Pass a memory_dir or path when constructing the client:
from agentdb import AgentDB # Creates config/, database/, and other workspace directories as needed. db = AgentDB(memory_dir="./agentdb-memory") record = db.write( key="memory/working/response_style", value="Prefer concise bullet points.", origin="agent_inferred", agent_id="assistant", ) result = db.retrieve("How should I format the response?", agent_id="assistant") print([record.value for record in result.records]) The default workspace configuration is written to config/memory.yaml. Set AGENTDB_MEMORY_DIR or AGENTDB_HOME to choose a workspace through the environment.
Provide permissions_path to enable write/delete checks:
db = AgentDB( memory_dir="./agentdb-memory", permissions_path="./permissions.yaml", ) Example policy:
default_policy: deny human_zone_prefixes: - "skills/" agents: assistant: can_write: - "memory/working/" cannot_write: - "skills/" Important current limits:
memory.yaml uses a named profile with optional overrides. Built-in profiles are budget_optimized, full_storage, and research:
profile: name: budget_optimized agents: assistant: retrieval: retrieve_limit: 10 # Embeddings are off unless enabled or supplied through the constructor. embeddings: enabled: true # model: sentence-transformers/all-MiniLM-L6-v2 Embeddings can also be enabled with AgentDB(local_embed=True) or a custom embed_fn(text) -> list[float]. They enable semantic ranking and embedding-based conflict checks. Local embeddings require the local-embed extra; embedding support is disabled by default.
Retrieval returns RetrievalResult with records, conflicts, authority override instructions, a token estimate, and a truncation flag. retrieve_by_entities() supports action-oriented lookups. Semantic matching requires embeddings; without them, retrieval uses the non-semantic signals and existing text/entity matching.
AgentDBMiddleware (from agentdb.adapters import AgentDBMiddleware) provides prepare_turn / finalize_turn and run_turn, plus async variants. The async preparation path can inject skills, workspace information, and recent work context according to RunnerCapabilities; the synchronous path prepares memory context.
AgentDBClaudeRuntime supports synchronous model clients and an async Claude SDK client factory. AgentDBClaudeMiddleware remains available as a backward-compatible import. The adapter exposes a PreToolUse hook map through get_sdk_hooks(); the integrating application is responsible for registering that hook with its SDK/runtime.
AgentDBHermesProvider implements Hermes's MemoryProvider interface. It supplies retrieval, turn persistence, skills context, and lifecycle hooks. Governance applies to AgentDB records; a post-write Hermes hook cannot veto a write already made to Hermes-native storage.
No dedicated deepagents, LangGraph, CrewAI, OpenAI Agents, Google ADK, or AutoGen adapter is included. Use AgentDBBackend where the framework supports a pluggable key/value backend, or integrate AgentDBMiddleware at the runtime's own control points.
See docs/integrations/README.md for integration guides.
python -m pytest -q See docs/context/testing-strategy.md for focused test commands and docs/context/architecture-principles.md for the design constraints. The repository uses a src/ layout and package imports such as from agentdb import AgentDB.
Both files in this release have provenance metadata.
GNU Affero General Public License v3 (AGPL-3.0)
dev mcp local-embed wikiskill skillopt evolution notifications providers
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




