Class ShellTool
java.lang.Object
com.alibaba.cloud.ai.graph.agent.tools.ShellTool
- All Implemented Interfaces:
BiFunction<ShellTool.Request,org.springframework.ai.chat.model.ToolContext, String>
public class ShellTool
extends Object
implements BiFunction<ShellTool.Request,org.springframework.ai.chat.model.ToolContext,String>
A tool for executing shell commands.
This tool allows for the execution of shell commands within a managed session.
The session's lifecycle and configuration are handled by the
ShellSessionManager.
Example of creating a callback for this tool:
ToolCallback shellToolCallback = ShellTool.createShellToolCallback("/tmp/agent-workspace");
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordDefines the parameters for a shell tool request. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ShellTool.Request request, org.springframework.ai.chat.model.ToolContext toolContext) static ShellTool.BuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
DEFAULT_TOOL_DESCRIPTION
- See Also:
-
-
Constructor Details
-
ShellTool
Constructs a new ShellTool.- Parameters:
sessionManager- The manager for the shell session. Must not be null.
-
-
Method Details
-
apply
public String apply(ShellTool.Request request, org.springframework.ai.chat.model.ToolContext toolContext) - Specified by:
applyin interfaceBiFunction<ShellTool.Request,org.springframework.ai.chat.model.ToolContext, String>
-
getSessionManager
-
builder
-