Convert a Python spec dict into an `AgentStepSpec` (snake_case keys) via a JSON round-trip.
(py: Python<'_>, obj: &Bound<'_, PyAny>)
| 3456 | /// Convert a Python spec dict into an `AgentStepSpec` (snake_case keys) via a |
| 3457 | /// JSON round-trip. |
| 3458 | fn py_to_step_spec(py: Python<'_>, obj: &Bound<'_, PyAny>) -> PyResult<RustAgentStepSpec> { |
| 3459 | serde_json::from_str(&py_dumps(py, obj)?) |
| 3460 | .map_err(|e| PyValueError::new_err(format!("invalid AgentStepSpec: {e}"))) |
| 3461 | } |
| 3462 | |
| 3463 | /// Convert an arbitrary Python value into a `serde_json::Value`. |
| 3464 | fn py_to_json_value(py: Python<'_>, obj: &Bound<'_, PyAny>) -> PyResult<serde_json::Value> { |