Made the AgentEnvironment conent ThreadStatic.