lathe — SRE Investigation Bot
Internal SRE and bug-investigation bot. SREs invoke it from Slack (
@lathementions or DMs); a per-invocation Explorer coroutine runs an LLM-driven tool loop, accumulates structured Findings inside a polymorphic Artifact (BugReport), and replies in-thread.
flowchart LR
SLACK["Slack
@lathe mention"] --> API[lathe
FastAPI · Fargate]
API --> EXPLORER["Explorer
LLM tool loop"]
EXPLORER --> TOOLS["Tool set
repo / logs / alerts"]
EXPLORER --> ARTIFACT["Artifact
BugReport + Findings"]
API --> DB[(RDS Postgres
users · runs · artifacts)]
API --> SLACK
style API fill:#EDEDFF,stroke:#3B54F7
style EXPLORER fill:#F3EDFF,stroke:#8A54E8
Architecture (two patterns coexisting):
Pattern A — CRUD state:
SQLModelrows, FastAPI routes — Users, ApiTokens, Artifacts, Findings, Repos, RepoSnapshots.Pattern B′ — Background tasks with event-log persistence: async run coroutines (
lathe/runs/), tools (lathe/tools/), append-onlyinvestigation_eventlog for crash-survival replay/resume.Stack: Python 3.12+, FastAPI, asyncio, structlog, SQLModel + asyncpg + Alembic, pytest, uv.
Deployed on: AWS Fargate behind an ALB; persistence on RDS Postgres.
Built on: the ecs-service pattern.
Dev:
uv sync --extra dev→uv run ruff check+uv run mypy --strict lathe/+uv run pytest.