akseljoonas HF Staff commited on
Commit
9ed57ca
·
1 Parent(s): 5969911

feat: inject OAuth token as HF_TOKEN secret into sandbox Space

Browse files
Files changed (1) hide show
  1. agent/tools/sandbox_tool.py +3 -0
agent/tools/sandbox_tool.py CHANGED
@@ -66,6 +66,9 @@ async def _ensure_sandbox(
66
  sb = await asyncio.to_thread(Sandbox.create, **kwargs)
67
  session.sandbox = sb
68
 
 
 
 
69
  await session.send_event(
70
  Event(
71
  event_type="tool_log",
 
66
  sb = await asyncio.to_thread(Sandbox.create, **kwargs)
67
  session.sandbox = sb
68
 
69
+ # Inject the OAuth token into the sandbox so Hub operations work inside it
70
+ await asyncio.to_thread(api.add_space_secret, sb.space_id, "HF_TOKEN", token)
71
+
72
  await session.send_event(
73
  Event(
74
  event_type="tool_log",