Skip to main content

Drop-in CrewAI memory integration for Neruva agent memory + reasoning substrate. v0.2.0 adds AUTO-PILOT: NeruvaAutoPilot (classify intent + reflect + extract via your LLM) + NeruvaAutoPilotHooks (after_task callback that auto-extracts facts from task output to KG; reflect_on_crew_finish for cross-task self-curation). Plus NeruvaShortTermMemory / NeruvaLongTermMemory / NeruvaEntityMemory / NeruvaStorage as CrewAI memory backends. Substrate stays $0/call (pattern-C).

Project description

neruva-crewai

Drop-in CrewAI memory integration for Neruva agent memory + reasoning substrate. Three memory flavors backed by the Neruva substrate, plus (new in 0.2.0) the auto-pilot surface for proactive cognitive tool routing.

pip install neruva-crewai

What's new in 0.2.0 — Auto-pilot

  • NeruvaAutoPilot — framework-agnostic core. Pass a callable (your CrewAI LLM's .call method) and get classify_intent(), reflect(), and extract_facts() methods that round-trip through the substrate's canonical prompts.
  • NeruvaAutoPilotHooks — bundle of CrewAI task callbacks. after_task auto-extracts facts from any task output to KG. reflect_on_crew_finish(agent_outputs) self-curates substrate from cross-task results.

Plus NeruvaCodeGraph (5 sub-ms code-navigation methods) and NeruvaCognitive (13 cognitive-primitive methods — counterfactual rollout / theory-of-mind / schema lifting / EFE planning / continual K-gram / hierarchical chunking / rule induction). Callable from any agent tool or task callback.

Pattern-C: substrate stays $0/call. Classification + extraction runs through YOUR caller LLM.

from crewai import Task, Crew, Agent
from crewai.llm import LLM
from neruva_crewai import (
    NeruvaLongTermMemory,
    NeruvaAutoPilot,
    NeruvaAutoPilotHooks,
)

llm = LLM(model="claude-3-7-sonnet-20250219")
ap = NeruvaAutoPilot(api_key="nv_...", namespace="my_crew",
                     llm_callable=lambda p: llm.call(p))
hooks = NeruvaAutoPilotHooks(ap)

task = Task(
    description="Research X and write a brief",
    agent=agent,
    callback=hooks.after_task,  # auto-extract facts from result
)
crew = Crew(
    agents=[agent], tasks=[task],
    memory=True,
    long_term_memory=NeruvaLongTermMemory(namespace="my_crew", api_key="nv_..."),
)
result = crew.kickoff()

# Optional cross-task reflection
hooks.reflect_on_crew_finish([{"output": str(result)}])

What's new in the substrate (v0.5.7, May 2026)

The substrate this adapter wraps has gained a lot since the last release. Existing code keeps working — new capabilities are just available.

  • Deterministic replay — every query is bit-identical across reruns from the same seed. Replay any past crew state for audit or debugging.
  • Typed-shape context — pull structured JSON from records with per-field citations. {question, shape: {field: type}} → typed result without an LLM at query time. Natural fit for crew tool calls that need a specific output schema.
  • Tenant-specific PII rules — register your custom ID formats (employee codes, patient codes, order IDs) from 3-5 examples. The substrate redacts them automatically.
  • Depth-unlimited nested-belief tracking — store and retrieve chains like Alice → Bob → Carol thinks X at any depth, with inner-position-swap rejection. Useful for multi-agent crew sims.
  • Counterfactual rollouts — "what if action k had been a' instead?" Replay an action sequence with one step substituted.
  • Active inference planning — score candidate action sequences by KL distance to a goal-marginal.
  • Continual K-gram learning — provable no-forgetting via integer-add commutativity.

Quick start

from neruva_crewai import NeruvaLongTermMemory
from crewai import Crew

memory = NeruvaLongTermMemory(
    namespace="my_project",         # one per crew / domain
    api_key="nv_...",               # or env NERUVA_API_KEY
)

crew = Crew(
    agents=[...],
    tasks=[...],
    memory=True,
    long_term_memory=memory,        # plugged in here
)

Three memory flavors

Class What it backs Underlying substrate
NeruvaShortTermMemory CrewAI ShortTermMemory (per-run scratchpad) Records, kind="short_term"
NeruvaLongTermMemory CrewAI LongTermMemory (cross-run persistent) Records, kind="long_term"
NeruvaEntityMemory CrewAI EntityMemory (named entities + relationships) Records + HD KG triples

All three persist across process restarts via GCS — no Redis or Postgres setup required.

Entity memory with triple binding

Use the canonical extraction prompt to extract triples in your own LLM turn (Claude / GPT / etc), then pass them as metadata:

from neruva_crewai import NeruvaEntityMemory

entity_mem = NeruvaEntityMemory(namespace="my_project", api_key="nv_...")

# After your agent observes a fact about an entity:
entity_mem.save(
    value="Caroline researches adoption agencies",
    metadata={
        "triples": [
            ["caroline", "researches", "adoption_agencies"],
            ["caroline", "works_at", "charity"],
        ],
    },
)

# Later — sub-ms KG entity recall:
results = entity_mem.search("What did Caroline research?", limit=5)

Or use Neruva's agent_remember(extract="managed") to have the substrate run extraction for you on every save (server-side, sub-$0.001/turn typical).

Why use Neruva instead of CrewAI's default storage?

Feature CrewAI default Neruva
Persists across process restart ChromaDB local file GCS-backed, multi-machine
Cross-crew recall Manual setup One namespace per crew, instant federation
Knowledge-graph entity tracking LLM-based, opaque HD KG, sub-ms cosine, deterministic
Causal queries / Pearl do-operator Not offered agent_causal_query
Provable replay Not offered agent_snapshot + agent_restore
GDPR forget by user Manual user_id auto-folds, one-call forget
Portability None .neruva zip container

Get an API key · Docs

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

neruva_crewai-0.2.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

neruva_crewai-0.2.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file neruva_crewai-0.2.1.tar.gz.

File metadata

  • Download URL: neruva_crewai-0.2.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for neruva_crewai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c3cc035a32941c9bcbdfc281d8d124e43eaed691da8cd15c3156412380393e8c
MD5 b6db87f26b0639424fc118fd00876ef0
BLAKE2b-256 a22817002745ddee9bb8c7c4d66578adc8bfb8c55f59febd44d748040ce2f28b

See more details on using hashes here.

File details

Details for the file neruva_crewai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: neruva_crewai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for neruva_crewai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0369b27d8656c1050c9b06b744e854fd845030c370636a211318646596c5590d
MD5 3f92e2d2b284b6c2ed572e3106b19118
BLAKE2b-256 ee56188092ccd0f8f20bf3d9ba5a93a1f8aa608d789b192b0643843a11a61669

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