diff --git a/argos/agent.py b/argos/agent.py index fe3d222..7cc3209 100644 --- a/argos/agent.py +++ b/argos/agent.py @@ -39,15 +39,16 @@ class ArgosAgent: self.max_tasks = max_tasks self.wait_time = wait_time self.auth = auth - headers = { - "Authorization": f"Bearer {self.auth}", - } - self._http_client = httpx.AsyncClient(headers=headers) + self._http_client = None self.agent_id = socket.gethostname() @retry(after=log_failure, wait=wait_random(min=1, max=2)) async def run(self): + headers = { + "Authorization": f"Bearer {self.auth}", + } + self._http_client = httpx.AsyncClient(headers=headers) logger.info("Running agent against %s", self.server) async with self._http_client: while "forever":