Class TaskSolverRunner
java.lang.Object
neqsim.mcp.runners.TaskSolverRunner
Task solver and multi-domain composition runner.
Two capabilities in one class:
- solve_task — Takes a high-level engineering task description and structured parameters, classifies the task, builds a multi-step execution plan (sequence of existing runners), executes each step passing results between them, validates the combined output, and returns a structured engineering report.
- compose_workflow — Chains multiple domain runners in sequence (e.g., Reservoir → Process → Pipeline → Economics) with automatic data flow between stages.
- Version:
- 1.0
- Author:
- Even Solbraa
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA step in an execution plan.(package private) static classResult of executing a step. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor — all methods are static. -
Method Summary
Modifier and TypeMethodDescriptionprivate static List<TaskSolverRunner.PlanStep> Builds an execution plan based on task type.private static StringbuildStepInput(TaskSolverRunner.PlanStep step, com.google.gson.JsonObject originalInput, com.google.gson.JsonObject carryForward) Builds input JSON for a specific step.private static StringbuildTaskReport(String task, String taskType, List<TaskSolverRunner.PlanStep> plan, List<TaskSolverRunner.StepResult> results, com.google.gson.JsonObject carryForward, String validationReport, long totalTimeMs) Builds the final task report.private static StringclassifyTask(String task, com.google.gson.JsonObject input) Classifies a task description into a category.static StringcomposeWorkflow(String json) Composes a multi-domain workflow by chaining specified runners in sequence.private static StringCreates a standard error JSON.private static StringexecuteStep(TaskSolverRunner.PlanStep step, String inputJson) Executes a single step by routing to the appropriate runner.static StringSolves a high-level engineering task by planning and executing a sequence of runner steps.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON
-
-
Constructor Details
-
TaskSolverRunner
private TaskSolverRunner()Private constructor — all methods are static.
-
-
Method Details
-
solveTask
Solves a high-level engineering task by planning and executing a sequence of runner steps.Input JSON format:
{ "task": "Design a 3-stage compression system from 5 to 150 bara", "fluid": { "components": {...}, "eos": "srk", "temperature": 298.15, "pressure": 5.0 }, "parameters": { "stages": 3, "outletPressure": 150.0, "intercoolerTemp": 40.0 }, "validate": true }- Parameters:
json- the task description JSON- Returns:
- JSON with classification, plan, step results, validation, and summary
-
composeWorkflow
Composes a multi-domain workflow by chaining specified runners in sequence.Input JSON format:
{ "workflow": "reservoir-to-economics", "fluid": { ... }, "steps": [ { "runner": "flash", "input": { "temperature": 25, "pressure": 60 } }, { "runner": "process", "input": { "process": [...] } }, { "runner": "pipeline", "input": { "length": 50000, "diameter": 0.3 } } ] }- Parameters:
json- the workflow JSON- Returns:
- JSON with all step results and combined output
-
classifyTask
-
buildPlan
private static List<TaskSolverRunner.PlanStep> buildPlan(String taskType, com.google.gson.JsonObject input) Builds an execution plan based on task type.- Parameters:
taskType- the classified task typeinput- the full input JSON- Returns:
- list of plan steps
-
buildStepInput
private static String buildStepInput(TaskSolverRunner.PlanStep step, com.google.gson.JsonObject originalInput, com.google.gson.JsonObject carryForward) Builds input JSON for a specific step.- Parameters:
step- the plan steporiginalInput- the original task inputcarryForward- data carried from previous steps- Returns:
- JSON input for the step runner
-
executeStep
Executes a single step by routing to the appropriate runner.- Parameters:
step- the plan stepinputJson- the step input JSON- Returns:
- the runner output JSON
-
buildTaskReport
private static String buildTaskReport(String task, String taskType, List<TaskSolverRunner.PlanStep> plan, List<TaskSolverRunner.StepResult> results, com.google.gson.JsonObject carryForward, String validationReport, long totalTimeMs) Builds the final task report.- Parameters:
task- the original task descriptiontaskType- the classified typeplan- the execution planresults- the step resultscarryForward- the combined datavalidationReport- the validation report JSON, or nulltotalTimeMs- total execution time- Returns:
- the complete report JSON
-
errorJson
-