Class LlmActor
- All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName,AutoCloseable
Actor that calls an LLM service via MCP (Model Context Protocol) Streamable HTTP transport.
Default target: quarkus-chat-ui-claude at localhost:8090.
Can be dynamically loaded via loader.loadMaven in workflow YAML.
Supported actions:
setUrl- Configure the MCP server base URLprompt- Send a prompt to the LLM and receive a responsestatus- Query the LLM service statuslistTools- List available tools on the MCP server
- Since:
- 1.0.0
- Author:
- devteam@scivicslab.com
-
Field Summary
Fields inherited from class com.scivicslab.pojoactor.core.ActorRef
actorName, actorSystem, object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.scivicslab.pojoactor.core.ActionResultCalls thecall_agenttool on the MCP Gateway, which routes the prompt to a named agent and blocks until the reply arrives (up to 5 minutes).com.scivicslab.pojoactor.core.ActionResultLists available tools on the MCP server via thetools/listJSON-RPC method.com.scivicslab.pojoactor.core.ActionResultSends a prompt to the LLM via the MCPtools/callmethod.voidsetOutputListener(Consumer<String> listener) Sets an output listener that will be called with status messages, LLM responses, and error notifications.com.scivicslab.pojoactor.core.ActionResultSets the MCP server base URL.com.scivicslab.pojoactor.core.ActionResultRetrieves the LLM service status via the MCPtools/callmethod.Methods inherited from class com.scivicslab.turingworkflow.workflow.IIActorRef
callByActionName, hasAnnotatedAction, invokeAnnotatedAction, parseFirstArgumentMethods inherited from class com.scivicslab.pojoactor.core.ActorRef
ask, ask, askNow, clearJsonState, clearPendingMessages, close, createChild, expandVariables, getJsonBoolean, getJsonInt, getJsonString, getJsonString, getLastResult, getName, getNamesOfChildren, getParentName, hasJson, hasJsonState, initLogger, isAlive, json, putJson, setLastResult, setParentName, system, tell, tell, tellNow, toStringOfJson, toStringOfYaml
-
Constructor Details
-
LlmActor
Creates a newLlmActorwith the given name and actor system.- Parameters:
name- the actor name used for identification within the workflowsystem- the actor system this actor belongs to
-
-
Method Details
-
setOutputListener
Sets an output listener that will be called with status messages, LLM responses, and error notifications.- Parameters:
listener- a consumer that receives output messages, ornullto disable
-
setUrl
Sets the MCP server base URL. Resets any existing MCP session.Expected argument: the base URL string (e.g.,
"http://localhost:8090/mcp").- Parameters:
url- the MCP server base URL; must not benullor blank- Returns:
- an
ActionResultindicating success with the configured URL, or failure if the URL is missing
-
prompt
Sends a prompt to the LLM via the MCPtools/callmethod.Expected argument: the prompt text as a plain string. The prompt is sent to the
sendPrompttool on the MCP server with an empty model selector (server default).- Parameters:
promptText- the prompt text to send; must not benullor blank- Returns:
- an
ActionResultcontaining the LLM response text on success, or an error message on failure
-
status
Retrieves the LLM service status via the MCPtools/callmethod.Expected argument: ignored (may be
nullor empty).- Parameters:
args- unused argument (required by the action framework signature)- Returns:
- an
ActionResultcontaining the status information on success, or an error message on failure
-
listTools
Lists available tools on the MCP server via thetools/listJSON-RPC method.Expected argument: ignored (may be
nullor empty).- Parameters:
args- unused argument (required by the action framework signature)- Returns:
- an
ActionResultcontaining the JSON list of available tools on success, or an error message on failure
-
callAgent
Calls thecall_agenttool on the MCP Gateway, which routes the prompt to a named agent and blocks until the reply arrives (up to 5 minutes).Expected argument formats:
- JSON array:
["agentName", "prompt text"] - JSON object:
{"agent": "agentName", "prompt": "text", "model": "sonnet"}
- Parameters:
args- JSON array or object containing agent name and prompt- Returns:
- an
ActionResultcontaining the agent's reply on success
- JSON array:
-