Package com.tnsai.agents.execution
Interface AgentToolExecutor.AgentContext
- All Known Implementing Classes:
AgentOrchestrator
- Enclosing class:
AgentToolExecutor
public static interface AgentToolExecutor.AgentContext
Context interface for Agent - provides access to agent internals.
This avoids circular dependency while allowing the executor to access what it needs.
Note: Method names use "getAgent*" pattern to avoid conflicts with Agent's protected abstract template methods.
-
Method Summary
Modifier and TypeMethodDescriptionchatInternal(String message, boolean useHistory) Callback for follow-up chat after tool execution (tools disabled, prevents recursion)default StringchatInternal(String message, boolean useHistory, String retrievalQuery, ChatRetrievalContext retrievalContext) No-tools follow-up preserving the originating RAG turn.default ObjectchatInternalWithTools(String message, boolean useHistory) Callback for follow-up chat with tools enabled (for multi-turn tool loops).default ObjectchatInternalWithTools(String message, boolean useHistory, String retrievalQuery, ChatRetrievalContext retrievalContext) Tool-loop follow-up preserving the originating RAG turn.<T> TexecuteWithSpinner(Supplier<T> operation) Callback for executing spinner-wrapped operationsdefault voidfireOnAfterToolCall(String toolName, Object result, boolean success, long latencyMs) Fires onAfterToolCall hookdefault voidfireOnBeforeToolCall(String toolName, Map<String, Object> arguments) Fires onBeforeToolCall hookThe knowledge some actions use instead of what their@ActionSpecnames: entry names by action name.default List<KnowledgeEntry> The agent's action-level knowledge with each entry'suse.default Optional<KnowledgeScope> default List<KnowledgeSourceConfig> The sources of the agent's action-level knowledge.default EvalContextGets the evaluation context for metric collectiondefault voidreportKnowledgeUsage(String scope, List<KnowledgeUsage> usage) Receives what each knowledge source gave onescope: an action name, or"chat"for a chat turn.voidrestartAgent(String reason) Callback for agent restart
-
Method Details
-
getAgentId
String getAgentId() -
getAgentName
String getAgentName() -
getAgentRoles
-
getAgentLLM
LLMClient getAgentLLM() -
getAgentMemoryStore
MemoryStore getAgentMemoryStore() -
getAgentActionExecutor
ActionExecutor getAgentActionExecutor() -
getAgentSchemaGenerator
ToolSchemaGenerator getAgentSchemaGenerator() -
getAgentKnowledgeSources
The sources of the agent's action-level knowledge.- Returns:
- action-level knowledge sources
- Since:
- 0.13.0
-
getAgentKnowledgeEntries
The agent's action-level knowledge with each entry'suse. By default everygetAgentKnowledgeSources()source, searched.- Returns:
- the agent's knowledge entries
- Since:
- 0.18.0
-
getAgentActionKnowledge
The knowledge some actions use instead of what their@ActionSpecnames: entry names by action name.- Returns:
- entry names by action name; empty by default
- Since:
- 0.18.0
-
getAgentKnowledgeScope
-
reportKnowledgeUsage
Receives what each knowledge source gave onescope: an action name, or"chat"for a chat turn. Does nothing by default.- Parameters:
scope- the action name or"chat"usage- one row per source, in declaration order- Since:
- 0.18.0
-
executeWithSpinner
Callback for executing spinner-wrapped operations -
chatInternal
Callback for follow-up chat after tool execution (tools disabled, prevents recursion) -
chatInternalWithTools
Callback for follow-up chat with tools enabled (for multi-turn tool loops). Returns raw Object (ChatResponse or String) so caller can check for more tool calls. -
chatInternalWithTools
default Object chatInternalWithTools(String message, boolean useHistory, String retrievalQuery, ChatRetrievalContext retrievalContext) Tool-loop follow-up preserving the originating RAG turn. -
chatInternal
default String chatInternal(String message, boolean useHistory, String retrievalQuery, ChatRetrievalContext retrievalContext) No-tools follow-up preserving the originating RAG turn. -
restartAgent
Callback for agent restart -
getEvalContext
Gets the evaluation context for metric collection -
fireOnBeforeToolCall
Fires onBeforeToolCall hook -
fireOnAfterToolCall
Fires onAfterToolCall hook
-