hookie-ai is Hookie’s Python client for a project’s brain: its memories and
decisions, knowledge search (memories, documents and the knowledge graph in one
call), documents and the project context bundle. It ships adapters for
LangChain, LangGraph and CrewAI, and it is MIT licensed.
The package is on PyPI as hookie-ai.
Install
[crewai] extra needs Python 3.10 or later,
as CrewAI does. The distribution is hookie-ai; the import is hookie.
Your API 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. Hookie never
supplies a key for you. The key acts as the member who created it, capped at its role
and, optionally, one project. See API keys.
Authorization: Bearer header to your Hookie
origin (HTTPS, or http://localhost for development). It never logs the key, never
puts it in an error, and leaves it out of repr(client).
Projects by id or slug
Hookie’s project routes take a project’s id. You can pass an id or a slug. The client looks a slug up once withGET /admin/api/projects; a project-scoped key, which may not
list projects, uses the one project GET /admin/api/me names. With no project named,
calls go to default, the slug of your workspace’s Default project.
hk.project_id() returns the id the client resolved.
The client
AsyncHookie has the same methods, awaited, and supports async for over iter.
Responses are the API’s JSON, unchanged, typed as
TypedDicts in hookie.models. See
Project context and Personal AI memory for what each
field means.
memories.extract sends a session to automatic memory capture:
Hookie proposes up to 5 memories and decisions from it, redacts credentials before its
model reads the text, and does not store the transcript.
Retries and idempotency
- Every POST that writes carries an
Idempotency-Key, so a retried save runs once.request()sends none on the routes that refuse one (api-keysandinvites). - Reads (GETs and the search POSTs) are retried on 5xx and burst 429s, twice by default.
A quota 429 is not retried, and neither is a 429 whose
Retry-Afteris longer than 10 seconds. - When a retried write meets Hookie’s 409 “still in progress” (the first attempt timed
out but is still running), the client waits for the first attempt’s answer, up to
timeout. Past that, theHookieConflictErrorhasreason == "idempotency_in_progress": ask again with the sameidempotency_key, never a new one.
Errors
Every failure is aHookieError with status, reason, retry_after and body:
LangChain
Installhookie-ai[langchain].
- Retriever:
top_kis 1 to 20 in every mode. Thememoriesmode matches the query word by word and ranks memories that match more words first. - Chat history:
HookieChatMessageHistorykeeps the messages in your process. Hookie keeps memories, not transcripts:capture()(andclear(), unlesscapture_on_clear=False) sends the conversation to automatic memory capture. System messages and tool output are left out of what is sent.recall(query)matches the query word by word. - Tools:
create_hookie_tools(async_client=...)needs no sync client and noHOOKIE_API_KEYunless a tool is then called synchronously.
LangGraph
Installhookie-ai[langgraph].
- Context node: keeps its message at the front of the history and replaces it rather
than repeating it. The messages key must use
add_messages, asMessagesStatedoes, so a model or prompt that adds its own system message never gets two apart. - Capture node: sends only what the person and the agent said, not the context, other system messages or tool output.
BaseStore. Keep the graph’s own state in a LangGraph checkpointer.
CrewAI
Installhookie-ai[crewai] (Python 3.10 or later).
HookieKnowledgeSearchTool, HookieProjectContextTool and
HookieSaveMemoryTool, which saves a memory or a decision.
Read-only agents
Passallow_writes=False to any of the tool factories (create_hookie_tools,
create_hookie_tool_node, hookie_crewai_tools) to leave out the tools that save.
For a read-only key, create one with the viewer role in Settings → API keys.
Content is data, not instructions
Memories, documents and graph nodes are written by people and agents. The framework 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.Related
- n8n node: the same memories, knowledge and documents in n8n workflows.
- Node SDK: send events and verify webhooks from JavaScript.
- Project context and Personal AI memory.