mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 07:04:48 +00:00
fix(agent-management): pass env vars to agent in spawn_streaming
The spawn_streaming() function was not passing environment variables from SpawnOptions.env to the spawned process. This caused agents like Claude to not receive ANTHROPIC_API_KEY, resulting in silent authentication failures. The non-streaming spawn() method correctly passes env vars (lines 298-300), but spawn_streaming() was missing this code path. This fix adds the same env var loop to spawn_streaming(), ensuring that credentials extracted from the host environment are properly passed to spawned agents.
This commit is contained in:
parent
ab210fa38a
commit
c4b033a5c0
1 changed files with 6 additions and 0 deletions
|
|
@ -327,6 +327,12 @@ impl AgentManager {
|
|||
options.streaming_input = true;
|
||||
}
|
||||
let mut command = self.build_command(agent, &options)?;
|
||||
|
||||
// Pass environment variables to the agent process (e.g., ANTHROPIC_API_KEY)
|
||||
for (key, value) in &options.env {
|
||||
command.env(key, value);
|
||||
}
|
||||
|
||||
if matches!(agent, AgentId::Codex | AgentId::Claude) {
|
||||
command.stdin(Stdio::piped());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue