Detection modes apply to SDK integration only. When using the Proxy, detection always runs on Avaliar’s cloud backend.
Local Detection
Local detection runs entirely on your infrastructure using theavaliar_eval package and your OpenAI API key. After a traced function returns, a background thread runs all configured detectors and then posts the complete trace (with detection results) to the Avaliar backend.
Requirements
pip install avaliar_eval— the local detection engine- The
OPENAI_API_KEYenvironment variable must be set in your runtime environment
How it works
- Your traced function executes and returns a result to the caller
- A background thread picks up the trace data (prompt + response)
- Detection runs locally using the
avaliar_evalpackage and your OpenAI API key - The complete trace — including detection results — is posted to Avaliar
Pros and cons
Pros:- Data stays on your infrastructure until the final trace post
- Fast feedback loop during development
- Full control over the detection pipeline
- Requires an OpenAI API key (additional cost)
- Uses your compute resources
- You manage the
avaliar_evaldependency and its updates
Best for
Development, testing, and environments where data cannot leave your infrastructure.Example
Cloud Detection
Cloud detection offloads all analysis to Avaliar’s backend infrastructure. The trace is posted immediately after the function returns, and a background worker on Avaliar’s servers runs detection asynchronously via a Redis queue.Requirements
- No additional API keys or infrastructure needed
- An active Avaliar API key with SDK scope (already required for tracing)
How it works
- Your traced function executes and returns a result to the caller
- The trace data (prompt + response) is posted to Avaliar immediately
- Avaliar queues the detection job for asynchronous processing
- A backend worker picks up the job, runs all detectors, and stores the results
Pros and cons
Pros:- No additional API keys needed
- No local compute overhead
- Always uses the latest detector versions automatically
- Simplest setup
- Content is sent to Avaliar’s backend for analysis
- Detection results are not immediately available (async processing)
Best for
Production deployments where you want minimal infrastructure overhead.Example
Comparison
| Local | Cloud | |
|---|---|---|
| Data location | Your infrastructure | Avaliar backend |
| Extra dependencies | avaliar_eval, OpenAI key | None |
| Compute cost | Your resources | Included in Avaliar plan |
| Detector updates | Manual package updates | Automatic |
| Setup complexity | Medium | Low |
| Recommended for | Development | Production |