Class SwingAgiTool
java.lang.Object
uno.anahata.asi.agi.tool.ToolContext
uno.anahata.asi.swing.toolkit.SwingToolContext
uno.anahata.asi.swing.agi.tool.SwingAgiTool
The foundational base class for all Swing-based agentic tools.
This class extends SwingToolContext to bridge the gap between background
AI tool execution and the Swing Event Dispatch Thread (EDT). It provides
built-in support for context-aware UI updates via runInEdt and
runInEdtAndWait helpers.
All Swing-aware tools must implement the Callable.call() method to define
their core logic.
- Author:
- anahata
-
Field Summary
Fields inherited from class ToolContext
toolkitModifier and TypeFieldDescriptionprotected JavaObjectToolkitThe toolkit instance that owns this context. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class SwingToolContext
getAgiPanel, runInEdt, runInEdtAndWaitModifier and TypeMethodDescriptionConvenience method to get the AgiPanel for this Agi from the java tool.voidExecutes a task on the EDT in a non-blocking manner while maintaining full context awareness.voidrunInEdtAndWait(Runnable runnable) Executes a task on the EDT and blocks the current thread until the task is complete, maintaining full context awareness throughout.Methods inherited from class ToolContext
addAttachment, addAttachment, addAttachment, error, getAgi, getApplicationMap, getAsiContainer, getAsiContainerMap, getCall, getExecutorService, getModelId, getModelMessage, getResourceManager, getResponse, getSessionMap, getThreadSafeLogger, getTool, getToolContext, getToolkit, getToolManager, getTurnMap, isToolExecution, log, peekResponse, runAsyncModifier and TypeMethodDescriptionvoidaddAttachment(byte[] data, String mimeType) Attaches a binary blob to the current tool's response.voidaddAttachment(File file) Convenience method to attach a file to the current tool's response.voidaddAttachment(Path path) Convenience method to attach a file from a Path to the current tool's response.voidAdds an error message to the current tool's response.getAgi()Convenience method to get the parent agi container for the current execution.Gets a static, application-scoped map for sharing objects across all containers in the current JVM.Gets the current ASI container hosting this Agi container is running.Gets a map for sharing objects across all sessions within the current ASI container.getCall()Convenience method to get the current tool call that initiated this execution.Convenience method to get the executor service for the current agi session.The id of model that is executing the tool.The id of model that is executing the tool.Convenience method to get the application's ResourceManager.Gets the current tool response from the thread-local context.Gets a shared map for storing state across turns within the current agi session.Gets a thread-safe logging consumer that automatically propagates the current tool execution context whenever a message is logged.getTool()Convenience method to get the metadata for the tool currently being executed.Returns a thread-safe snapshot of this context.<T> TgetToolkit(Class<T> toolkitClass) Retrieves the singleton instance of a registered toolkit class.Convenience method to get the application's global ToolManager.Gets a shared map for storing state across turns within the current agi session.booleanChecks if the current thread or this context instance is associated with an active tool execution.voidAdds a standard log message to the current tool's response.protected JavaMethodToolResponseInternal helper to retrieve the response if it exists, without throwing an exception.voidExecutes a task asynchronously in the session's executor service, automatically propagating the current tool execution context to the background thread.
-
Constructor Details
-
SwingAgiTool
public SwingAgiTool()
-

