Generated from the local repository state on 2026-05-14.
Intended as a shareable technical briefing for another model or engineer reviewing the project.
Siphyy is an open-source Python framework for fleet telematics analytics, centered on a two-tier pipeline:
The current implementation is focused on one end-to-end use case:
fuel anomaly / siphonage detection. The repo now contains a working reference adapter
(TrakzeeAdapter), a working Tier 1 detector (FuelSiphonageDetector), a working Tier 2
agent (FuelAnomalyAgent), pluggable OpenAI and Anthropic clients, test coverage, and a hosted
Streamlit demo that visualizes the pipeline and shows the exact LLM prompts used.
Fleet telematics providers all expose different payloads, field names, units, and data quality. Siphyy exists to provide a provider-agnostic analytics framework where:
The current value proposition is strongest in three areas:
| Path | Purpose |
|---|---|
src/siphyy/schema/ |
Canonical event models, interesting-event models, case-base models. |
src/siphyy/adapters/ |
Provider-specific translation into canonical events. Currently includes the Trakzee reference adapter. |
src/siphyy/detectors/ |
Tier 1 deterministic detection layer and state-store abstraction. |
src/siphyy/agents/ |
Tier 2 LLM agent layer plus provider-specific LLM client implementations. |
src/siphyy/knowledge/ |
Seed incident cases used to ground the agent. |
examples/ |
CLI-style quickstarts and small demos of the framework pipeline. |
apps/demo/ |
Streamlit demo app for interactive uploads and step-by-step visualization. |
tests/ |
Unit and integration tests for schemas, adapter, detector, agent, and LLM clients. |
.github/workflows/ |
CI workflow and HuggingFace Spaces deployment workflow for the demo. |
[Provider rows / export]
↓
TrakzeeAdapter.adapt()
↓
Canonical TelemetryReading events
↓
FuelSiphonageDetector.process(event)
↓
InterestingEvent(category="fuel_drop")
↓
FuelAnomalyAgent.process(interesting_event)
↓
LLMClient.complete(system, user, response_model)
↓
Validated FuelAnomalyReport
TelemetryReading.InterestingEvent with evidence attached.FuelAnomalyReport.The canonical schema is the core contract of the framework. It ensures everything after the adapter layer reasons over normalized types instead of provider-specific shapes.
BaseEvent carries common metadata:
schema_versionvehicle_idtimestamp in UTCproviderprovider_event_idprovider_extras for traceability
TelemetryReading is the dominant canonical event type for polling-style providers such as Trakzee.
It contains:
fuel_level_percent, fuel_level_liters, fuel_level_raw,
fuel_sensor_type, tank_capacity_liters,ambient_temperature_c,pitch_deg, roll_deg,location_text, poi_text.
The most important architectural improvement in the current codebase is that fuel sensing is now
promoted into first-class canonical fields. Earlier designs left BLE fuel data buried in
provider_extras, which made provider-agnostic detection impossible. The current schema resolves that.
DriverEvent is the canonical discrete-event model for harsh braking, acceleration, turning, speeding,
and ignition/idling transitions. It is structurally ready for future detectors even though the current
feature path focuses on fuel anomalies.
InterestingEvent is the handoff contract between Tier 1 and Tier 2. Its design is intentionally small:
detector_namevehicle_idtimestampcategory (currently fuel_drop)severitysummaryconfidenceevidence as detector-specific free-form detailtriggering_event_idThis is a good separation point. The detector does not try to become an incident report; it only emits enough structured evidence for the agent to reason on.
IncidentCase stores historical cases with symptoms, diagnosis, resolution, lessons, tags, region,
and confidence. CaseBase is currently an in-memory store with simple category/region filtering and
a placeholder embedding store. It is explicitly shaped so a future vector backend can preserve the same
interface.
Every telematics provider should be normalized behind the abstract TelematicsAdapter contract.
The contract is intentionally narrow: one adapt(raw) method that yields canonical events.
TrakzeeAdapter is the reference implementation and currently the main production-grade adapter in the repo.
It performs:
running / idle / stopped,Fuel column,fuel_level_raw,provider_extras.Important nuance: Trakzee BLE fuel readings are treated as raw counts, not calibrated liters or percentages. The adapter intentionally refuses to fabricate calibrated values without per-vehicle calibration. That is the correct architectural decision.
provider_event_id is synthesized as imei:timestamp_seconds, which can collide if multiple rows land in the same second.
Detector is the base class for all Tier 1 rule-based logic. It depends on a StateStore
protocol so detector state is decoupled from the storage backend. The default InMemoryStateStore is
fine for tests and single-process demos, while a Redis-backed store can be added later without changing detector logic.
The current detector implements a simple, explicit rule:
fuel_level_raw,stopped or idle,max_minutes,threshold_pct.The emitted evidence includes:
This is a strong design choice for real-world telematics. Many fleets do not have well-calibrated liters or percentages, especially when they retrofit BLE fuel probes. Using relative drop in raw counts allows the detector to function with lower-quality upstream data while still surfacing plausible siphonage candidates.
The detector is intentionally recall-oriented. It does not try to fully rule out thermal contraction, slope settling, or other edge cases inside Tier 1. Instead, it sends compact evidence to Tier 2, where the agent can compare against historical cases. This separation of responsibilities is coherent.
The LLMClient protocol is the primary abstraction that keeps agent logic independent of model vendors.
A client only needs one method:
complete(system: str, user: str, response_model: type[T]) -> T
That is a strong architectural boundary. Agent code does not need to know whether the provider is OpenAI, Anthropic, Gemini, Ollama, vLLM, or something else.
FuelAnomalyAgent is the concrete Tier 2 implementation for fuel_drop events.
It works as follows:
fuel_drop,max_cases from the case base,LLMClient,FuelAnomalyReport.
The system prompt is focused and conservative: it instructs the model to classify into one of
likely_siphonage, likely_false_positive, or uncertain; cite case IDs;
and prefer uncertainty over overconfident mistakes.
The user prompt contains:
The report is intentionally denormalized and frozen. It stores:
The OpenAI client uses structured outputs via the OpenAI SDK parse path. The agent asks for a concrete Pydantic model and receives a validated instance back. That avoids JSON extraction hacks and is the cleanest provider implementation in the repo.
The Anthropic client uses forced tool-use rather than a native structured-output parse endpoint. It generates the JSON schema from the requested Pydantic model, defines a tool with that schema, forces the model to call it, and validates the returned tool payload.
The mock client is not just a test convenience; it is also a product-enablement tool. It makes the quickstart and the Streamlit demo fully runnable without API keys and without external LLM spend.
The seed knowledge pack is an important part of the current design. It includes both confirmed theft cases and false-positive cases, which is exactly what a good Tier 2 reasoning layer needs.
The cases cover patterns such as:
This layer is currently synthetic and in-memory, but it already shapes the language and output style used by the agent.
The repository already contains the kind of visual interface you described: a Streamlit app in
apps/demo/app.py that lets a user upload a small Trakzee-shaped sample file or use bundled sample data.
.json and .xlsx inputs,This is directly aligned with the intuition-building webpage concept: the demo makes the “black box” visible, especially the precise prompts and the case retrieval step.
The demo is packaged for HuggingFace Spaces using Docker. The repo includes:
apps/demo to a HuggingFace Space on pushes to main.The current test suite is materially better than an early-stage scaffold. It covers:
The project targets Python 3.14 and is packaged with Hatchling. Optional extras exist for provider- or
environment-specific capabilities such as trakzee, llm, demo, and
now docs. Dev tooling is available both as a pip extra and as a uv dependency group.
The CI workflow currently runs:
The repo also has a separate GitHub Actions workflow that auto-deploys the demo app to HuggingFace Spaces
by syncing the apps/demo directory into the target Space repo.
CaseBase interface.If another model such as Claude is reviewing this codebase, the most important mental model is:
The code should not be interpreted as a generic “LLM wrapper for fleet data.” It is a deliberately staged analytics system that tries to keep deterministic signal extraction and probabilistic interpretation separate. That separation is the central architectural idea of the repo.
Siphyy is currently a credible alpha framework for fuel anomaly analysis in fleet telematics. Its strongest technical decisions are:
Its biggest remaining gaps are not conceptual confusion but missing production subsystems: durable storage, richer retrieval, more upstream business context, more adapters, and a more complete service surface.
Source basis for this report: repository code in src/siphyy/, apps/demo/,
examples/, tests/, and GitHub workflow definitions present in the workspace on
2026-05-14.