Simplify thread static management for AgentEnvironment.