Available Namespaces
Enrichments are key-value pairs that add context to your traces. Bothenrich_span() and enrich_session() support these namespaces:
| Namespace | Type | Description | enrich_session | enrich_span |
|---|---|---|---|---|
config | Object | Configuration details (model params, prompt templates) | ✓ | ✓ |
feedback | Object | User feedback or annotations | ✓ | ✓ |
metrics | Object | Scores, evaluations, numeric measurements | ✓ | ✓ |
metadata | Object | Catch-all for arbitrary metadata or JSON | ✓ | ✓ |
inputs | Object | Input data for the function or event | ✓ | ✓ |
outputs | Object | Output data from the function or event | ✓ | ✓ |
user_properties | Object | User-specific attributes | ✓ | ✓ |
error | String | Error information if applicable | ✗ | ✓ |
event_id | String | Custom event ID (must be valid UUIDv4) | ✗ | ✓ |
Setting event type: To set the event type (chain, model, tool), use the
@trace decorator’s event_type parameter, not enrichment functions. Example: @trace(event_type="model").Backend Attributes
Each namespace maps to a specific backend attribute prefix:| Namespace | Purpose | Backend Attribute |
|---|---|---|
metadata | Custom business context | honeyhive_metadata.* |
metrics | Numeric measurements | honeyhive_metrics.* |
user_properties | User-specific properties | honeyhive_user_properties.* |
feedback | User or system feedback | honeyhive_feedback.* |
inputs | Input data | honeyhive_inputs.* |
outputs | Output data | honeyhive_outputs.* |
config | Configuration parameters | honeyhive_config.* |
error | Error messages (string) | honeyhive_error |
event_id | Unique identifier (string) | honeyhive_event_id |
Additive behavior: For Object-type enrichments (config, metadata, etc.), enrichments are additive for unique keys. Enriching the same field twice with different keys includes both. Enriching the same key twice overwrites the previous value.
Parameter Precedence
When usingenrich_span() with mixed invocation patterns (dict, kwargs, namespaces), parameters are merged in this order:
- Reserved namespaces (
metadata,metrics, etc.) - Applied first attributesdict (simple dict passed as first argument) - Applied second**kwargs(keyword arguments) - Applied last, wins conflicts
Kwargs override dict values when the same key appears in both. Use explicit namespaces (
metadata=, metrics=) for clarity.Supported Data Types
You can enrich with these data types:Complex objects (lists, nested dicts) are automatically serialized to JSON strings for storage.
Nesting Limits
For complex data types:- Objects: Maximum 5 levels of nesting
- Arrays: Maximum 2 levels of nesting
metrics.step_evals.0.user_intervened(boolean)metrics.trajectory_eval.overall(number)
Best Practices
DO:- Use consistent key names across your application
- Add user/session IDs for debugging
- Include feature/endpoint identifiers
- Use descriptive key names (
user_idnotuid) - Keep values under 1KB per field
- Include sensitive data (passwords, API keys, PII)
- Use random or generated key names
- Duplicate data already captured by auto-instrumentors
- Exceed nesting limits (5 objects, 2 arrays)
Task-Specific Guides
Each namespace has a dedicated guide with detailed examples:Metrics & Evaluations
The
metrics namespace for scores and evaluationsUser Feedback
The
feedback namespace for ratings and commentsPrompts
Manage prompt templates and model configs
User Properties
The
user_properties namespace for user contextCustom Metadata
The
metadata namespace for arbitrary dataSDK Reference
- Python SDK Reference -
enrich_session(),enrich_span()

