khwan-crewai
Memory for a CrewAI crew that outlives the run. Plugs Khwan — a pure AI-memory layer — into CrewAI as tools and as a wrapper around a crew run.
Khwan never runs your model. The crew's model is the "your model" step:
prepare() ──► recall memory + constitution (no LLM)
[ the crew runs ] ← Khwan never touches it
record() ──► persist what was actually said
pip install khwan-crewai
Two halves, and you want both
Tools let an agent look something up when it decides to. The loop runs whether it decided to or not — and that is what the next session recalls.
The loop — where memory accumulates
from khwan_crewai import KhwanMemory
async with KhwanMemory(api_key="kwk_live_xxx", core="acme") as mem:
turn = await mem.prepare(user_input)
result = await crew.kickoff_async(inputs={
"memory": mem.seed_text(turn), # "" when nothing is known
"question": user_input,
})
await mem.record(turn, str(result))
It wraps the crew rather than living inside it, because what is worth keeping is the answer that actually went out — not every intermediate step an agent took to get there.
Tools — what an agent reaches for mid-task
from crewai import Agent
from khwan_crewai import khwan_tools
agent = Agent(
role="Analyst",
tools=khwan_tools(api_key="kwk_live_xxx", core="acme"),
...
)
| Tool | What it does |
|---|---|
khwan_recall(query) |
standing rules + past exchanges on a topic |
khwan_remember(fact) |
keep a decision or preference for future runs |
khwan_verify(draft) |
check a draft against memory before it ships |
Everything fails open
Memory that is down must never stop an answer. A failed prepare means the crew
runs without recall; a failed record means the turn is not learned; a tool that
cannot reach Khwan returns a sentence saying so rather than raising, because a
raising tool aborts the agent's step. All of it logs at warning, so an outage is
visible rather than silent.
An empty recall is an answer
Retrieval applies a relevance floor, so no results means the brain holds nothing
close to this question — not that something went wrong. khwan_recall says so in
words the agent can repeat, and seed_text returns "", which interpolates into
a prompt harmlessly.
Isolation
One account holds many cores (separate brains), and each core can hold a sub-brain per end-user — a complete separate brain that does not spend one of your cores. A client with several projects is usually one core with a sub-brain each:
KhwanMemory(api_key=..., core="acme", user_id="Web") # account::acme::@Web
KhwanMemory(api_key=..., core="acme", user_id="Api") # shares nothing with @Web
Cores must exist before you point at one — create them in the dashboard. Sub-brains are created on first write.
Configuration
| Argument | Required | Purpose |
|---|---|---|
api_key |
yes | From the dashboard (kwk_live_…). Not your model provider's key. |
core |
no | Which isolated brain (default: the account's default core). |
user_id |
no | Sub-brain within that core (paid plans). |
base_url |
no | Override the API base, e.g. a local engine. |
Releasing
Publishing runs from a GitHub Release over PyPI's Trusted Publishing — OIDC, so there is no API token in the repository, in a secret, or anywhere to rotate.
One-time setup on PyPI: the project's Publishing settings, add a GitHub
publisher for khwanlabs/khwan-crewai, workflow publish.yml, environment
pypi. A name that has never been published is added the same way, as a
pending publisher.
Then a release is a tag and a click; the workflow runs the tests first and refuses to publish something that does not pass them.
Related
khwan— the client underneath, sync and asynckhwan-mcp— the same memory for any MCP client- docs.khwan.ai
Source
github.com/khwanlabs/khwan-crewai — this sits between your crew and its memory and runs with your key. Read it before you install it.
License
MIT — © Khwan Labs.
Metadata
Release files for khwan-crewai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| khwan_crewai-0.1.0.tar.gz | 9.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| khwan_crewai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / khwan_crewai-0.1.0.tar.gz
| Download URL | khwan_crewai-0.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdd1b0f8f0de6cd53377c6cdc93749240bfcb136b77e05ebf99dc8fc29a7241c
|
|
BLAKE2b-256 checksum How to use checksums |
f21140c3efe9ac41260e7dcae60b2776d510169552f282f4b07a346d1f9e7d4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 25, 2026.
Transparency logRelease files / khwan_crewai-0.1.0-py3-none-any.whl
| Download URL | khwan_crewai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12b67c0726b550bc3b0f5ff995be7cd5dbe54f8dd8dc5606fa99bab0af451277
|
|
BLAKE2b-256 checksum How to use checksums |
18d649353af70267267fa93d905ad64869f9faa0087b9d1305d0c26301524560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 25, 2026.
Transparency logSecurity for khwan-crewai 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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for khwan_crewai-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 Aug 25, 2026.
Transparency logA 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.