openfossil
Python SDK for FOSSIL — semantic failure memory for AI agents.
Install
# with local embedder (recommended, no API key needed)
pip install openfossil[local]
# core only — bring your own embedder or use remote API
pip install openfossil
# with OpenAI embedder
pip install openfossil[openai]
Quickstart
from fossil import Fossil, FailureType, ResolutionType, Severity, TaskDomain
# local SQLite store — zero config
fossil = Fossil()
# point at the live community API
fossil = Fossil(api_url="https://fossil-api.hello-76a.workers.dev")
# record a failure after it happens
fossil.record(
situation="agent extracting JSON from LLM output that returned markdown-fenced text",
failure_type=FailureType.FORMAT_FAILURE,
failure="json.loads() raised JSONDecodeError — model wrapped output in ```json fences",
severity=Severity.MAJOR,
resolution_type=ResolutionType.INPUT_SANITIZATION,
resolution="strip markdown fences with regex before parsing",
framework="langchain",
model="llama-3.3-70b-versatile",
domain=TaskDomain.DATA_ANALYSIS,
verified=True,
)
# search before a task step
results = fossil.search("parsing structured data from LLM text output")
for record, score in results:
print(f"{score:.2f} — {record.resolution.description}")
CLI
# record a failure interactively
fossil record
# search for similar past failures
fossil search "JSON parsing failure"
# search against the live API
fossil search "JSON parsing failure" --api-url https://fossil-api.hello-76a.workers.dev
# list recent fossils
fossil list
# check connection
fossil ping
Inject into agent context
from fossil import Fossil, format_for_injection
fossil = Fossil()
def run_step(task: str, system_prompt: str) -> str:
results = fossil.search(task, top_k=3, min_score=0.5)
fossil_context = format_for_injection(results)
augmented_prompt = system_prompt + "\n\n" + fossil_context
# pass augmented_prompt to your LLM call
...
format_for_injection returns a string you drop directly into any system prompt or context window. No framework lock-in.
Remote store
from fossil import Fossil
fossil = Fossil(api_url="https://fossil-api.hello-76a.workers.dev")
fossil.record(...)
results = fossil.search(...)
No local embedder needed when using the remote store — embeddings run on the API side.
Custom embedder
from fossil import Fossil
from fossil.embedder import OpenAIEmbedder
embedder = OpenAIEmbedder(model_name="text-embedding-3-small", api_key="sk-...")
fossil = Fossil(embedder=embedder)
Custom store location
fossil = Fossil(db_path="/path/to/my/fossil.db")
Context manager
with Fossil() as fossil:
fossil.record(...)
results = fossil.search(...)
SDK API
| Method | Description |
|---|---|
fossil.record(...) |
Record a failure + resolution |
fossil.search(situation, top_k, min_score, domain) |
Semantic similarity search |
fossil.get(id) |
Fetch a single record |
fossil.delete(id) |
Delete a record |
fossil.list(limit, offset) |
Paginate all records |
fossil.count() |
Total records in store |
Failure types
misinterpretation hallucinated_tool format_failure context_loss
infinite_loop premature_termination scope_creep ambiguity_paralysis
tool_misuse adversarial_input compounding_error
Resolution types
prompt_change tool_fix retry human_override context_injection
schema_correction step_decomposition input_sanitization
Running tests
cd packages/sdk-python
pip install -e ".[dev,local]"
pytest
First run downloads the embedding model (~80MB, cached after that).
Metadata
Release files for openfossil 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openfossil-0.1.8.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openfossil-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.0 kB
Release files / openfossil-0.1.8.tar.gz
| Download URL | openfossil-0.1.8.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a2e72e25a2444dfddebe1ee7fbaccd201748a2246f07fb18f40167d2aa8a6ab
|
|
BLAKE2b-256 checksum How to use checksums |
562957331fb38b339610ea59815828e56960cfbbb75b4d8b83ea74be7a525291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / openfossil-0.1.8-py3-none-any.whl
| Download URL | openfossil-0.1.8-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
902d0272a908159e729a4d6d0ca501889fc365e7c1b1894eb5f61a27eafa2fc6
|
|
BLAKE2b-256 checksum How to use checksums |
10a04cd30a36a8771f96e6dc7b56df86f20ccf0032b30c2f5f791c32b3c63123
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|