Skip to main content

Persistent memory and governance layer for AI agents

Project description

getprimer

Persistent memory and governance layer for AI agents.

pip install getprimer

Quick start

from getprimer import Primer

p = Primer(api_key="pk_live_...")  # or set PRIMER_API_KEY env var

# ── Always do this pattern ─────────────────────────────────────────
ctx = p.brief(agent="my-bot")           # load context at session start
print(ctx["context_summary"])           # inject into system prompt

# ... agent does work ...

p.learn("Customer prefers async comms", pinned=True, source_trust="human")
p.check("delete_records")              # True = allowed, False = blocked
p.handoff("Done. Next: add tests.")    # save handoff at session end
# ──────────────────────────────────────────────────────────────────

LangChain

from getprimer.langchain import PrimerTools

tools = PrimerTools(api_key="pk_live_...").as_tools()
agent = initialize_agent(tools=tools, llm=ChatOpenAI(), ...)

Autonomous mode (zero explicit calls — Primer hooks in automatically):

from getprimer.langchain import PrimerCallbackHandler

callback = PrimerCallbackHandler(api_key="pk_live_...")
llm = ChatOpenAI(callbacks=[callback])
# Every LLM chain now gets Primer context injected automatically

Session limit

On the free plan (20 sessions/month), when the limit is reached brief() raises SessionLimitError. The exception message is safe to surface directly to the user:

from getprimer import Primer, SessionLimitError

try:
    ctx = p.brief()
except SessionLimitError as e:
    print(e)  # "⚠️ Primer: You've used all 20 free sessions..."
              # Upgrade at: https://getprimer.cloud/pricing

Get an API key

Sign up at getprimer.cloud — free plan included.

Project details


Download files

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

Source Distribution

getprimer-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

getprimer-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file getprimer-0.1.0.tar.gz.

File metadata

  • Download URL: getprimer-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for getprimer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf9432f73623d606879a95d6f865689a90f4d06216b63bc93c799fadd0445593
MD5 1ab44ae79f9297fd8992874b9476023d
BLAKE2b-256 ce1438c92df76d98a9aa1d106f0e2f9c6176699580bc81633660c28d1de11891

See more details on using hashes here.

File details

Details for the file getprimer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: getprimer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for getprimer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b07274406d26b94eed52a4b75696ff39e6f5cd0d344fd1aa3b85f725cd3f25f6
MD5 7902ac36820603480a6ccbeb1482dba7
BLAKE2b-256 d0ad178325ddfc47c9cffc4c43401fe49bd13fe853ec22c5399f1eff887a9314

See more details on using hashes here.

Supported by

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