Get current working memory items. Working memory holds the active context items for the current task. Returns: List of memory item dicts currently in working memory.
(&self, py: Python<'py>)
| 3167 | /// Returns: |
| 3168 | /// List of memory item dicts currently in working memory. |
| 3169 | fn get_working<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyList>> { |
| 3170 | let memory = self |
| 3171 | .inner |
| 3172 | .memory() |
| 3173 | .ok_or_else(|| PyRuntimeError::new_err("Memory not configured for this session"))? |
| 3174 | .clone(); |
| 3175 | let items = py.allow_threads(move || get_runtime().block_on(memory.get_working())); |
| 3176 | let json_str = serde_json::to_string(&items) |
| 3177 | .map_err(|e| PyRuntimeError::new_err(format!("Serialization error: {e}")))?; |
| 3178 | let json_mod = py.import("json")?; |
| 3179 | let py_obj = json_mod.call_method1("loads", (json_str,))?; |
| 3180 | py_obj |
| 3181 | .downcast::<PyList>() |
| 3182 | .cloned() |
| 3183 | .map_err(|e| PyRuntimeError::new_err(format!("Unexpected result: {e}"))) |
| 3184 | } |
| 3185 | |
| 3186 | /// Clear working memory. |
| 3187 | /// |
nothing calls this directly
no test coverage detected