Package com.tnsai.coordination.pool
Class AgentHandle
java.lang.Object
com.tnsai.coordination.pool.AgentHandle
- All Implemented Interfaces:
AutoCloseable
A checked-out agent handle that returns the agent to the pool on
close().
Implements AutoCloseable for use in try-with-resources.-
Method Details
-
execute
Delegates a chat message to the underlying agent.- Parameters:
task- the message to send- Returns:
- the agent's response
-
getAgent
public com.tnsai.agents.Agent getAgent()Returns the underlying agent for direct access. -
getCheckoutDurationMs
public long getCheckoutDurationMs()Returns the duration in ms since this handle was checked out. -
close
public void close()Returns the agent to the pool. Safe to call multiple times (no-op after first).- Specified by:
closein interfaceAutoCloseable
-