Skip to main content

NeuramineRL

Self-improvement for AI agents. NeuramineRL gives your agent the ability to learn from its past mistakes

Every time your agent fails, NeuramineRL reflects on the failure and distills it into a conditioned lesson ("When submitting the booking form, use ISO dates; MM/DD/YYYY is silently rejected"). On future runs, the relevant lessons are retrieved and injected into the prompt. Crucially, NeuramineRL then tracks whether each injected lesson actually improved outcomes — lessons that help get promoted, lessons that don't decay and get pruned. No pile of stale superstitions.

run agent → capture trajectory → detect outcome → reflect on failures
     ↑                                                    │
     └── inject lessons ← score & prune ← store lessons ←─┘

Quickstart

pip install neuraminerl[embeddings]
export ANTHROPIC_API_KEY=...   # or OPENAI_API_KEY — used for reflection
from neuraminerl import Learner

nm = Learner()  # zero config: SQLite + local embeddings in ./.neuraminerl/

with nm.run(task="Book the cheapest NYC->SFO flight on the demo site") as run:
    prompt = SYSTEM_PROMPT + str(run.lessons)  # inject lessons from past failures
    result = my_agent(prompt)  # your agent, unchanged
    run.log(result.messages)  # best-effort trajectory capture
    run.end(success=result.ok, error=result.error)

Run it twice. The second run is smarter.

On failure, NeuramineRL reflects (one cheap LLM call, off the hot path) and stores lessons like:

<learned_lessons>
Lessons from previous attempts at similar tasks. Apply them unless clearly
inapplicable to the current situation.
1. When submitting the booking form, use ISO dates (YYYY-MM-DD); MM/DD/YYYY is silently rejected.
2. When an API call returns 409, retry once with a new idempotency key instead of changing the payload.
</learned_lessons>

Why not just a memory library?

Storing lessons is the easy part. The hard parts — the parts NeuramineRL owns — are:

  1. Outcome capture — failures detected from exceptions, explicit results, delayed user feedback (nm.feedback(run_id, "that was wrong", success=False)), or an optional LLM judge.
  2. Reflection — failures are distilled into conditioned rules ("when X, do Y"), not vague advice, and deduplicated/generalized against existing lessons at write time.
  3. Lesson lifecycle — every injection is recorded; run outcomes feed back into each lesson's evidence (a Beta-Bernoulli model with time decay). A lesson is only kept if its pessimistic success estimate beats your agent's baseline. Helpful lessons get promoted, useless ones retire automatically.
  4. Zero-config, local-first — SQLite + local static embeddings. Nothing leaves your machine except the reflection call. No telemetry.

Core API

Call Purpose
Learner() Zero-config init. Learner(scope="checkout-agent", llm="anthropic:claude-haiku-4-5", ...) to customize.
nm.run(task=...) Context manager. Yields a Run; unhandled exceptions become failures.
run.lessons Recalled lessons for this task; str() renders the injectable prompt block. Recall through the run binds lessons for credit assignment.
run.log(messages) / run.log_tool_call(...) Best-effort trajectory capture.
run.end(success=..., error=..., score=...) Record the outcome; triggers reflection on failure.
nm.feedback(run_id, note, success=...) Delayed outcome ("user said this was wrong two hours later").
nm.lessons() / nm.forget(lesson_id) Audit and control what gets injected.
nm.stats() Baseline success rate, lesson counts by state, top/bottom lessons.

Every stage is swappable via small Protocols: Store, Embedder, LLMClient, OutcomeDetector, Reflector, Retriever, Injector.

Status

Early alpha — API may change before 0.2. See examples/ for a runnable demo where an agent measurably improves across episodes against an API with undocumented quirks.

License

Apache-2.0

Download files

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

Source Distribution

neuraminerl-0.1.0.tar.gz (41.0 kB view details)

Uploaded Source

Built Distribution

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

neuraminerl-0.1.0-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neuraminerl-0.1.0.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for neuraminerl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c740ed34c8b4f273cf412596b05aba15f7c81a1d741b4f55ad7b039d8538f28f
MD5 29727fd08c86f2a418d6d0028e4cf9aa
BLAKE2b-256 1b183fd0a9dab2e7c207889631efe14b2ea5ea47612268098ef614e4a36e842f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neuraminerl-0.1.0.tar.gz:

Publisher: publish.yml on ParthivDhameliya/NeuramineRL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: neuraminerl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for neuraminerl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 181d1e790cc2c1fab9c84b8fa62db21afe687c966f456b05cf2c96203db83c59
MD5 781beb4c8df0dcad6ad5b0029b404682
BLAKE2b-256 dadf014630ae14eae9e17d5ea41c85c4a8d0922511639831db6adb4be6d71dc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for neuraminerl-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ParthivDhameliya/NeuramineRL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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