Failure Pattern Memory
Learn from AI agent failures. Record patterns, get pre-emptive warnings.
The Problem
Agent systems usually handle errors reactively. An agent hits an error, retries or a human fixes it, and the lesson is lost. The next run or the next agent repeats the same mistake. Multi-agent setups make this worse, because one agent's bad output can spread to the others.
What It Does
- Records failures: a raw error log is classified by an LLM (Groq) into category, description, root cause, prevention, and severity.
- Stores patterns: records go into SQLite, with the context pattern embedded and indexed by sqlite-vec for vector search. No separate database server is needed.
- Warns before a task: a new task description is matched against stored patterns, and similar past failures come back with prevention advice.
- Shows results: a CLI, a REST API, and a generated HTML dashboard.
Project Layout
fpm/ core package (models, storage, classifier, engine, cli)
api.py FastAPI server
dashboard.py builds dashboard.html from the failure database
demo.py sample run
tests/ offline tests (no API key, no model download)
Quick Start (Windows PowerShell)
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
pip install -e .
copy .env.example .env # then put your GROQ_API_KEY in .env
python demo.py
python dashboard.py demo.db
start dashboard.html
Linux / macOS: use python3 -m venv venv, source venv/bin/activate, and cp .env.example .env.
Usage
fpm record "ModuleNotFoundError: No module named 'requests'" --task script_run
fpm check "run python script that imports requests"
fpm history
uvicorn api:app --reload # then open http://127.0.0.1:8000/docs
Tests
Tests run offline with a fake classifier and embedder:
pytest -q
Sample Test
Requirements
- Python 3.10+
- A Python build whose
sqlite3supports loadable extensions (python.org and conda builds do) - A Groq API key for
demo.py,fpm record, and the API's record endpoint
Limitations
- The
resolutionfield is stored as "pending". Recording how a failure was fixed would make warnings more useful. - Classification quality depends on the LLM. Review records before relying on them.
- Similarity uses a general sentence embedding, so the threshold may need tuning on real logs.
Metadata
Release files for failure-pattern-memory 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 | |
|---|---|---|---|---|
| failure_pattern_memory-0.1.0.tar.gz | 9.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| failure_pattern_memory-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / failure_pattern_memory-0.1.0.tar.gz
| Download URL | failure_pattern_memory-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5baf1f89a88980e57664af40f956974221791b64cdf6c6bb85ca8935e9a33c1c
|
|
BLAKE2b-256 checksum How to use checksums |
aa358b458e62e6261ce7cbd8987d60da66764a74e35c30de41d553247b02880b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / failure_pattern_memory-0.1.0-py3-none-any.whl
| Download URL | failure_pattern_memory-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
029a75dcdc54c3ae4d35ec3dd982bcb7cc24bfc7784d7c68e527f4d30ee54701
|
|
BLAKE2b-256 checksum How to use checksums |
b2d9c1e72409b27591ff144e9b6be7079264a91b67eb3890464b6ebb677ec1cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Security for failure-pattern-memory 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.