Skip to content

pycontextdb 0.4.9: active-only pending confirmations, richer MCP schemas, and AI agent discovery

Latest

Choose a tag to compare

@atomsai atomsai released this 15 Nov 10:35

Active-only pending confirmations, richer MCP tool schemas, and AI coding-agent discovery for agent memory — pycontextdb 0.4.9

pycontextdb 0.4.9 ships four correctness, MCP parity, and machine-discovery upgrades in the open-source ContextDB SDK for engineering teams building AI agents on SQLite, PostgreSQL/pgvector, and the Model Context Protocol:

  • Active-only pending_confirmations(): Unslotted ContextDB.pending_confirmations() now filters out superseded (superseded_by is not None) and expired (not is_valid_at(moment)) revisions, matching slotted pending_confirmations(entity=..., attribute=...) so agents and confirmation queues never ask users to re-confirm a fact that was already replaced.
  • Full local MCP (contextdb.mcp) parameter parity & schemas: remember accepts event_time, recall accepts as_of, both recall_for_action and pending_confirmations accept optional entity and attribute slot filters, and all six MCP tools publish explicit JSON Schema property descriptions for reliable tool selection.
  • Warm PostgreSQL lexical cache: PostgresStore.search_text() serves warm lexical identifier lookups from the in-process revision-gated index cache without an extra SQL round-trip.
  • Verified AI coding-agent discovery & templates: pyproject.toml updates Documentation to https://contextdb.ai/docs, adds For AI Agents, MCP Connector, and Changelog project URLs, expands PyPI keywords (mcp, model-context-protocol, provenance, pii-redaction, sqlite, postgresql, pgvector, bm25, temporal-memory), and ships verified 0.4.9 opt-in templates in ai-tools/ (AGENTS.md, CLAUDE.md, .cursorrules, llms.txt, llms-full.txt).

What was wrong in 0.4.8:

  • Unslotted pending_confirmations() returned historical pending rows even after a newer write superseded the same entity/attribute slot and closed valid_until.
  • Local contextdb serve MCP schemas omitted event_time, as_of, and slot-scoped entity/attribute parameters that the Python SDK already supported, and lacked per-property descriptions.
  • pyproject.toml pointed Documentation at an unserved domain and ai-tools/ carried pre-0.4 helper signatures.

Install or upgrade

pip install --upgrade 'pycontextdb==0.4.9'

No schema migration is required. Existing SQLite and PostgreSQL stores upgrade in place.

Runnable example

Offline, with the mock embedder and mock model:

import asyncio
import tempfile

import contextdb
from contextdb.core.config import ContextDBConfig


async def main() -> None:
    folder = tempfile.mkdtemp()
    db = contextdb.init(
        user_id="synthetic_customer_9",
        config=ContextDBConfig(
            storage_url=f"sqlite:///{folder}/demo.db",
            embedding_model="mock",
            llm_model="mock",
            llm_api_key="mock",
            enable_auto_link=False,
        ),
    )
    async with db:
        await db.factual.add(
            "Customer might want invoices sent to draft@example.com.",
            source="agent_inferred",
            entity="user",
            attribute="billing_email",
        )
        await db.factual.add(
            "Customer might want invoices sent to finance@example.com instead.",
            source="agent_inferred",
            entity="user",
            attribute="billing_email",
        )
        pending = await db.factual.pending_confirmations()
        print("version:", contextdb.__version__)
        print("active pending count:", len(pending))
        print("active pending content:", [m.content for m in pending])


asyncio.run(main())

Verified output on November 15, 2026:

version: 0.4.9
active pending count: 1
active pending content: ['Customer might want invoices sent to [EMAIL] instead.']

Use cases

  • Customer-support and billing agents running confirmation queues: pending_confirmations() surfaces only the current unconfirmed value per slot, eliminating duplicate prompts over superseded guesses.
  • Platform engineers running self-hosted MCP (pycontextdb[serve]): coding agents and internal copilots get slot-scoped recall_for_action(entity=..., attribute=...), temporal event_time/as_of, and self-describing tool schemas over local HTTP or stdio.
  • Developers adopting ContextDB in Cursor, Claude Code, Codex, or GitHub Copilot: opt-in ai-tools/AGENTS.md and ai-tools/CLAUDE.md files configure provenance and action-gating idioms without overriding existing repo storage choices.

Verified behavior

  • 226 offline unit, integration, MCP, and trust-model eval tests pass locally, plus full matrix CI across Python 3.10, 3.11, and 3.12 and real PostgreSQL 16 concurrency/evolution suites.
  • scripts/check_release.py verified Apache-2.0 open-core boundaries, wheel/sdist contents, LICENSE/NOTICE inclusion, and absolute documentation links.

Compatibility and limitations

  • Apache-2.0 grant: pycontextdb 0.4.9 is permanently Apache-2.0 with no profile cap, no license key, and no phone-home check.
  • No schema migration: SQLite and PostgreSQL schemas are unchanged from 0.4.8.
  • Host enforcement required: recall_for_action returns act, ask, or abstain; your host application remains responsible for end-user authentication, authorization, and business-state checks.

Links

FAQ

Do I need a database migration to upgrade from 0.4.8 to 0.4.9?
No. Both SQLite and PostgreSQL schemas are unchanged.

Does pending_confirmations() delete superseded rows from history?
No. Superseded rows remain in audit/history with superseded_by and valid_until populated; pending_confirmations() simply returns only currently active unconfirmed memories.

Is pycontextdb 0.4.9 Apache-2.0?
Yes. Releases through 0.4.9 are permanently Apache-2.0 with no profile cap.