ConsoleRenderer's built-in color + level_icons emoji across log levels and a failure
Framework integrations and concurrency
Script
Demonstrates
middleware_skip_if.py
RuntimeNarrativeMiddleware(skip_if=...) for FastAPI/Starlette
task_group.py
NarrativeTaskGroup — concurrent asyncio tasks under one story
fastapi_app/
Full FastAPI demo app (uv run python -m examples.fastapi_app.run)
fastapi_ugly_traceback_demo.py
The same deep async bug (route → orchestrator → retry-wrapped pricing engine → asyncio.gather fan-out → the actual TypeError), run once with no instrumentation and once with runtime-narrative — a raw ~35-frame traceback vs. one pinpointed line, source snippet, and locals
Testing and lifecycle utilities
Script
Demonstrates
story_recorder.py
StoryRecorder test assertion API
dry_run_mode.py
dry_run=True — verify wiring with no side effects
optional_stage.py
has_active_story() and stage(optional=True)
saga_record_failure.py
StoryRuntime.record_failure() in a saga/rollback flow
stage_story_name.py
story_name on StageStarted/StageCompleted
Start from the top
New to runtime-narrative? Head back to the homepage for the overview, or Installation to get the package into your project and start wrapping code in story().