feat(python-sdk): expose subagent task query API#39
Merged
Conversation
7 tasks
7fad254 to
df5b49a
Compare
Mirrors the new Session APIs onto the Python SDK so callers can introspect delegated subagent tasks symmetrically with the Node SDK. - `Session.subagent_task(task_id)` → dict or None - `Session.subagent_tasks()` → list of dicts (this session) - `Session.pending_subagent_tasks()` → only `running` entries Each method follows the existing run-query pattern: drop the GIL via `py.allow_threads`, block on the tokio runtime, then serialize the result via serde_json so Python sees plain dict / list / None. Smoke test under `tests/test_subagent_query_api.py` confirms the three methods exist and return the expected empty-state shapes for a fresh session, without needing real LLM credentials.
df5b49a to
cc20a8d
Compare
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors the new `AgentSession` subagent query API (introduced in #35) onto the Python SDK so callers can introspect delegated subagent tasks symmetrically with the Node SDK (#37).
```python
snap = session.subagent_task('task-abc')
dict with keys: task_id, parent_session_id, child_session_id, agent,
description, status, started_ms, updated_ms, finished_ms?, output?,
success?, progress: [...] (status ∈ {'running','completed','failed'})
or None when the task id is unknown.
all_tasks = session.subagent_tasks() # list (this session, oldest first)
pending = session.pending_subagent_tasks() # list (status == 'running' only)
```
Each binding follows the existing run-query pattern: drops the GIL via `py.allow_threads`, blocks on the shared tokio runtime, then serializes the result through serde_json so Python sees plain `dict` / `list` / `None`.
Test plan
Follow-ups