(spec: _AgentToolSpec, default_trust_remote_code: bool)
| 70 | |
| 71 | |
| 72 | def _build_sub_agent(spec: _AgentToolSpec, default_trust_remote_code: bool): |
| 73 | if spec.inline_config is not None: |
| 74 | config_override = OmegaConf.create(spec.inline_config) |
| 75 | else: |
| 76 | config_override = None |
| 77 | |
| 78 | trust_remote_code = spec.trust_remote_code |
| 79 | if trust_remote_code is None: |
| 80 | trust_remote_code = default_trust_remote_code |
| 81 | |
| 82 | tag = f'{spec.tag_prefix}{uuid.uuid4().hex[:8]}' |
| 83 | agent = AgentLoader.build( |
| 84 | config_dir_or_id=spec.config_path, |
| 85 | config=config_override, |
| 86 | env=spec.env, |
| 87 | tag=tag, |
| 88 | trust_remote_code=trust_remote_code, |
| 89 | ) |
| 90 | |
| 91 | generation_cfg = getattr(agent.config, 'generation_config', DictConfig({})) |
| 92 | agent.config.generation_config = generation_cfg |
| 93 | return agent |
| 94 | |
| 95 | |
| 96 | def _run_agent_in_subprocess( |
no test coverage detected