Dispatch a task-delegation FC via ``ctx.run_node`` and return the output. ``run_id=fc.id`` makes the child run idempotent across resumes (same FC always maps to the same scheduler-tracked child run). Scope is carried by ``isolation_scope`` (``override_isolation_scope=fc.id``); we intention
(
parent_agent: Any, fc: types.FunctionCall, ctx: Context
)
| 133 | |
| 134 | |
| 135 | async def _dispatch_task_fc( |
| 136 | parent_agent: Any, fc: types.FunctionCall, ctx: Context |
| 137 | ) -> Any: |
| 138 | """Dispatch a task-delegation FC via ``ctx.run_node`` and return the output. |
| 139 | |
| 140 | ``run_id=fc.id`` makes the child run idempotent across resumes (same |
| 141 | FC always maps to the same scheduler-tracked child run). Scope is |
| 142 | carried by ``isolation_scope`` (``override_isolation_scope=fc.id``); we |
| 143 | intentionally do NOT set a branch — task-mode and single_turn-mode |
| 144 | agents share the parent's branch and rely on isolation_scope for |
| 145 | scoping instead. |
| 146 | """ |
| 147 | target_agent = parent_agent.root_agent.find_agent(fc.name) |
| 148 | if target_agent is None: |
| 149 | raise ValueError(f'Task target agent {fc.name!r} not found.') |
| 150 | from .utils._workflow_graph_utils import build_node |
| 151 | |
| 152 | wrapped_target = build_node(target_agent) |
| 153 | wrapped_target.parent_agent = target_agent.parent_agent |
| 154 | return await ctx.run_node( |
| 155 | wrapped_target, |
| 156 | node_input=fc.args, |
| 157 | run_id=fc.id, |
| 158 | override_isolation_scope=fc.id, |
| 159 | raise_on_wait=True, |
| 160 | ) |
| 161 | |
| 162 | |
| 163 | def _synthesize_task_fr_event(fc: types.FunctionCall, output: Any) -> Event: |
no test coverage detected