Skip to main content

hookie-ai (Python)

Python client for Hookie: a project's memories and decisions, knowledge search (memories, documents and the knowledge graph in one call), documents (specs, PRDs, ADRs, runbooks, PDF, Word and HTML files) and the project context bundle, plus adapters for LangChain, LangGraph and CrewAI.

pip install hookie-ai                 # the client (httpx is its one dependency)
pip install "hookie-ai[langchain]"    # + LangChain retriever, chat history and tools
pip install "hookie-ai[langgraph]"    # + LangGraph tool node, context and capture nodes
pip install "hookie-ai[crewai]"       # + CrewAI tools

Python 3.9 or later; the [crewai] extra needs Python 3.10 or later, as CrewAI does. The distribution is hookie-ai; the import is hookie.

Your key

Every call uses your own Hookie credential: an admin API key (hk_…) from Settings → API keys in the console, or a connected agent's OAuth token. The key acts as the member who created it, capped at its role and optionally one project.

export HOOKIE_API_KEY=hk_...        # never commit it
export HOOKIE_PROJECT=my-project    # optional: id or slug; "default" otherwise

Hookie's project routes take a project's id. A slug (default, the Default project's, included) is looked up once per client with GET /admin/api/projects; a project-scoped key, which may not list projects, uses the one project GET /admin/api/me names. hk.project_id() returns the id the client resolved.

The client sends the key only as an Authorization: Bearer header to your Hookie origin (HTTPS, or http://localhost for development). It never logs it, never puts it in an error, and repr(client) leaves it out.

The client

from hookie import Hookie

with Hookie(project="my-project") as hk:          # api_key= defaults to HOOKIE_API_KEY
    ctx = hk.projects.context()                    # summary, decisions, memories, documents, issues
    hits = hk.knowledge.search("how do we deploy?", top_k=10)
    for m in hits["memories"]:  print(m["title"])
    for p in hits["passages"]:  print(p["document_name"], p["score"])
    print(hits["unavailable"])                     # parts your plan does not search, and why

    saved = hk.memories.save("Deploys", "Merging into main deploys production.", tags=["release"],
                             memory_key="deploys")  # the same key updates the same memory
    hk.memories.record_decision("Use Postgres for billing", "Replaces the D1 table; see ADR-7.")
    for m in hk.memories.iter(kind="decision"):    # every page, 100 at a time
        print(m["title"])
    hk.memories.extract(transcript_text, thread={"id": "session-42", "title": "Billing refactor"})

    doc = hk.documents.upload("adr-007.md", "# ADR 7\n...", kind="adr", source_ref="docs/adr/007.md")
    hk.documents.upload_file("spec.pdf", kind="spec")   # PDF, .docx and HTML become Markdown
    hk.documents.search("rate limits", top_k=5)          # document passages only
    text = hk.documents.content(doc["document"]["id"])

AsyncHookie has the same methods, awaited (async for over iter).

Area Methods Route (/admin/api/projects/{project})
Memories save, record_decision, list, search, iter, get, update, delete, versions, restore, extract /memories…
Knowledge search POST /brain/knowledge
Documents upload, upload_file, list, iter, get, content, delete, search /brain/documents…, POST /brain/search
Projects context, list GET /brain/context
Workspace Brain brain.search POST /admin/api/data-workspace/search
Anything else request(method, path, params=, json=) any /admin/api/… route (a POST carries an Idempotency-Key, except on api-keys and invites, which refuse one)

Responses are the API's JSON, unchanged (typed as TypedDicts in hookie.models). Every POST that writes carries an Idempotency-Key, so a retried save runs once; reads (GETs and the search POSTs) are retried on 5xx and burst 429s, twice by default. A 429 whose Retry-After is longer than 10 s is not retried. When a retried write meets Hookie's 409 "still in progress" (its first attempt timed out but is still running), the client waits for the first attempt's answer, up to timeout; past that the HookieConflictError has reason == "idempotency_in_progress": ask again with the same idempotency_key, never a new one.

Errors

Every failure is a HookieError with status, reason, retry_after and body: HookieAuthError (401/403), HookieValidationError (400/413/415/422), HookieNotFoundError (404, also a project you cannot see), HookieConflictError (409: a stale revision, a full allowance, capture switched off, or idempotency_in_progress), HookieRateLimitError (429; .is_quota when waiting a minute will not help), HookieServerError (5xx) and HookieNetworkError (no answer).

LangChain

from hookie import Hookie
from hookie.integrations.langchain import HookieRetriever, HookieChatMessageHistory, create_hookie_tools

hk = Hookie(project="my-project")
retriever = HookieRetriever(client=hk, top_k=8)                 # memories + passages + graph nodes
docs_only = HookieRetriever(client=hk, search="documents")       # or "memories", "workspace"
# top_k is 1-20 in every mode. "memories" matches the query word by word (most words first).
docs = retriever.invoke("how do we deploy?")                     # Documents, metadata["source"] == "hookie"

history = HookieChatMessageHistory("session-42", client=hk, title="Billing refactor")
# ... use it with RunnableWithMessageHistory; then:
history.capture()        # Hookie proposes up to 5 memories from the conversation (#682)
history.recall("billing")

tools = create_hookie_tools(hk)   # hookie_search_knowledge, hookie_project_context,
                                  # hookie_save_memory, hookie_record_decision

HookieChatMessageHistory keeps the messages in your process. Hookie keeps memories, not transcripts: capture() (and clear(), unless capture_on_clear=False) sends the conversation to automatic memory capture, which redacts credentials before its model reads the text and does not store the transcript. System messages and tool output are left out of what is sent. recall(query) matches the query word by word. create_hookie_tools(async_client=...) needs no sync client and no HOOKIE_API_KEY unless a tool is then called synchronously.

LangGraph

from langgraph.graph import StateGraph, MessagesState, START
from hookie.integrations.langgraph import HookieContextNode, HookieCaptureNode, create_hookie_tool_node

graph = StateGraph(MessagesState)
graph.add_node("context", HookieContextNode(hk))        # the project's context as the FIRST message (a system message)
graph.add_node("tools", create_hookie_tool_node(hk))     # the four tools above
graph.add_node("capture", HookieCaptureNode(hk, thread_id="session-42"))

The context node keeps its message at the front of the history (the messages key must use add_messages, as MessagesState does), so a model or prompt that adds its own system message never gets two apart. The capture node sends only what the person and the agent said: not the context, other system messages or tool output.

Hookie memories are curated notes rather than a key-value store, so there is no BaseStore; keep the graph's own state in a LangGraph checkpointer.

CrewAI

from crewai import Agent
from hookie.integrations.crewai import hookie_crewai_tools

agent = Agent(role="Engineer", goal="Ship the billing fix", backstory="...",
              tools=hookie_crewai_tools(hk))   # search knowledge, project context, save memory

Pass allow_writes=False to any of the tool factories for read-only agents.

Content is data, not instructions

Memories, documents and graph nodes are written by people and agents. The tools' text and the context node's message start with a note saying so; keep that note when you build your own prompts from search results.

Tests

No network, no Hookie account: the client is tested against httpx.MockTransport, and the framework tests are skipped when the framework is not installed (set HOOKIE_TEST_REQUIRE=langchain_core,langgraph,crewai to make that a failure).

cd packages/python
python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]' langchain-core langgraph crewai   # frameworks optional
pytest

CI (ci.Dockerfile's verify target) runs them with the LangChain and LangGraph extras and HOOKIE_TEST_REQUIRE=langchain_core,langgraph. CrewAI's tests are skipped there; run them (Python 3.10+) before a release.

License

MIT

Metadata

Release files for hookie-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hookie-ai 0.1.0
File Size Uploaded Provenance Actions
hookie_ai-0.1.0.tar.gz 37.5 kB With provenance Details for hookie_ai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hookie-ai 0.1.0
File Interpreter ABI Platform Actions
hookie_ai-0.1.0-py3-none-any.whl Python 3 none any Details for hookie_ai-0.1.0-py3-none-any.whl

Total release size: 71.1 kB

Release files / hookie_ai-0.1.0.tar.gz

Download URL hookie_ai-0.1.0.tar.gz
Size 37.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2ea012995b7e12c59ea7bf351bdf76ac49906f21dce2d610153590d02e97e446
BLAKE2b-256 checksum
How to use checksums
5ecb5be7a67268b819a3a912aeeb7bf29c808bba7569dec1ac80b45a2725c998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / hookie_ai-0.1.0-py3-none-any.whl

Download URL hookie_ai-0.1.0-py3-none-any.whl
Size 33.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0905c570304f9843705c561b607dd1113a8b193bbe0a2db39f77a46d81d61eca
BLAKE2b-256 checksum
How to use checksums
2c71f5f29634aaf2e6d1ce9c7627c90d46b7726d977b0d875de522e0ba958d22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for hookie-ai 0.1.0

Provenance

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hookie_ai-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page