feat(agents): allow passing agent variables to agent__spawn and agent__task_create

- agent__spawn accepts an optional variables object (string->string);
  values overlay the parent-inherited agent variables per key, with
  inheritance preserved as the fallback layer
- unknown variable names, non-string values, and non-object shapes
  return self-correcting status:error JSON listing the agent's
  declared variables
- spawned children can no longer trigger the interactive variable
  prompt: a new interactive gate in Agent::init_agent_variables routes
  missing required variables to the existing bail path while leaving
  CLI/REPL prompting and --info skip semantics unchanged
- agent__task_create persists variables on the task, agent__task_list
  echoes them, and task auto-dispatch threads them into the spawn
- tool schemas and built-in spawn docs updated; unit tests extended
  in agents.rs and taskqueue.rs
This commit is contained in:
Dark-Alex-17 committed 2026-09-12 01:37:20 -06:00
1 parent 3599b0a861
commit f97a83f165
6 files changed
+339 -35

No files matched your search

+2
View File
@@ -1191,6 +1191,7 @@ impl RequestContext {
agent.defined_variables(),
self.agent_variables.as_ref(),
self.info_flag,
self.self_agent_id.is_none(),
)?;
agent.set_shared_variables(new_variables);
}
@@ -1213,6 +1214,7 @@ impl RequestContext {
agent.defined_variables(),
self.agent_variables.as_ref(),
self.info_flag,
self.self_agent_id.is_none(),
)?;
agent.set_shared_variables(new_variables.clone());
new_variables