OSSS.ai.orchestration.adapter¶
OSSS.ai.orchestration.adapter
¶
LangGraph Node Adapter for OSSS agents.
This module provides the LangGraphNodeAdapter class which serves as a bridge between OSSS agents and LangGraph's execution model, enabling seamless conversion of agents into LangGraph-compatible nodes.
NodeExecutionResult
¶
Bases: BaseModel
Result of a node execution with metadata.
Migrated from dataclass to Pydantic BaseModel for enhanced validation, serialization, and integration with the OSSS Pydantic ecosystem.
ExecutionNodeConfiguration
¶
Bases: BaseModel
Configuration for node execution.
Migrated from dataclass to Pydantic BaseModel for enhanced validation, serialization, and integration with the OSSS Pydantic ecosystem.
LangGraphNodeAdapter
¶
Bases: ABC
Abstract base adapter for converting OSSS agents into LangGraph nodes.
This adapter provides the interface and utilities needed to execute OSSS agents within a LangGraph DAG context, handling state transitions, error propagation, and execution metadata.
node_definition
property
¶
Get the LangGraph node definition for this adapter.
average_execution_time_ms
property
¶
Get average execution time in milliseconds.
success_rate
property
¶
Get success rate as a percentage (0-100).
__init__(agent, node_id=None)
¶
Initialize the node adapter.
Parameters¶
agent : BaseAgent The OSSS agent to adapt node_id : str, optional Custom node ID (defaults to agent name)
__call__(state, config=None)
async
¶
execute(state, config=None)
async
¶
get_statistics()
¶
Get comprehensive execution statistics for this node.
StandardNodeAdapter
¶
Bases: LangGraphNodeAdapter
Standard implementation of LangGraphNodeAdapter for typical agent conversions.
This provides a complete, ready-to-use adapter for most OSSS agents without requiring custom implementations.
__init__(agent, node_id=None, enable_state_validation=True, enable_rollback=True)
¶
Initialize the standard node adapter.
Parameters¶
agent : BaseAgent The agent to adapt node_id : str, optional Custom node ID enable_state_validation : bool Whether to validate state transitions enable_rollback : bool Whether to enable automatic rollback on failure
ConditionalNodeAdapter
¶
Bases: LangGraphNodeAdapter
Node adapter with conditional routing capabilities.
This adapter can determine the next node(s) to execute based on the agent's output and custom routing logic.