haive.core.schema.field_registry¶
Field Registry for standardized field definitions across Haive.
This module provides a centralized registry of commonly used field definitions that can be referenced by nodes, engines, and schema composers. This ensures consistency and allows for selective state schema composition.
Key benefits: - Standardized field definitions across the framework - Selective inclusion in state schemas (only what’s needed) - Type safety with proper generics - Token counting integration for messages - Backwards compatibility
Classes¶
Pre-defined sets of fields for common use cases. |
|
Dynamic field registry for custom field definitions. |
|
Registry of prebuilt state schemas for common use cases. |
|
Registry of standard field definitions used across Haive. |
Functions¶
|
Get a standard field definition by name. |
Module Contents¶
- class haive.core.schema.field_registry.CommonFieldSets¶
Pre-defined sets of fields for common use cases.
- class haive.core.schema.field_registry.FieldRegistry¶
Dynamic field registry for custom field definitions.
This complements StandardFields by allowing registration of custom field definitions at runtime.
- classmethod clear()¶
Clear the registry (mainly for testing).
- Return type:
None
- classmethod register(field_def)¶
Register a custom field definition.
- Parameters:
field_def (haive.core.schema.field_definition.FieldDefinition)
- Return type:
None
- class haive.core.schema.field_registry.PrebuiltStates¶
Registry of prebuilt state schemas for common use cases.
Hierarchy: - MessagesState (basic, no tokens) - MessagesStateWithTokenUsage (with token tracking)
LLMState (single engine + tokens + thresholds) - ToolState (tools + LLM features)
- classmethod base_messages_state()¶
Get basic MessagesState without token tracking.
- Return type:
Any
- classmethod llm_state()¶
Get LLMState for single-engine LLM agents with token tracking and model awareness.
- Return type:
Any
- classmethod messages_with_tokens()¶
Get MessagesStateWithTokenUsage for token-aware conversations.
- Return type:
Any
- classmethod tool_state()¶
Get ToolState for tool-using agents with LLM features, tools, and token tracking.
- Return type:
Any
- class haive.core.schema.field_registry.StandardFields¶
Registry of standard field definitions used across Haive.
Each field is defined with: - name: field name in snake_case - type: proper Python type annotation - description: human-readable description - default: default value or factory - metadata: additional field metadata
- classmethod ai_message()¶
Single AI message output field.
- Return type:
- classmethod available_nodes()¶
Available graph nodes.
- Return type:
- classmethod context()¶
Retrieved context documents.
- Return type:
- classmethod documents()¶
Retrieved documents with metadata.
- Return type:
- classmethod engine_name()¶
Name of the engine being used.
- Return type:
- classmethod human_message()¶
Single human message input field.
- Return type:
- classmethod messages(use_enhanced=True)¶
Standard messages field for conversation history.
- Parameters:
use_enhanced (bool) – Whether to use the enhanced MessageList with token counting and metadata
- Return type:
- classmethod observations()¶
Agent observations from tools/environment.
- Return type:
- classmethod plan_steps()¶
Generated plan steps.
- Return type:
- classmethod query()¶
User query string.
- Return type:
- classmethod structured_output(model_class, field_name=None)¶
Create a structured output field for a Pydantic model.
- Parameters:
- Return type:
- classmethod thoughts()¶
Agent reasoning thoughts.
- Return type:
- classmethod tool_routes()¶
Tool routing configuration.
- Return type:
- haive.core.schema.field_registry.get_standard_field(name, **kwargs)¶
Get a standard field definition by name.
- Parameters:
name (str) – Standard field name (e.g., ‘messages’, ‘context’, ‘query’)
**kwargs – Additional arguments passed to the field method
- Returns:
FieldDefinition or None if field not found
- Return type: