MockEnvironment
class MockEnvironment(toolRegistry: ToolRegistry, promptExecutor: PromptExecutor, baseEnvironment: AIAgentEnvironment? = null) : AIAgentEnvironment(source)
A mock implementation of AIAgentEnvironment used for testing agent behavior.
This class provides a controlled environment for testing agents by:
Executing tool calls using either mocked responses or actual tool implementations
Handling exceptions by re-throwing them for test visibility
Optionally delegating termination signals to a base environment
It works in conjunction with MockLLMExecutor to provide a complete testing framework for agent interactions.
Constructors
Link copied to clipboard
constructor(toolRegistry: ToolRegistry, promptExecutor: PromptExecutor, baseEnvironment: AIAgentEnvironment? = null)
Functions
Link copied to clipboard
open suspend override fun executeTools(toolCalls: List<Message.Tool.Call>): List<ReceivedToolResult>
Executes a list of tool calls and returns their results.
Link copied to clipboard
Reports a problem by throwing the exception.