honeyhive.config.models
Domain-specific configuration models for HoneyHive SDK.
This package provides Pydantic models for different domains within the SDK to reduce constructor argument count while maintaining backwards compatibility.
The hybrid approach allows both old and new usage patterns:
Tracer Configuration
Old Usage (Backwards Compatible): >>> tracer = HoneyHiveTracer(api_key="...", project="...", verbose=True)
New Usage (Recommended): >>> from honeyhive.config.models import TracerConfig >>> config = TracerConfig(api_key="...", project="...", verbose=True) >>> tracer = HoneyHiveTracer(config=config)
API Client Configuration (Future)
Old Usage (Current): >>> client = HoneyHive(bearer_auth="...", server_url="...", timeout_ms=30000)
New Usage (Future): >>> from honeyhive.config.models import APIClientConfig >>> config = APIClientConfig(api_key="...", server_url="...", timeout=30.0) >>> client = HoneyHive(config=config)
Architecture
The models are organized by domain: - base.py: BaseHoneyHiveConfig with common fields (api_key, project, etc.) - tracer.py: TracerConfig, SessionConfig, EvaluationConfig - api_client.py: APIClientConfig for API client initialization
All models inherit from BaseHoneyHiveConfig to avoid field duplication while maintaining type safety and validation consistency.
APIClientConfig
Bases: BaseHoneyHiveConfig, ServerURLMixin
Configuration for HoneyHive API client.
This class defines configuration parameters for API client initialization to reduce argument count while maintaining backwards compatibility. It inherits common fields from BaseHoneyHiveConfig and composes HTTPClientConfig for transport-level settings.
Inherited Fields
- api_key: HoneyHive API key for authentication
- project: Deprecated; accepted for backwards compatibility but ignored (project is inferred from the API key by the backend)
- test_mode: Enable test mode (no data sent to backend)
- verbose: Enable verbose logging output
API Client-Specific Fields
- server_url: Server URL for requests (from HH_API_URL env var)
- http_config: HTTP transport configuration
Example
Simple usage
config = APIClientConfig( ... api_key="hh_1234567890abcdef", ... server_url="https://api.dp1.us.honeyhive.ai" ... )
Advanced usage with HTTP config
http_config = HTTPClientConfig(timeout=60.0, max_connections=50) config = APIClientConfig( ... api_key="hh_1234567890abcdef", ... server_url="https://api.dp1.us.honeyhive.ai", ... http_config=http_config ... )
Future usage:
client = HoneyHive(config=config)
Current backwards compatible usage:
client = HoneyHive( ... bearer_auth="hh_1234567890abcdef", ... server_url="https://api.dp1.us.honeyhive.ai", ... timeout_ms=30000 ... )
Source code in src/honeyhive/config/models/api_client.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
http_config
class-attribute
instance-attribute
http_config: HTTPClientConfig = Field(
default_factory=HTTPClientConfig,
description="HTTP transport configuration",
)
BaseHoneyHiveConfig
Bases: BaseSettings
Base configuration model with common HoneyHive fields.
This base class contains fields that are commonly used across different parts of the SDK (tracer, API client, evaluation, etc.) to avoid duplication and ensure consistent validation.
Common Fields
- api_key: HoneyHive API key for authentication
- project: Deprecated project name (optional; backend infers scope from API key)
- test_mode: Enable test mode (no data sent to backend)
- verbose: Enable verbose logging
Example
This class is not used directly but inherited by domain-specific configs:
class TracerConfig(BaseHoneyHiveConfig): ... session_name: Optional[str] = None ... source: str = "dev"
config = TracerConfig(api_key="hh_...", project="my-project") print(config.api_key) # Inherited from base hh_...
Source code in src/honeyhive/config/models/base.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
api_key
class-attribute
instance-attribute
api_key: Optional[str] = Field(
default=None,
description="HoneyHive API key for authentication",
validation_alias=AliasChoices("HH_API_KEY", "api_key"),
examples=["hh_1234567890abcdef"],
)
project
class-attribute
instance-attribute
project: Optional[str] = Field(
default=None,
description="Deprecated. Legacy project name accepted for backwards compatibility but no longer used — the backend infers project context from the API key. Will be removed in v2.0.",
validation_alias=AliasChoices("HH_PROJECT", "project"),
examples=["my-llm-project", "chatbot-v2"],
)
test_mode
class-attribute
instance-attribute
test_mode: bool = Field(
default=False,
description="Enable test mode (no data sent to backend)",
validation_alias=AliasChoices(
"HH_TEST_MODE", "test_mode"
),
)
verbose
class-attribute
instance-attribute
verbose: bool = Field(
default=False,
description="Enable verbose logging output and debug mode",
validation_alias=AliasChoices("HH_VERBOSE", "verbose"),
)
validate_api_key
classmethod
Validate API key format with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The API key value to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated and normalized API key, or None if invalid |
Source code in src/honeyhive/config/models/base.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
validate_project
classmethod
Validate project name format with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The project name to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated and normalized project name, or None if invalid |
Source code in src/honeyhive/config/models/base.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
validate_boolean_fields
classmethod
Validate boolean fields with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The value to validate as boolean |
required |
Returns:
| Type | Description |
|---|---|
bool
|
The validated boolean value, or False if invalid |
Source code in src/honeyhive/config/models/base.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
ExperimentConfig
Bases: BaseHoneyHiveConfig
Experiment and evaluation configuration settings.
This class extends BaseHoneyHiveConfig with experiment-specific settings for A/B testing, feature flags, and experimental features. Supports multiple experiment tracking platforms (MLflow, W&B, Comet, etc.).
Example
config = ExperimentConfig( ... experiment_id="exp_12345", ... experiment_name="model-comparison", ... experiment_variant="baseline", ... experiment_group="control" ... )
Or load from environment variables:
export HH_EXPERIMENT_ID=exp_12345
export MLFLOW_EXPERIMENT_NAME=model-comparison
config = ExperimentConfig()
Source code in src/honeyhive/config/models/experiment.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
experiment_id
class-attribute
instance-attribute
experiment_id: Optional[str] = Field(
default=None,
description="Unique experiment identifier",
validation_alias=AliasChoices(
"HH_EXPERIMENT_ID", "experiment_id"
),
examples=["exp_12345", "experiment-2024-01-15"],
)
experiment_name
class-attribute
instance-attribute
experiment_name: Optional[str] = Field(
default=None,
description="Human-readable experiment name",
validation_alias=AliasChoices(
"HH_EXPERIMENT_NAME", "experiment_name"
),
examples=["model-comparison", "baseline-vs-optimized"],
)
experiment_variant
class-attribute
instance-attribute
experiment_variant: Optional[str] = Field(
default=None,
description="Experiment variant/treatment identifier",
validation_alias=AliasChoices(
"HH_EXPERIMENT_VARIANT", "experiment_variant"
),
examples=["baseline", "treatment_a", "optimized"],
)
experiment_group
class-attribute
instance-attribute
experiment_group: Optional[str] = Field(
default=None,
description="Experiment group/cohort identifier",
validation_alias=AliasChoices(
"HH_EXPERIMENT_GROUP", "experiment_group"
),
examples=["control", "test", "cohort_1"],
)
experiment_metadata
class-attribute
instance-attribute
experiment_metadata: Optional[Dict[str, Any]] = Field(
default=None,
description="Experiment metadata and tags",
validation_alias=AliasChoices(
"HH_EXPERIMENT_METADATA", "experiment_metadata"
),
examples=[{"model_type": "gpt-4", "temperature": 0.7}],
)
validate_experiment_strings
classmethod
Validate experiment string fields with graceful degradation.
Source code in src/honeyhive/config/models/experiment.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
validate_experiment_metadata
classmethod
Validate experiment metadata format with graceful degradation.
Source code in src/honeyhive/config/models/experiment.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
HTTPClientConfig
Bases: BaseHoneyHiveConfig
HTTP client configuration settings.
This class extends BaseHoneyHiveConfig with HTTP-specific settings for connection pooling, timeouts, retry behavior, proxy settings, and SSL configuration. Supports both HH_ and standard HTTP_ environment variables.
Example
config = HTTPClientConfig( ... timeout=30.0, ... max_connections=50, ... http_proxy="http://proxy.company.com:8080" ... )
Or load from environment variables:
export HH_TIMEOUT=30.0
export HH_MAX_CONNECTIONS=50
config = HTTPClientConfig()
Source code in src/honeyhive/config/models/http_client.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
timeout
class-attribute
instance-attribute
timeout: float = Field(
default=30.0,
description="Request timeout in seconds",
validation_alias=AliasChoices("HH_TIMEOUT", "timeout"),
examples=[30.0, 60.0, 120.0],
)
max_connections
class-attribute
instance-attribute
max_connections: int = Field(
default=10,
description="Maximum connections in pool",
validation_alias=AliasChoices(
"HH_MAX_CONNECTIONS", "max_connections"
),
examples=[10, 50, 100],
)
max_keepalive_connections
class-attribute
instance-attribute
max_keepalive_connections: int = Field(
default=20,
description="Maximum keepalive connections",
validation_alias=AliasChoices(
"HH_MAX_KEEPALIVE_CONNECTIONS",
"max_keepalive_connections",
),
examples=[20, 50, 100],
)
keepalive_expiry
class-attribute
instance-attribute
keepalive_expiry: float = Field(
default=30.0,
description="Keepalive expiry time in seconds",
validation_alias=AliasChoices(
"HH_KEEPALIVE_EXPIRY", "keepalive_expiry"
),
examples=[30.0, 60.0, 300.0],
)
pool_timeout
class-attribute
instance-attribute
pool_timeout: float = Field(
default=10.0,
description="Pool timeout in seconds",
validation_alias=AliasChoices(
"HH_POOL_TIMEOUT", "pool_timeout"
),
examples=[10.0, 30.0, 60.0],
)
rate_limit_calls
class-attribute
instance-attribute
rate_limit_calls: int = Field(
default=100,
description="Maximum calls per time window",
validation_alias=AliasChoices(
"HH_RATE_LIMIT_CALLS", "rate_limit_calls"
),
examples=[100, 200, 500],
)
rate_limit_window
class-attribute
instance-attribute
rate_limit_window: float = Field(
default=60.0,
description="Rate limit time window in seconds",
validation_alias=AliasChoices(
"HH_RATE_LIMIT_WINDOW", "rate_limit_window"
),
examples=[60.0, 300.0, 3600.0],
)
max_retries
class-attribute
instance-attribute
max_retries: int = Field(
3,
description="Maximum retry attempts",
validation_alias=AliasChoices(
"HH_MAX_RETRIES", "max_retries"
),
examples=[3, 5, 10],
)
http_proxy
class-attribute
instance-attribute
http_proxy: Optional[str] = Field(
None,
description="HTTP proxy URL",
validation_alias=AliasChoices(
"HH_HTTP_PROXY", "http_proxy"
),
examples=["http://proxy.company.com:8080"],
)
https_proxy
class-attribute
instance-attribute
https_proxy: Optional[str] = Field(
None,
description="HTTPS proxy URL",
validation_alias=AliasChoices(
"HH_HTTPS_PROXY", "https_proxy"
),
examples=["https://proxy.company.com:8080"],
)
no_proxy
class-attribute
instance-attribute
no_proxy: Optional[str] = Field(
None,
description="Comma-separated list of hosts to bypass proxy",
validation_alias=AliasChoices(
"HH_NO_PROXY", "no_proxy"
),
examples=["localhost,127.0.0.1,.local"],
)
verify_ssl
class-attribute
instance-attribute
verify_ssl: bool = Field(
True,
description="Verify SSL certificates",
validation_alias=AliasChoices(
"HH_VERIFY_SSL", "verify_ssl"
),
)
follow_redirects
class-attribute
instance-attribute
follow_redirects: bool = Field(
True,
description="Follow HTTP redirects",
validation_alias=AliasChoices(
"HH_FOLLOW_REDIRECTS", "follow_redirects"
),
)
validate_positive_float
classmethod
Validate that float values are positive with graceful degradation.
Source code in src/honeyhive/config/models/http_client.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
validate_positive_int
classmethod
Validate that integer values are positive with graceful degradation.
Source code in src/honeyhive/config/models/http_client.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
validate_proxy_url
classmethod
Validate proxy URL format with graceful degradation.
Source code in src/honeyhive/config/models/http_client.py
303 304 305 306 307 308 | |
OTLPConfig
Bases: BaseHoneyHiveConfig
OTLP (OpenTelemetry Protocol) configuration settings.
This class extends BaseHoneyHiveConfig with OTLP-specific settings for batch processing, export intervals, and performance tuning.
Example
config = OTLPConfig( ... batch_size=200, ... flush_interval=1.0, ... otlp_endpoint="https://custom.otlp.endpoint" ... )
Or load from environment variables:
export HH_BATCH_SIZE=200
export HH_FLUSH_INTERVAL=1.0
config = OTLPConfig()
Source code in src/honeyhive/config/models/otlp.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
otlp_enabled
class-attribute
instance-attribute
otlp_enabled: bool = Field(
default=True,
description="Enable OTLP export",
validation_alias=AliasChoices(
"HH_OTLP_ENABLED", "otlp_enabled"
),
)
otlp_endpoint
class-attribute
instance-attribute
otlp_endpoint: Optional[str] = Field(
default=None,
description="Custom OTLP endpoint URL",
validation_alias=AliasChoices(
"HH_OTLP_ENDPOINT", "otlp_endpoint"
),
examples=[
"https://api.dp1.us.honeyhive.ai/otlp",
"https://custom.otlp.endpoint",
],
)
otlp_headers
class-attribute
instance-attribute
otlp_headers: Optional[Dict[str, Any]] = Field(
default=None,
description="OTLP headers in JSON format",
validation_alias=AliasChoices(
"HH_OTLP_HEADERS", "otlp_headers"
),
examples=[
{
"Authorization": "Bearer token",
"X-Custom": "value",
}
],
)
otlp_protocol
class-attribute
instance-attribute
otlp_protocol: str = Field(
default="http/json",
description="OTLP protocol format: 'http/json' (default) or 'http/protobuf'",
validation_alias=AliasChoices(
"HH_OTLP_PROTOCOL",
"OTEL_EXPORTER_OTLP_PROTOCOL",
"otlp_protocol",
),
examples=["http/json", "http/protobuf"],
)
batch_size
class-attribute
instance-attribute
batch_size: int = Field(
default=100,
description="OTLP batch size for performance optimization",
validation_alias=AliasChoices(
"HH_BATCH_SIZE", "batch_size"
),
examples=[50, 100, 200, 500],
)
flush_interval
class-attribute
instance-attribute
flush_interval: float = Field(
default=5.0,
description="OTLP flush interval in seconds",
validation_alias=AliasChoices(
"HH_FLUSH_INTERVAL", "flush_interval"
),
examples=[0.5, 1.0, 5.0, 10.0],
)
max_export_batch_size
class-attribute
instance-attribute
max_export_batch_size: int = Field(
default=512,
description="Maximum export batch size",
validation_alias=AliasChoices(
"HH_MAX_EXPORT_BATCH_SIZE", "max_export_batch_size"
),
examples=[256, 512, 1024],
)
export_timeout
class-attribute
instance-attribute
export_timeout: float = Field(
default=30.0,
description="Export timeout in seconds",
validation_alias=AliasChoices(
"HH_EXPORT_TIMEOUT", "export_timeout"
),
examples=[10.0, 30.0, 60.0],
)
validate_otlp_endpoint
classmethod
Validate OTLP endpoint URL format with graceful degradation.
Source code in src/honeyhive/config/models/otlp.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
validate_batch_sizes
classmethod
Validate batch size values with graceful degradation.
Source code in src/honeyhive/config/models/otlp.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
validate_timeouts
classmethod
Validate timeout values with graceful degradation.
Source code in src/honeyhive/config/models/otlp.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
validate_otlp_headers
classmethod
Validate OTLP headers format with graceful degradation.
Source code in src/honeyhive/config/models/otlp.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
EvaluationConfig
Bases: BaseHoneyHiveConfig
Evaluation-specific configuration parameters.
This class handles configuration for evaluation scenarios, including dataset and run management.
Example
eval_config = EvaluationConfig( ... is_evaluation=True, ... run_id="eval-run-123", ... dataset_id="dataset-456", ... datapoint_id="datapoint-789" ... ) tracer = HoneyHiveTracer( ... config=tracer_config, ... evaluation_config=eval_config ... )
Source code in src/honeyhive/config/models/tracer.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
is_evaluation
class-attribute
instance-attribute
is_evaluation: bool = Field(
default=False, description="Enable evaluation mode"
)
run_id
class-attribute
instance-attribute
run_id: Optional[str] = Field(
None,
description="Evaluation run identifier",
examples=["eval-run-123", "experiment-2024-01-15"],
)
dataset_id
class-attribute
instance-attribute
dataset_id: Optional[str] = Field(
None,
description="Dataset identifier for evaluation",
examples=["dataset-456", "qa-dataset-v2"],
)
datapoint_id
class-attribute
instance-attribute
datapoint_id: Optional[str] = Field(
None,
description="Specific datapoint identifier",
examples=["datapoint-789", "question-42"],
)
validate_ids
classmethod
Validate ID fields with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The ID value to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated ID, or None if invalid |
Source code in src/honeyhive/config/models/tracer.py
511 512 513 514 515 516 517 518 519 520 521 522 | |
SessionConfig
Bases: BaseHoneyHiveConfig
Session-specific configuration parameters.
This class handles configuration related to session management, including session linking and input/output data.
Example
session_config = SessionConfig( ... session_id="550e8400-e29b-41d4-a716-446655440000", ... inputs={"user_id": "123", "query": "Hello world"} ... ) tracer = HoneyHiveTracer( ... config=tracer_config, ... session_config=session_config ... )
Source code in src/honeyhive/config/models/tracer.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
session_id
class-attribute
instance-attribute
session_id: Optional[str] = Field(
None,
description="Existing session ID to attach to (must be valid UUID)",
examples=["550e8400-e29b-41d4-a716-446655440000"],
)
skip_backend_session_creation
class-attribute
instance-attribute
skip_backend_session_creation: bool = Field(
default=False,
description="If True, skip the init-time backend session creation call. If a valid session_id is also provided, the SDK trusts that the session already exists on the backend. Otherwise, callers are expected to manage session_ids via per-request create_session(session_id=<uuid>, skip_api_call=True) calls. Note: an invalid session_id (e.g. non-UUID) triggers the degraded-mode path and still calls the backend.",
)
inputs
class-attribute
instance-attribute
inputs: Optional[Dict[str, Any]] = Field(
None,
description="Session input data",
examples=[{"user_id": "123", "query": "Hello world"}],
)
link_carrier
class-attribute
instance-attribute
link_carrier: Optional[Dict[str, Any]] = Field(
None,
description="Context propagation carrier for distributed tracing",
examples=[{"traceparent": "00-...", "baggage": "..."}],
)
validate_session_id
classmethod
Validate session ID format with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The session ID to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated and normalized session ID, or None if invalid |
Source code in src/honeyhive/config/models/tracer.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
SpanNameFilter
Bases: BaseModel
A single span name filter entry.
Uses BaseModel (not BaseSettings) since these are nested data models that should not read from environment variables.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['prefix']
|
The filter matching strategy. Only "prefix" is currently supported. |
value |
str
|
The value to match against span names. |
Source code in src/honeyhive/config/models/tracer.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
type
class-attribute
instance-attribute
type: Literal["prefix"] = Field(
description='Filter matching strategy. Only "prefix" is currently supported.'
)
value
class-attribute
instance-attribute
value: str = Field(
description="The value to match against span names.",
examples=["a2a.client.transports.jsonrpc"],
)
SpanNameFilters
Bases: BaseModel
Configuration for filtering spans by name.
Uses BaseModel (not BaseSettings) since these are nested data models that should not read from environment variables.
Supports both include (allow-list) and exclude (block-list) filters. If include is specified, only spans matching at least one include filter are kept. If exclude is specified, spans matching any exclude filter are dropped. If both are specified, a span must match include AND not match exclude.
Example
filters = SpanNameFilters( ... exclude=[SpanNameFilter(type="prefix", value="a2a.client.transports")] ... )
Source code in src/honeyhive/config/models/tracer.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
include
class-attribute
instance-attribute
include: Optional[List[SpanNameFilter]] = Field(
default=None,
description="Allow-list: only keep spans matching at least one filter.",
)
exclude
class-attribute
instance-attribute
exclude: Optional[List[SpanNameFilter]] = Field(
default=None,
description="Block-list: drop spans matching any filter.",
)
TracerConfig
Bases: BaseHoneyHiveConfig
Core tracer configuration with validation.
This class defines the primary configuration parameters for initializing a HoneyHive tracer instance. It inherits common fields from BaseHoneyHiveConfig and adds tracer-specific parameters.
Inherited Fields
- api_key: HoneyHive API key for authentication
- project: Deprecated project name (optional; backend infers scope from API key)
- test_mode: Enable test mode (no data sent to backend)
- verbose: Enable verbose logging output
Tracer-Specific Fields
- session_name: Human-readable session identifier
- source: Source environment identifier
- server_url: Custom HoneyHive server URL (from HH_API_URL env var)
- disable_http_tracing: Disable HTTP request tracing (disabled by default)
- disable_batch: Disable batch processing of spans
Example
config = TracerConfig( ... api_key="hh_1234567890abcdef", ... project="my-llm-project", ... session_name="user-chat-session", ... source="production", ... verbose=True ... ) tracer = HoneyHiveTracer(config=config)
Backwards compatible usage still works:
tracer = HoneyHiveTracer( ... api_key="hh_1234567890abcdef", ... project="my-llm-project", ... verbose=True ... )
Source code in src/honeyhive/config/models/tracer.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
session_name
class-attribute
instance-attribute
session_name: Optional[str] = Field(
None,
description="Human-readable session identifier",
examples=["user-chat-session", "batch-processing-job"],
)
source
class-attribute
instance-attribute
source: str = Field(
default="dev",
description="Source environment identifier",
validation_alias=AliasChoices("HH_SOURCE", "source"),
examples=["dev", "staging", "production"],
)
server_url
class-attribute
instance-attribute
server_url: str = Field(
default="https://api.dp1.us.honeyhive.ai",
description="Custom HoneyHive server URL",
validation_alias=AliasChoices(
"HH_API_URL", "server_url"
),
examples=[
"https://api.dp1.us.honeyhive.ai",
"https://custom.honeyhive.com",
],
)
disable_http_tracing
class-attribute
instance-attribute
disable_http_tracing: bool = Field(
default=True,
description="Disable HTTP request tracing (disabled by default)",
validation_alias=AliasChoices(
"HH_DISABLE_HTTP_TRACING", "disable_http_tracing"
),
)
disable_batch
class-attribute
instance-attribute
disable_batch: bool = Field(
default=False,
description="Disable batch processing of spans",
validation_alias=AliasChoices(
"HH_DISABLE_BATCH", "disable_batch"
),
)
disable_tracing
class-attribute
instance-attribute
disable_tracing: bool = Field(
default=False,
description="Disable all tracing functionality",
validation_alias=AliasChoices(
"HH_DISABLE_TRACING", "disable_tracing"
),
)
span_name_filters
class-attribute
instance-attribute
span_name_filters: Optional[SpanNameFilters] = Field(
default=None,
description="Filter spans by name using include/exclude lists. Each filter entry specifies a type ('prefix') and value to match. Excluded spans are dropped before enrichment and export.",
examples=[
{
"exclude": [
{
"type": "prefix",
"value": "a2a.client.transports.jsonrpc",
}
]
}
],
)
max_attributes
class-attribute
instance-attribute
max_attributes: int = Field(
default=1024,
description="Maximum number of attributes per span (OpenTelemetry default: 128, HoneyHive default: 1024)",
validation_alias=AliasChoices(
"HH_MAX_ATTRIBUTES", "max_attributes"
),
examples=[128, 256, 500, 1024, 2000],
)
max_events
class-attribute
instance-attribute
max_events: int = Field(
default=1024,
description="Maximum number of events per span (matches max_attributes because events are flattened to pseudo-attributes)",
validation_alias=AliasChoices(
"HH_MAX_EVENTS", "max_events"
),
)
max_links
class-attribute
instance-attribute
max_links: int = Field(
default=128,
description="Maximum number of links per span",
validation_alias=AliasChoices(
"HH_MAX_LINKS", "max_links"
),
)
max_span_size
class-attribute
instance-attribute
max_span_size: int = Field(
default=10 * 1024 * 1024,
description="Maximum total size of span (attributes + events + links) in bytes",
validation_alias=AliasChoices(
"HH_MAX_SPAN_SIZE", "max_span_size"
),
examples=[1048576, 5242880, 10485760, 20971520],
)
preserve_core_attributes
class-attribute
instance-attribute
preserve_core_attributes: bool = Field(
default=True,
description="Enable core attribute preservation to prevent FIFO eviction of critical attributes (session_id, event_type, etc.). When enabled, re-sets core attributes before span.end() to ensure they survive eviction. Disable only for debugging or extreme performance requirements.",
validation_alias=AliasChoices(
"HH_PRESERVE_CORE_ATTRIBUTES",
"preserve_core_attributes",
),
)
cache_enabled
class-attribute
instance-attribute
cache_enabled: bool = Field(
default=True,
description="Enable dynamic caching for performance optimization",
validation_alias=AliasChoices(
"HH_CACHE_ENABLED", "cache_enabled"
),
)
cache_max_size
class-attribute
instance-attribute
cache_max_size: Optional[int] = Field(
None,
description="Maximum cache size per cache type (dynamic sizing if None)",
validation_alias=AliasChoices(
"HH_CACHE_MAX_SIZE", "cache_max_size"
),
examples=[1000, 5000, 10000],
)
cache_ttl
class-attribute
instance-attribute
cache_ttl: Optional[float] = Field(
None,
description="Cache TTL in seconds (dynamic TTL based on cache type if None)",
validation_alias=AliasChoices(
"HH_CACHE_TTL", "cache_ttl"
),
examples=[300.0, 600.0, 3600.0],
)
cache_cleanup_interval
class-attribute
instance-attribute
cache_cleanup_interval: Optional[float] = Field(
None,
description="Cache cleanup interval in seconds (dynamic interval if None)",
validation_alias=AliasChoices(
"HH_CACHE_CLEANUP_INTERVAL",
"cache_cleanup_interval",
),
examples=[60.0, 120.0, 300.0],
)
session_id
class-attribute
instance-attribute
session_id: Optional[str] = Field(
None,
description="Existing session ID to attach to (must be valid UUID)",
examples=["550e8400-e29b-41d4-a716-446655440000"],
)
inputs
class-attribute
instance-attribute
inputs: Optional[Dict[str, Any]] = Field(
None,
description="Session input data",
examples=[{"user_id": "123", "query": "Hello world"}],
)
link_carrier
class-attribute
instance-attribute
link_carrier: Optional[Dict[str, Any]] = Field(
None,
description="Context propagation carrier for distributed tracing",
examples=[{"traceparent": "00-...", "baggage": "..."}],
)
is_evaluation
class-attribute
instance-attribute
is_evaluation: bool = Field(
default=False, description="Enable evaluation mode"
)
run_id
class-attribute
instance-attribute
run_id: Optional[str] = Field(
None,
description="Evaluation run identifier",
examples=["eval-run-123", "experiment-2024-01-15"],
)
dataset_id
class-attribute
instance-attribute
dataset_id: Optional[str] = Field(
None,
description="Dataset identifier for evaluation",
examples=["dataset-456", "qa-dataset-v2"],
)
datapoint_id
class-attribute
instance-attribute
datapoint_id: Optional[str] = Field(
None,
description="Specific datapoint identifier",
examples=["datapoint-789", "question-42"],
)
validate_server_url
classmethod
Validate server URL format with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The server URL to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated and normalized server URL, or default if invalid |
Source code in src/honeyhive/config/models/tracer.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
validate_source
classmethod
Validate source environment with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The source environment to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated source environment, or "dev" if invalid |
Source code in src/honeyhive/config/models/tracer.py
329 330 331 332 333 334 335 336 337 338 339 340 341 | |
validate_session_id
classmethod
Validate session ID format with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The session ID to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated and normalized session ID, or None if invalid |
Source code in src/honeyhive/config/models/tracer.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
validate_ids
classmethod
Validate ID fields with graceful degradation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Any
|
The ID value to validate |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The validated ID, or None if invalid |
Source code in src/honeyhive/config/models/tracer.py
370 371 372 373 374 375 376 377 378 379 380 381 | |