Package com.axelor.ai.tool.builder
Class TryAgentTool
java.lang.Object
com.axelor.ai.tool.builder.TryAgentTool
- All Implemented Interfaces:
SystemTool<TryAgentTool.Input>
Runs an agent on a request a user would make, as a trial (see
ChatRequest.trial): its
writes run and are undone, and the builder reads back the answer and every call the agent made,
with what each returned or why it failed. The agent may be disabled, as a new one is.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbeforeApproval(TryAgentTool.Input input, ToolContext context) Looked at before the user is asked to approve a call, for a tool that needs approval: a refusal known up front should not cost the user a decision.callTitle(TryAgentTool.Input input, String name) What to call one call of this tool, given what it was called with.code()Unique code matching AiTool.systemTool field.Brief description of what this tool does.execute(TryAgentTool.Input input, ToolContext context) Execute with the given typed input and agent-scoped context.The input record class.name()Human-readable display name (e.g.booleanWhether this tool opens its own transactions and must run outside the call's.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.axelor.ai.tool.system.SystemTool
provideContext, refusal, safety, undoneByRollback
-
Field Details
-
CODE
- See Also:
-
-
Method Details
-
code
Description copied from interface:SystemToolUnique code matching AiTool.systemTool field.- Specified by:
codein interfaceSystemTool<TryAgentTool.Input>
-
name
Description copied from interface:SystemToolHuman-readable display name (e.g. "Search Records").- Specified by:
namein interfaceSystemTool<TryAgentTool.Input>
-
description
Description copied from interface:SystemToolBrief description of what this tool does.- Specified by:
descriptionin interfaceSystemTool<TryAgentTool.Input>
-
inputType
Description copied from interface:SystemToolThe input record class. ReturnVoid.classfor tools with no input.- Specified by:
inputTypein interfaceSystemTool<TryAgentTool.Input>
-
runsOutsideTransaction
public boolean runsOutsideTransaction()Description copied from interface:SystemToolWhether this tool opens its own transactions and must run outside the call's. A tool whose work is several steps, each to be committed on its own as a browser commits each request, returns true; every other tool keeps the one transaction that makes its writes atomic.- Specified by:
runsOutsideTransactionin interfaceSystemTool<TryAgentTool.Input>
-
callTitle
Description copied from interface:SystemToolWhat to call one call of this tool, given what it was called with.One call of a tool is not like the next: a tool that takes one record or several cannot be named accurately by its configuration alone. The name it is configured with is passed in, and returning it — as the default does — is what leaves the tool named the way the administrator named it.
- Specified by:
callTitlein interfaceSystemTool<TryAgentTool.Input>- Parameters:
input- the call's input, or null when the tool takes nonename- the tool's configured display name
-
beforeApproval
Description copied from interface:SystemToolLooked at before the user is asked to approve a call, for a tool that needs approval: a refusal known up front should not cost the user a decision. Return anToolResult.Errorto refuse the call without asking, aToolResult.PendingApprovalto ask with what its card should show, or null to ask as usual. The call itself checks again when it runs.- Specified by:
beforeApprovalin interfaceSystemTool<TryAgentTool.Input>- Parameters:
input- the call's input, or null when the tool takes nonecontext- the call's context
-
execute
Description copied from interface:SystemToolExecute with the given typed input and agent-scoped context.- Specified by:
executein interfaceSystemTool<TryAgentTool.Input>
-