MCPcopy Create free account
hub / github.com/modelscope/ms-agent / _build_sub_agent

Function _build_sub_agent

ms_agent/tools/agent_tool.py:72–93  ·  view source on GitHub ↗
(spec: _AgentToolSpec, default_trust_remote_code: bool)

Source from the content-addressed store, hash-verified

70
71
72def _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
96def _run_agent_in_subprocess(

Callers 2

_run_agent_in_subprocessFunction · 0.85
_build_agentMethod · 0.85

Calls 1

buildMethod · 0.45

Tested by

no test coverage detected