removeAgentContext

internal fun removeAgentContext(agentId: String, reason: String): AgentContext?(source)

Removes an agent context when an agent disconnects.

This method is called when an agent disconnects from the proxy, either gracefully or due to network issues. It performs cleanup by removing the agent from both the path manager (so requests are no longer routed to it) and the context manager (to free up resources).

Return

The removed AgentContext, or null if the agent was not found

Parameters

agentId

Unique identifier of the agent that disconnected. Must not be empty.

reason

Human-readable description of why the agent was removed (for logging)

Throws

if agentId is empty