Skip to main content

citadeldb-openai-agents

An OpenAI Agents SDK Session backed by Citadel. Encrypted at rest, embedded in your process, and deletes that destroy the key, not just the row.

pip install citadeldb-openai-agents
from agents import Agent, Runner
from citadeldb_openai_agents import CitadelSession

session = CitadelSession("user-123", "agent.cdl", key="your-passphrase")

agent = Agent(name="assistant", instructions="Be brief.")
result = await Runner.run(agent, "remember my dog is called Mochi", session=session)
result = await Runner.run(agent, "what is my dog called?", session=session)

The conversation persists across processes, so the second run answers from the transcript rather than from the prompt.

Many sessions, one file

Citadel is embedded and one connection owns the file, so sessions are minted from a store rather than each opening the database:

from citadeldb_openai_agents import CitadelSessionStore

store = CitadelSessionStore("agent.cdl", key="your-passphrase")
alice = store.session("user-alice")
bob = store.session("user-bob")

The convenience constructor does this for you: two CitadelSession objects on the same path build their own store but reach one open database. Asking for the same path with a different passphrase raises rather than quietly serving the first one's settings.

Deletes destroy the key

Every item is sealed under its own key. clear_session destroys those keys, so the bytes on disk stay unreadable. A backup taken before the delete carries its own copy of the wrapped key and is out of scope.

await session.clear_session()

pop_item does the same for a single rolled-back turn.

The SDK's own EncryptedSession wrapper encrypts items and skips expired ones on read, but the ciphertext and its key both remain.

Search the transcript

Beyond the protocol, a session can be searched with Citadel's hybrid recall, which ranks on vector distance, keyword rank and recency rather than on an exact match:

await session.add_items([
    {"role": "user", "content": "the deployment failed because the disk was full"},
    {"role": "user", "content": "lunch plans for friday"},
])

await session.search("why did the release break?", limit=1)
# [{'content': 'the deployment failed because the disk was full', 'role': 'user'}]

Nothing in the SDK calls this. Runner only ever uses the four protocol methods.

TTL

store = CitadelSessionStore("agent.cdl", key="your-passphrase", ttl=86400)  # seconds

Expired items stop being returned and are skipped by the storage engine itself, so a retention window needs no sweeper.

Notes

Items are stored verbatim as opaque JSON. The SDK's item type is a large union owned by the openai package, so the stored payload is never normalised: function calls, reasoning items and multi-part content all round-trip unchanged. Only a plain-text projection of content is derived, for search ranking.

MockEmbedder is the default and needs no download, which is enough to run an agent and to test. search only becomes semantically useful with a real embedder. CandleEmbedder is not in the default citadeldb wheel and needs a source build (maturin build --features candle-embed); any object exposing dim, metric, model_id, embed and embed_queries works too:

import citadeldb
store = CitadelSessionStore(
    "agent.cdl",
    key="your-passphrase",
    embedder=citadeldb.CandleEmbedder("/path/to/e5-large", preset="e5-large"),
)

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

citadeldb_openai_agents-2.0.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

citadeldb_openai_agents-2.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file citadeldb_openai_agents-2.0.0.tar.gz.

File metadata

  • Download URL: citadeldb_openai_agents-2.0.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for citadeldb_openai_agents-2.0.0.tar.gz
Algorithm Hash digest
SHA256 4186afa909a0472ab1119b428ae354d150858f7f191a46eaa306b008fc43a90f
MD5 c1be3e5a49c6f43bcd0bdb88d033890a
BLAKE2b-256 bd27badad4077d71658c25c07d45296869021f044475e1b2e39c878af3f1f1d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for citadeldb_openai_agents-2.0.0.tar.gz:

Publisher: release-openai-agents.yml on yp3y5akh0v/citadel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file citadeldb_openai_agents-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for citadeldb_openai_agents-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 573d1bc2a3583fd48e216c0924dff934779c81f8d8b373204d36f5ba56eb55ee
MD5 f23f160f9931c7ffe2723450a2231945
BLAKE2b-256 4cf6098e8d13cf6ecb6e9e3e2ebe470c4ea5d0c2c655eb0d307f5624f8a68471

See more details on using hashes here.

Provenance

The following attestation bundles were made for citadeldb_openai_agents-2.0.0-py3-none-any.whl:

Publisher: release-openai-agents.yml on yp3y5akh0v/citadel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page