Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(runtime): correctly set session_api_key for local runtime (#10506)

Xingyao Wang4a3f5dd9b48a
diff --git a/openhands/runtime/impl/local/local_runtime.py b/openhands/runtime/impl/local/local_runtime.py
index 5b5e354e98..208e89cf33 100644
--- a/openhands/runtime/impl/local/local_runtime.py
+++ b/openhands/runtime/impl/local/local_runtime.py
@@ -201,8 +201,14 @@ class LocalRuntime(ActionExecutionClient):
# If there is an API key in the environment we use this in requests to the runtime
session_api_key = os.getenv('SESSION_API_KEY')
+ self._session_api_key: str | None = None
if session_api_key:
self.session.headers['X-Session-API-Key'] = session_api_key
+ self._session_api_key = session_api_key
+
+ @property
+ def session_api_key(self) -> str | None:
+ return self._session_api_key
@property
def action_execution_server_url(self) -> str: