Error observability for the agent era
Project description
bastion
Error observability for the agent era.
What is Bastion?
Traditional error handling is designed for humans: stack traces printed to a terminal, logs scrolled through in a browser, exceptions caught and swallowed silently. Bastion is built on a different assumption — that the primary debugger is a coding agent, not a human. Every error record, checkpoint, and failed assertion is structured for easy ingestion by an agent's context window, not a human's eyes.
Bastion sits at the boundary between your code and the agent working on it. It captures the information an agent needs to diagnose a failure — exception type, location, local variables — and makes it retrievable without manual log trawling. The goal is to shrink the feedback loop between a bug occurring and an agent understanding it.
Installation
pip install bastion
Quick start
import bastion
# Initialize at the entry point of your application or agent session.
bastion.init()
# Wrap any function — errors are captured and structured automatically.
@bastion.guard(context=["user_id", "payload"])
def process(user_id: str, payload: dict) -> dict:
if not payload:
raise ValueError("empty payload")
return {"ok": True}
# Mark progress through a multi-step flow.
bastion.checkpoint("ingest", "parse-complete", data={"rows": 42})
# Assert invariants in a way an agent can query later.
bastion.expect(len(results) > 0, "search must return results", context={"query": query})
Coming soon
- SQLite persistence — every error, checkpoint, and expectation stored locally and queryable
- MCP server — expose Bastion data to any MCP-compatible agent via structured tools
- Local variable capture —
context=onguard()will snapshot named variables at the point of failure - Error fingerprinting — stable IDs for recurring errors so agents can track frequency over time
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bastion_agent-0.1.0.tar.gz.
File metadata
- Download URL: bastion_agent-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59a4a1f26cd285de3327d9f2289b39d73d7ed9c889f3823618ef09e0cf981a1d
|
|
| MD5 |
6ed512e64ac39d80086a5a424bfab35a
|
|
| BLAKE2b-256 |
cd251c9148a5849d41311d8efee3ed32f67e242883184d86bb5df17619f991ab
|
File details
Details for the file bastion_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bastion_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b5ca62b3cab45a127809d0f1c389604681b12275ca747af664c2b59e77c879
|
|
| MD5 |
f9c2759336d36cb73de88759315b9c87
|
|
| BLAKE2b-256 |
60af2f655d7fb41548c2dd5df7fc8dcbcf1a6e1f79cbe43e21dc53f33345f8fc
|