AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Operator Mode >

AIU. - Artificial Intelligence Utility

AIU.OperatorAddResult

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.OperatorAddResult
Adds a tool's execution result back into the conversation history.

 

Intention

 

The AIU.OperatorAddResult command (aliased as AIU.Oar) is the essential feedback step in an Operator session. After the AI requests an action with AIU.OperatorRunStep and your script executes it, this command adds the outcome back into the conversation history. This allows the AI to see the result of its previous action and decide what to do next.

 

The command intelligently handles both simple text results (like command-line output) and complex image results (from a screenshot), automatically formatting them correctly for the AI.

 

It’s your robot’s status report—AIU.OperatorAddResult tells the AI "mission accomplished" and provides the data it needs to continue its task.

 

Illustration

 

┌──────────────────┐          ┌──────────────────┐          ┌────────────────────────┐

│ AI Action Request│          │ Script Executes  │          │ Add Result Back        │

├──────────────────┤          │ Tool (e.g. Read) │          ├────────────────────────┤

│ ID: call_abc123  ├─▶        ├──────────────────┤─▶        │ AIU.OperatorAddResult  │

│ Name: read_file  │          │ Result: "Hello"  │          │ ID: call_abc123        │

└──────────────────┘          └──────────────────┘          │ Result: "Hello"        │

                                                            └─────────┬──────────────┘

                                                                 │

                                                               ▼

                                                     ┌──────────────────┐

                                                     │ History Updated  │

                                                     └──────────────────┘

                                         Completing the feedback loop by adding a tool result to the history.

 

 

 

Syntax

 

AIU.OperatorAddResult|$$TID|$$RES

 

Parameter Explanation

 

P1 - $$TID - (Variable, String, Required)

The unique tool_call_id that was provided by the AI for the action you just executed.

 

P2 - $$RES - (Variable, String, Required)

The result of the tool execution. This can be one of two formats:
1. Plain Text: The direct text output from a command.
2. Image Result: The structured string returned by AIU.Screenshot (e.g., "filepath|type|...").

 

Examples

 

'***********************************

' AIU.OperatorAddResult - Sample 1: Adding a Text Result

'***********************************

' Assume AI requested to read a file with ID "call_abc123"

VAR.$$TID=call_abc123

VAR.$$PTH=C:\data\report.txt

RFI.$$PTH|$$RES ' Read file into $$RES

 

' Add the file content as the result for the tool call

AIU.OperatorAddResult|$$TID|$$RES

END.

 

'***********************************

' AIU.OperatorAddResult - Sample 2: Adding a Screenshot Result

'***********************************

' Assume AI requested a screenshot with ID "call_xyz789"

VAR.$$TID=call_xyz789

 

' Take the screenshot

AIU.Screenshot|active_window|$$RES

 

' Pass the structured result from AIU.Screenshot directly.

' The command will automatically handle the file encoding and cleanup.

AIU.OperatorAddResult|$$TID|$$RES

END.

 

Remarks

 

- This command modifies the history array that was configured by AIU.OperatorBeginSession.

- When an image result from AIU.Screenshot is provided, this command will automatically read the image file, encode it to Base64, construct the complex multi-part message for the AI, and then delete the temporary image file.

- This command has no direct return value. It is a procedural step in the Operator workflow.

 

See also:

 

AIU.OperatorRunStep

AIU.Screenshot

AIU.OperatorBeginSession