Class ComputerUseCallManager
Manages and executes computer actions that can be called by AI agents.
Inheritance
Implements
Inherited Members
Namespace: Glitch9.AIDevKit.Agents
Assembly: Glitch9.AIDevKit.Agent.dll
Syntax
[AddComponentMenu("AI DevKit/AI Agents/Computer Use Call Manager", 21)]
public class ComputerUseCallManager : ToolCallManagerBase<ComputerUseCall, ComputerUseOutput>, IComputerUseExecutor, IToolCallExecutor<ComputerUseCall, ComputerUseOutput>, IComputerUseActionHandler
Fields
| Edit this page View SourceonInputEventReceived
Declaration
public UnityEvent<Event> onInputEventReceived
Field Value
| Type | Description |
|---|---|
| UnityEvent<Event> |
onKeyboardTyped
Declaration
public UnityEvent<string> onKeyboardTyped
Field Value
| Type | Description |
|---|---|
| UnityEvent<string> |
Properties
| Edit this page View SourceApi
Declaration
public Api Api { get; set; }
Property Value
| Type | Description |
|---|---|
| Api |
ScreenshotPathType
Declaration
public ScreenshotPathType ScreenshotPathType { get; }
Property Value
| Type | Description |
|---|---|
| ScreenshotPathType |
Methods
| Edit this page View SourceCanExecute(string)
Always returns true; this manager handles all computer use calls regardless of name.
Declaration
public bool CanExecute(string toolName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | toolName |
Returns
| Type | Description |
|---|---|
| bool |
CreateErrorOutput(ComputerUseCall, Exception)
Declaration
protected override ComputerUseOutput CreateErrorOutput(ComputerUseCall call, Exception ex)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputerUseCall | call | |
| Exception | ex |
Returns
| Type | Description |
|---|---|
| ComputerUseOutput |
Overrides
| Edit this page View SourceExecuteAsyncInternal(ComputerUseCall, CancellationToken)
Executes the given ComputerUseCall by dispatching its action to the platform handler.
Declaration
protected override UniTask<ComputerUseOutput> ExecuteAsyncInternal(ComputerUseCall call, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputerUseCall | call | The computer use call to execute. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask<ComputerUseOutput> | The output produced by the executed computer use action, or |
Overrides
| Edit this page View SourceOnKeyboardKeysPressedAsync(List<string>, CancellationToken)
Simulates pressing a sequence of keyboard keys (e.g., "Ctrl", "Shift", "P").
Declaration
public UniTask OnKeyboardKeysPressedAsync(List<string> keys, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | keys | List of key names to press in order. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnKeyboardTypedAsync(string, CancellationToken)
Simulates typing the given text string as keyboard input.
Declaration
public UniTask OnKeyboardTypedAsync(string text, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to type. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnMouseClickAsync(MouseButton, Vector2, CancellationToken)
Simulates a mouse button click at the specified screen position.
Declaration
public UniTask OnMouseClickAsync(MouseButton button, Vector2 position, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| MouseButton | button | The mouse button to click. |
| Vector2 | position | The screen position of the click. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnMouseDoubleClickAsync(Vector2, CancellationToken)
Simulates a mouse double-click at the specified screen position.
Declaration
public UniTask OnMouseDoubleClickAsync(Vector2 position, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The screen position of the double-click. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnMouseDragAsync(List<Vector2>, CancellationToken)
Simulates a mouse drag operation along the specified path of screen positions.
Declaration
public UniTask OnMouseDragAsync(List<Vector2> path, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| List<Vector2> | path | Ordered list of screen positions to drag through. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnMouseMoveAsync(Vector2, CancellationToken)
Moves the mouse cursor to the specified screen position.
Declaration
public UniTask OnMouseMoveAsync(Vector2 position, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The target screen position. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnMouseScrollAsync(Vector2, Vector2, CancellationToken)
Simulates a mouse scroll wheel event at the specified screen position.
Declaration
public UniTask OnMouseScrollAsync(Vector2 position, Vector2 scroll, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The screen position of the scroll event. |
| Vector2 | scroll | The scroll delta in X and Y axes. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
OnTakeScreenshotAsync(CancellationToken)
Takes a screenshot and returns either an uploaded file ID or a cloud storage URL depending on ScreenshotPathType.
Declaration
public UniTask<string> OnTakeScreenshotAsync(CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask<string> | The uploaded file ID if FileId; otherwise a URL string. |
OnWaitAsync(CancellationToken)
Waits for a platform-defined duration before the next action is executed.
Declaration
public UniTask OnWaitAsync(CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask |
SetSafetyCheckService(IComputerUseSafetyCheckService)
Sets the safety check service used to approve or reject pending computer use safety checks.
Declaration
public void SetSafetyCheckService(IComputerUseSafetyCheckService service)
Parameters
| Type | Name | Description |
|---|---|---|
| IComputerUseSafetyCheckService | service | The safety check service implementation. |
ValidateCall(ComputerUseCall)
Declaration
protected override void ValidateCall(ComputerUseCall call)
Parameters
| Type | Name | Description |
|---|---|---|
| ComputerUseCall | call |