Runtime monitoring plugin for fasteval with async sampling and structured logging
Project description
fasteval-observe
Runtime monitoring plugin for fasteval with async sampling and structured logging.
Installation
pip install fasteval-core fasteval-observe
Quick Start
import fasteval as fe
from fasteval_observe import observe
from fasteval_observe.sampling import FixedRateSamplingStrategy
# Monitor 5% of agent calls with structured logging
@observe(sampling=FixedRateSamplingStrategy(rate=0.05))
async def my_agent(query: str) -> str:
response = await llm.invoke(query)
return response
# Combine with fasteval evaluation metrics
@observe(
sampling=FixedRateSamplingStrategy(rate=0.05),
run_evaluations=True # Run @fe.* metrics in background
)
@fe.correctness(threshold=0.8)
async def evaluated_agent(query: str) -> str:
response = await llm.invoke(query)
return response
Sampling Strategies
Built-in Strategies
- NoSamplingStrategy - Sample every call (development/debugging)
- FixedRateSamplingStrategy - Fixed rate sampling (e.g., 1 in N calls)
- ProbabilisticSamplingStrategy - Random probability-based sampling
- AdaptiveSamplingStrategy - Adjust rate based on latency/errors
- TokenBudgetSamplingStrategy - Sample based on token cost
- ComposableSamplingStrategy - Combine multiple strategies
Custom Strategies
from fasteval_observe.sampling import BaseSamplingStrategy
class MyCustomStrategy(BaseSamplingStrategy):
def should_sample(self, function_name, args, kwargs, context):
# Custom logic
return True
@observe(sampling=MyCustomStrategy())
async def my_agent(query: str) -> str:
return await process(query)
Configuration
from fasteval_observe import configure_observe, ObserveConfig, set_logger
import logging
configure_observe(ObserveConfig(
enabled=True,
flush_interval_seconds=5.0,
max_queue_size=10000,
include_inputs=False, # Privacy: don't log inputs
include_outputs=False,
))
# Optional: Use custom logger for file output, cloud logging, etc.
my_logger = logging.getLogger("my_app.observations")
my_logger.addHandler(logging.FileHandler("/var/log/observations.jsonl"))
set_logger(my_logger)
Structured Logging
Observations are logged as JSON for easy collection by Kubernetes sidecars, Fluentd, etc:
{
"timestamp": "2026-02-03T10:15:30.123Z",
"source": "fasteval_observe",
"function_name": "my_agent",
"execution_time_ms": 1234.56,
"sampling_strategy": "FixedRateSamplingStrategy",
"metrics": {
"latency_ms": 1234.56,
"success": true
}
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fasteval_observe-2.1.3.tar.gz.
File metadata
- Download URL: fasteval_observe-2.1.3.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68e6e8b512df18a190c67f02c35bb6bf37aed03ecf3f6787fa04d371dc103666
|
|
| MD5 |
e2714f04bb57b184af58e4dcfe537410
|
|
| BLAKE2b-256 |
42d3fb5acde5dacb90bbd7f0a06343390b6bf314e2f0ecc716228cc5d7e093d9
|
Provenance
The following attestation bundles were made for fasteval_observe-2.1.3.tar.gz:
Publisher:
release.yml on intuit/fasteval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fasteval_observe-2.1.3.tar.gz -
Subject digest:
68e6e8b512df18a190c67f02c35bb6bf37aed03ecf3f6787fa04d371dc103666 - Sigstore transparency entry: 1146420971
- Sigstore integration time:
-
Permalink:
intuit/fasteval@61528a5c55d62f63811de6e108e893835de6a976 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@61528a5c55d62f63811de6e108e893835de6a976 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file fasteval_observe-2.1.3-py3-none-any.whl.
File metadata
- Download URL: fasteval_observe-2.1.3-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2fe4d7802c66a32cbc93342f265603b05459d7ad5fb9aaf87a3e36c2318e701
|
|
| MD5 |
f4a725c67c3002d6d3956c05a95063fc
|
|
| BLAKE2b-256 |
149872390aed78715a9636986981f33b113a96f96a07ad7eaa8d738a2b23be81
|
Provenance
The following attestation bundles were made for fasteval_observe-2.1.3-py3-none-any.whl:
Publisher:
release.yml on intuit/fasteval
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fasteval_observe-2.1.3-py3-none-any.whl -
Subject digest:
f2fe4d7802c66a32cbc93342f265603b05459d7ad5fb9aaf87a3e36c2318e701 - Sigstore transparency entry: 1146421049
- Sigstore integration time:
-
Permalink:
intuit/fasteval@61528a5c55d62f63811de6e108e893835de6a976 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/intuit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@61528a5c55d62f63811de6e108e893835de6a976 -
Trigger Event:
pull_request
-
Statement type: