Skip to main content
Define the Universal Object Mapping orchestrator graph.

react_agent.graph.ExtractionOutput Objects

View Source Structured output for identifying user intent from messages. This model is used by the initial extraction agent to parse unstructured conversation history into a structured representation. It identifies the origin/target frameworks, versions, and the raw code blocks intended for translation.

ExtractionOutput.join_lists

View Source Clean and normalize the fields after validation by joining list inputs into single strings. Returns:
  • BaseExtractionOutput - The validated and normalized model instance.

react_agent.graph.BaseTranslationOutput Objects

View Source Structured output for the translated schema and/or queries. This acts as the base Pydantic schema for the primary translation LLM node. It dynamically expands based on whether the translation_type is SCHEMA, QUERY, or BOTH. It mandates that the agent provide both the translated raw code and fully functional execution harnesses (with explicitly declared entry points) for downstream sandbox validation.

BaseTranslationOutput.check_entrypoint_names

View Source Clean, normalize, and validate that the entrypoint class names exist in the generated harness code. Returns:
  • BaseTranslationOutput - The validated and normalized model instance.
Raises:
  • ValueError - If the entrypoint type name is missing from the harness/schema code.

react_agent.graph.is_input_extracted

View Source Check if the necessary structured input has been successfully extracted from conversation. Validates that based on the translation_type, the corresponding source code fields (schema, query, or both) and the framework targets are present. Arguments:
  • state State | ExtractionOutput - The current graph state or extraction output model.
Returns:
  • bool - True if all required fields are present, False otherwise.

react_agent.graph.extract_input

View Source Extract raw source code and targets from recent messages if missing from structured input. This node uses a specialized ReAct agent to analyze the conversation history and extract the necessary parameters (origin framework, destination framework, and the raw source code snippets) needed to begin the translation process. If it fails, it updates the extraction loop counter and may terminate the graph if the maximum retry limit is reached. Arguments:
  • state State - The current state of the graph.
  • config RunnableConfig - Configuration parameters for the run.
  • runtime Runtime[Context] - The execution runtime containing context.
Returns: dict[str, Any] | Command: State updates with extracted parameters or a Command to terminate the graph on failure.

react_agent.graph.schema_inspection

View Source Inspect source and target database schemas using database tools. Runs a lightweight ReAct agent equipped with database inspection tools (MCP) to examine the relevant database schemas before translation begins. This gathers contextual data that is then injected into the main translation prompt to ensure accuracy. Arguments:
  • state State - The current state of the graph.
  • config RunnableConfig - Configuration parameters for the run.
  • runtime Runtime[Context] - The execution runtime containing context.
Returns: dict[str, Any]: State updates containing the extracted schema_context string.

react_agent.graph.translation_agent

View Source Use a ReAct agent to perform translation and validation loops natively. Combines static tools (validators, fallback docs) with dynamically loaded database and documentation MCP tools. Warnings: This node is DEPRECATED in favor of generate_translation_node coupled with explicit state machine nodes for validation and evaluation, which provides better determinism and observability. Arguments:
  • state State - The current state of the graph.
  • config RunnableConfig - Configuration parameters for the run.
  • runtime Runtime[Context] - The execution runtime containing context.
Returns: dict[str, Any]: State updates containing the translation output.

react_agent.graph.generate_translation_node

View Source Deterministically generate the translation using structured LLM output via a React Agent without tools. This node acts as the core “Generation” step in the iterative translation loop. It takes the extracted source code, the schema context, and the previous translation attempts/feedback (if any) and generates the translated code and execution harnesses using a strongly-typed Pydantic model (TranslationOutput). Arguments:
  • state State - The current state of the graph.
  • config RunnableConfig - Configuration parameters for the run.
  • runtime Runtime[Context] - The execution runtime containing context.
Returns: dict[str, Any]: State updates containing the generated translation outputs.

react_agent.graph.HumanInterventionResponse Objects

View Source Pydantic model representing the feedback and decision from a human-in-the-loop intervention. Attributes:
  • decision - The logical decision, either “accept” to commit the translation or “reject” to loop back with feedback.
  • feedback - Text description or critique describing necessary adjustments.

react_agent.graph.human_intervention_node

View Source Pause the graph execution to request human-in-the-loop (HITL) feedback. This node interrupts the state machine, surfacing the current translation code and validation results (including deep diffs) to the user via the interrupt LangGraph API. The user can either ‘accept’ the translation to terminate successfully, or ‘reject’ it with feedback to trigger another generation loop. Arguments:
  • state State - The current state of the graph.
Returns: dict[str, Any] | Command: State updates appending the user’s feedback to messages, or a Command to end the graph if accepted.

react_agent.graph.prep_schema_validation

View Source Inject ToolCalls into the message history to trigger schema compilation validation. Prepares the state for the validate_schema_node by appending an AIMessage with explicitly defined tool calls (validate_dotnet_code or validate_java_code) containing the target schema harness code. Arguments:
  • state State - The current state of the graph.
Returns: dict[str, Any]: State updates with the injected validation tool calls.

react_agent.graph.prep_query_validation

View Source Inject ToolCalls into the message history for parallel source and target query validation. Prepares the state for the validate_query_node by appending an AIMessage with multiple tool calls to run both the source validation harness and the target validation harness in sandbox environments concurrently. Arguments:
  • state State - The current state of the graph.
Returns: dict[str, Any]: State updates with the injected validation tool calls.

react_agent.graph.prep_query_equivalence

View Source Inject a ToolCall into the message history to run the query equivalence checker. Prepares the state for the check_query_equivalence_node. It parses the JSON validation outputs from the previous query validation step and issues a tool call for DeepDiff equivalence testing. Arguments:
  • state State - The current state of the graph.
Returns: dict[str, Any]: State updates with the injected equivalence tool call.

react_agent.graph.custom_tool_node_wrapper

View Source Wrap tool execution to provide robust retries against transient infrastructure errors. Used by ToolNode to intercept and retry tool calls (like Daytona sandbox provisioning) with an exponential backoff. If max retries are exceeded, it gracefully injects an error ToolMessage into the state rather than crashing the graph. Arguments:
  • request ToolCallRequest - The requested tool call payload.
  • execute Callable - The underlying ToolNode execution function.
Returns: Union[ToolMessage, Command]: The result of the tool execution or an error ToolMessage.

react_agent.graph.route_post_query_validation

View Source Determine the next state transition after parallel query validation. If both the source and target query validations completed successfully (indicated by ‘[Validation Passed]’ in their tool output), it routes to prep_query_equivalence. Otherwise, it skips equivalence checking and routes directly to the evaluation_node to analyze the validation failures. Arguments:
  • state State - The current state of the graph.
Returns: Literal[“prep_query_equivalence”, “evaluation_node”]: The name of the next node.

react_agent.graph.EvaluationOutput Objects

View Source Pydantic model representing the LLM evaluation outcome for translation acceptance. Attributes:
  • decision - The logical decision, either ACCEPT to complete the process or REJECT to loop back for correction.
  • explanation - Detailed textual reasoning explaining the decision, citing specific equivalence or compiler errors.

react_agent.graph.evaluation_node

View Source Evaluate validation and equivalence testing results to decide on translation acceptance. This node uses a specialized evaluation LLM to act as a judge. It reviews the compiler outputs from the sandboxes and the JSON DeepDiff equivalence results. Based on this, it generates a structured EvaluationOutput deciding whether to ‘ACCEPT’ the translation or ‘REJECT’ it (which triggers another generation iteration with feedback). Arguments:
  • state State - The current state of the graph.
  • config RunnableConfig - Configuration parameters for the run.
  • runtime Runtime[Context] - The execution runtime containing context.
Returns: dict[str, Any]: State updates containing the evaluation decision and explanation.

react_agent.graph.route_post_evaluation

View Source Determine the next state transition after evaluation. If the evaluation was rejected or failed, it routes back to generate_translation_node to retry. If the maximum translation loop count is reached, it routes to human_intervention_node instead. If accepted, it routes to __end__. Arguments:
  • state State - The current state of the graph.
Returns: Literal[“generate_translation_node”, “human_intervention_node”, “end”]: The next node.

react_agent.graph.should_extract_input

View Source Determine the next state transition during the initial extraction phase. Checks if all required structured inputs have been successfully parsed. If so, it routes to schema_inspection. If not, it routes back to extract_input up to a maximum retry limit, after which it routes to __end__ to terminate the graph gracefully. Arguments:
  • state State - The current state of the graph.
Returns: Literal[“schema_inspection”, “extract_input”, “end”]: The next node.

react_agent.graph.route_post_translation

View Source Determine the next validation state transition after code generation. Routes to prep_schema_validation if the translation type is SCHEMA. For QUERY or BOTH translation types, it routes to prep_query_validation. Arguments:
  • state State - The current state of the graph.
Returns: Literal[“prep_schema_validation”, “prep_query_validation”]: The next node.

react_agent.graph.route_post_schema_validation

View Source Determine the next state transition after schema validation. If schema compilation failed, it routes back to generate_translation_node (or human_intervention_node if max retries exceeded) without proceeding further. If it passed and the translation type is BOTH, it routes to prep_query_validation. Otherwise, it terminates execution (__end__). Arguments:
  • state State - The current state of the graph.
Returns: Literal[“prep_query_validation”, “generate_translation_node”, “human_intervention_node”, “end”]: The next node.