RunAgent implements agenttool.Runner. It starts a sub-agent synchronously and blocks until completion or cancellation. Background tasks run with tools pre-approved because there is no user present to respond to interactive approval prompts during async execution. This is a deliberate design trade-o
(ctx context.Context, params agenttool.RunParams)
| 481 | // runtime supports per-session permission scoping rather than a single |
| 482 | // shared ToolsApproved flag. |
| 483 | func (r *LocalRuntime) RunAgent(ctx context.Context, params agenttool.RunParams) *agenttool.RunResult { |
| 484 | return r.runCollecting(ctx, params.ParentSession, SubSessionConfig{ |
| 485 | Task: params.Task, |
| 486 | ExpectedOutput: params.ExpectedOutput, |
| 487 | AgentName: params.AgentName, |
| 488 | Title: "Background agent task", |
| 489 | ToolsApproved: true, |
| 490 | NonInteractive: true, |
| 491 | PinAgent: true, |
| 492 | }, params.OnContent) |
| 493 | } |
| 494 | |
| 495 | func (r *LocalRuntime) handleTaskTransfer(ctx context.Context, sess *session.Session, toolCall tools.ToolCall, evts EventSink) (*tools.ToolCallResult, error) { |
| 496 | var params struct { |