# data-gras/savi-sdk architecture

> Architecture diagram of the GitHub repository data-gras/savi-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/data-gras/savi-sdk
- Repository: https://github.com/data-gras/savi-sdk

## Overview

SAVI is a Python observability SDK that wraps LLM provider calls, measures completed responses, and reports telemetry either locally or to its SaaS backend. The main workflow is application → provider wrapper → model provider; the wrapper derives PII signals and a fingerprint, then emits usage and latency telemetry. The tree and README also identify auto-instrumentation, MCP instrumentation, tracing context, caching, and judging capabilities. Sampled excerpts are partial, so links for unsampled subsystems are limited to documented capabilities and clear module boundaries.

Main entry points: [`savi/collector.py`](https://github.com/data-gras/savi-sdk/blob/main/savi/collector.py) (Telemetry Collector), [`savi/pii.py`](https://github.com/data-gras/savi-sdk/blob/main/savi/pii.py) (PII And Fingerprint), [`savi/anthropic.py`](https://github.com/data-gras/savi-sdk/blob/main/savi/anthropic.py) (Anthropic Wrapper), [`savi/bedrock.py`](https://github.com/data-gras/savi-sdk/blob/main/savi/bedrock.py) (Bedrock Wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_providers["Provider Wrappers"]
  node_openai["OpenAI Wrapper<br/>[openai.py]"]
  node_anthropic["Anthropic Wrapper<br/>[anthropic.py]"]
  node_azure["Azure Wrapper<br/>[azure_openai.py]"]
  node_vertex["Vertex Wrapper<br/>[google_vertex.py]"]
  node_bedrock["Bedrock Wrapper<br/>[bedrock.py]"]
  node_cohere["Cohere Wrapper<br/>[cohere.py]"]
  node_mistral["Mistral Wrapper<br/>[mistral.py]"]
end

subgraph group_telemetry["Telemetry Processing"]
  node_pii["PII And Fingerprint<br/>[pii.py]"]
  node_collector["Telemetry Collector<br/>[collector.py]"]
  node_local["Local Emitter<br/>[local.py]"]
end

subgraph group_integrations["Instrumentation"]
  node_auto_instrument["Auto Instrumentation<br/>[auto_instrument.py]"]
  node_mcp_instrument["MCP Instrumentation<br/>[mcp_instrument.py]"]
  node_judge["LLM Judge<br/>[judge.py]"]
end

subgraph group_runtime["Runtime Services"]
  node_cache["Response Cache<br/>[cache.py]"]
  node_context["Trace Context<br/>[context.py]"]
end

node_application(("Application"))
node_provider_services(("LLM Providers"))
node_savi_service(("SAVI Backend"))
node_terminal(("Terminal Output"))

node_application -->|"calls"| node_openai
node_application -->|"calls"| node_anthropic
node_application -->|"calls"| node_azure
node_application -->|"calls"| node_vertex
node_application -->|"calls"| node_bedrock
node_application -->|"calls"| node_cohere
node_application -->|"calls"| node_mistral
node_openai -->|"requests"| node_provider_services
node_anthropic -->|"requests"| node_provider_services
node_azure -->|"requests"| node_provider_services
node_vertex -->|"requests"| node_provider_services
node_bedrock -->|"requests"| node_provider_services
node_cohere -->|"requests"| node_provider_services
node_mistral -->|"requests"| node_provider_services
node_openai -->|"masks, fingerprints"| node_pii
node_anthropic -->|"masks, fingerprints"| node_pii
node_azure -->|"masks, fingerprints"| node_pii
node_vertex -->|"masks, fingerprints"| node_pii
node_bedrock -->|"masks, fingerprints"| node_pii
node_cohere -->|"masks, fingerprints"| node_pii
node_mistral -->|"masks, fingerprints"| node_pii
node_openai -->|"emits telemetry"| node_collector
node_anthropic -->|"emits telemetry"| node_collector
node_azure -->|"emits telemetry"| node_collector
node_vertex -->|"emits telemetry"| node_collector
node_bedrock -->|"emits telemetry"| node_collector
node_cohere -->|"emits telemetry"| node_collector
node_mistral -->|"emits telemetry"| node_collector
node_collector -->|"sends batches"| node_savi_service
node_collector -->|"writes locally"| node_terminal
node_openai -->|"reads and writes"| node_cache
node_anthropic -->|"reads and writes"| node_cache
node_azure -->|"reads and writes"| node_cache
node_vertex -->|"reads and writes"| node_cache
node_bedrock -->|"reads and writes"| node_cache
node_cohere -->|"reads and writes"| node_cache
node_mistral -->|"reads and writes"| node_cache
node_anthropic -->|"reads attribution"| node_context
node_bedrock -->|"reads attribution"| node_context
node_cohere -->|"reads attribution"| node_context
node_mistral -->|"reads attribution"| node_context
node_auto_instrument -->|"emits telemetry"| node_collector
node_auto_instrument -->|"fingerprints prompts"| node_pii
node_mcp_instrument -.->|"instruments MCP"| node_collector
node_judge -.->|"evaluates models"| node_provider_services

click node_openai "https://github.com/data-gras/savi-sdk/blob/main/savi/openai.py"
click node_anthropic "https://github.com/data-gras/savi-sdk/blob/main/savi/anthropic.py"
click node_azure "https://github.com/data-gras/savi-sdk/blob/main/savi/azure_openai.py"
click node_vertex "https://github.com/data-gras/savi-sdk/blob/main/savi/google_vertex.py"
click node_bedrock "https://github.com/data-gras/savi-sdk/blob/main/savi/bedrock.py"
click node_cohere "https://github.com/data-gras/savi-sdk/blob/main/savi/cohere.py"
click node_mistral "https://github.com/data-gras/savi-sdk/blob/main/savi/mistral.py"
click node_pii "https://github.com/data-gras/savi-sdk/blob/main/savi/pii.py"
click node_collector "https://github.com/data-gras/savi-sdk/blob/main/savi/collector.py"
click node_local "https://github.com/data-gras/savi-sdk/blob/main/savi/local.py"
click node_cache "https://github.com/data-gras/savi-sdk/blob/main/savi/cache.py"
click node_context "https://github.com/data-gras/savi-sdk/blob/main/savi/context.py"
click node_auto_instrument "https://github.com/data-gras/savi-sdk/blob/main/savi/auto_instrument.py"
click node_mcp_instrument "https://github.com/data-gras/savi-sdk/blob/main/savi/mcp_instrument.py"
click node_judge "https://github.com/data-gras/savi-sdk/blob/main/savi/judge.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_openai,node_anthropic,node_azure,node_vertex,node_bedrock,node_cohere,node_mistral toneBlue
class node_pii,node_collector,node_local toneAmber
class node_auto_instrument,node_mcp_instrument,node_judge toneMint
class node_cache,node_context toneRose
class node_application,node_provider_services,node_savi_service,node_terminal toneIndigo
```

## Components

### Provider Wrappers

- [OpenAI Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/openai.py): `savi/openai.py`
- [Anthropic Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/anthropic.py): `savi/anthropic.py`
- [Azure Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/azure_openai.py): `savi/azure_openai.py`
- [Vertex Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/google_vertex.py): `savi/google_vertex.py`
- [Bedrock Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/bedrock.py): `savi/bedrock.py`
- [Cohere Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/cohere.py): `savi/cohere.py`
- [Mistral Wrapper](https://github.com/data-gras/savi-sdk/blob/main/savi/mistral.py): `savi/mistral.py`

### Telemetry Processing

- [PII And Fingerprint](https://github.com/data-gras/savi-sdk/blob/main/savi/pii.py): `savi/pii.py`
- [Telemetry Collector](https://github.com/data-gras/savi-sdk/blob/main/savi/collector.py): `savi/collector.py`
- [Local Emitter](https://github.com/data-gras/savi-sdk/blob/main/savi/local.py): `savi/local.py`

### Instrumentation

- [Auto Instrumentation](https://github.com/data-gras/savi-sdk/blob/main/savi/auto_instrument.py): `savi/auto_instrument.py`
- [MCP Instrumentation](https://github.com/data-gras/savi-sdk/blob/main/savi/mcp_instrument.py): `savi/mcp_instrument.py`
- [LLM Judge](https://github.com/data-gras/savi-sdk/blob/main/savi/judge.py): `savi/judge.py`

### Runtime Services

- [Response Cache](https://github.com/data-gras/savi-sdk/blob/main/savi/cache.py): `savi/cache.py`
- [Trace Context](https://github.com/data-gras/savi-sdk/blob/main/savi/context.py): `savi/context.py`

### Other components

- **Application**
- **LLM Providers**
- **SAVI Backend**
- **Terminal Output**

## Connections

- Application → OpenAI Wrapper: calls
- Application → Anthropic Wrapper: calls
- Application → Azure Wrapper: calls
- Application → Vertex Wrapper: calls
- Application → Bedrock Wrapper: calls
- Application → Cohere Wrapper: calls
- Application → Mistral Wrapper: calls
- OpenAI Wrapper → LLM Providers: requests
- Anthropic Wrapper → LLM Providers: requests
- Azure Wrapper → LLM Providers: requests
- Vertex Wrapper → LLM Providers: requests
- Bedrock Wrapper → LLM Providers: requests
- Cohere Wrapper → LLM Providers: requests
- Mistral Wrapper → LLM Providers: requests
- OpenAI Wrapper → PII And Fingerprint: masks, fingerprints
- Anthropic Wrapper → PII And Fingerprint: masks, fingerprints
- Azure Wrapper → PII And Fingerprint: masks, fingerprints
- Vertex Wrapper → PII And Fingerprint: masks, fingerprints
- Bedrock Wrapper → PII And Fingerprint: masks, fingerprints
- Cohere Wrapper → PII And Fingerprint: masks, fingerprints
- Mistral Wrapper → PII And Fingerprint: masks, fingerprints
- OpenAI Wrapper → Telemetry Collector: emits telemetry
- Anthropic Wrapper → Telemetry Collector: emits telemetry
- Azure Wrapper → Telemetry Collector: emits telemetry
- Vertex Wrapper → Telemetry Collector: emits telemetry
- Bedrock Wrapper → Telemetry Collector: emits telemetry
- Cohere Wrapper → Telemetry Collector: emits telemetry
- Mistral Wrapper → Telemetry Collector: emits telemetry
- Telemetry Collector → SAVI Backend: sends batches
- Telemetry Collector → Terminal Output: writes locally
- OpenAI Wrapper → Response Cache: reads and writes
- Anthropic Wrapper → Response Cache: reads and writes
- Azure Wrapper → Response Cache: reads and writes
- Vertex Wrapper → Response Cache: reads and writes
- Bedrock Wrapper → Response Cache: reads and writes
- Cohere Wrapper → Response Cache: reads and writes
- Mistral Wrapper → Response Cache: reads and writes
- Anthropic Wrapper → Trace Context: reads attribution
- Bedrock Wrapper → Trace Context: reads attribution
- Cohere Wrapper → Trace Context: reads attribution
- Mistral Wrapper → Trace Context: reads attribution
- Auto Instrumentation → Telemetry Collector: emits telemetry
- Auto Instrumentation → PII And Fingerprint: fingerprints prompts
- MCP Instrumentation → Telemetry Collector: instruments MCP
- LLM Judge → LLM Providers: evaluates models
