MCPcopy Index your code
hub / github.com/AI45Lab/Code / py_worker_agent_spec_to_rust

Function py_worker_agent_spec_to_rust

sdk/python/src/lib.rs:4656–4688  ·  view source on GitHub ↗
(spec: PyWorkerAgentSpec)

Source from the content-addressed store, hash-verified

4654}
4655
4656fn py_worker_agent_spec_to_rust(spec: PyWorkerAgentSpec) -> PyResult<RustWorkerAgentSpec> {
4657 if spec.name.trim().is_empty() {
4658 return Err(PyValueError::new_err("worker agent name is required"));
4659 }
4660 if spec.description.trim().is_empty() {
4661 return Err(PyValueError::new_err(
4662 "worker agent description is required",
4663 ));
4664 }
4665
4666 let mut worker = RustWorkerAgentSpec::new(
4667 parse_py_worker_agent_kind(&spec.kind)?,
4668 spec.name,
4669 spec.description,
4670 )
4671 .hidden(spec.hidden);
4672 if let Some(policy) = spec.permissions {
4673 worker = worker.with_permissions(py_permission_policy_to_rust(policy)?);
4674 }
4675 if let Some(model) = spec.model {
4676 worker = worker.with_model(RustAgentModelConfig::from_model_ref(model));
4677 }
4678 if let Some(prompt) = spec.prompt {
4679 worker = worker.with_prompt(prompt);
4680 }
4681 if let Some(max_steps) = spec.max_steps {
4682 worker = worker.with_max_steps(max_steps);
4683 }
4684 if let Some(ci) = spec.confirmation_inheritance {
4685 worker = worker.with_confirmation(parse_py_confirmation_inheritance(&ci)?);
4686 }
4687 Ok(worker)
4688}
4689
4690fn parse_py_confirmation_inheritance(
4691 value: &str,

Callers 3

session_for_workerMethod · 0.85
register_worker_agentMethod · 0.85

Calls 10

hiddenMethod · 0.80
with_permissionsMethod · 0.80
with_promptMethod · 0.80
with_confirmationMethod · 0.80
is_emptyMethod · 0.45
with_modelMethod · 0.45
with_max_stepsMethod · 0.45

Tested by

no test coverage detected