RunCodeTaskExecutionConfigData JSON
{
  "goal": "Find all .log files and summarize their size",
  "workingDir": "./logs",
  "task_type": "RunCode"
}
Session UI Output Rendered
Code
Result
Output
new File(".").listFiles().findAll { 
  it.name.endsWith(".log") 
}.sum { it.length() }
Result: 10485760
Output: Scanning directory... found 12 files.

Live Results Showcase

Explore actual artifacts and logs generated by the RunCodeTask in our test workspace.

Execution Configuration

These parameters define the specific goal and environment for a single task execution.

Field Type Description
goal * String The specific task or goal to be accomplished via code execution.
workingDir String The relative file path of the working directory for the script.
task_description String Optional metadata describing the purpose of this specific execution.
task_dependencies List<String> List of task IDs that must complete before this execution.

Task Lifecycle

  1. Initialization: Loads the specified CodeRuntime (Groovy by default) and injects symbols.
  2. Agent Planning: A CodingTask agent generates a solution based on the goal.
  3. Execution: The code is executed within the configured workingDir.
  4. Feedback Loop:
    • Auto-Fix Mode: If autoFix is true, the task executes and completes automatically.
    • Interactive Mode: The user reviews the code, result, and output, with options to Continue or Revise.

Type Configuration

Field Type Default
codeRuntime CodeRuntimes GroovyRuntime
model ApiChatModel System Default

Orchestration Boilerplate

Invoke RunCodeTask directly using the UnifiedHarness for automated agentic coding.

import com.simiacryptus.cognotik.plan.TaskType
import com.simiacryptus.cognotik.plan.tools.run.RunCodeTask.Companion.RunCode
import com.simiacryptus.cognotik.plan.tools.run.RunCodeTask.RunCodeTaskExecutionConfigData

// 1. Define Runtime Input
val executionConfig = RunCodeTaskExecutionConfigData(
    goal = "Find all .log files and summarize their size",
    workingDir = "./logs",
    task_description = "Log Analysis"
)

// 2. Run via Harness
harness.runTask(
    taskType = RunCode,
    typeConfig = RunCodeTaskTypeConfig(codeRuntime = CodeRuntimes.GroovyRuntime),
    executionConfig = executionConfig,
    workspace = projectDir,
    autoFix = true // Set to true for headless execution
)

LLM Prompt Segment

The following instructions are injected into the LLM context when this task is active:

RunCode - Use a groovy interpreter to solve and complete the user's request.
  * Do not directly write code (yet)
  * Include detailed technical requirements for the needed solution