-
Notifications
You must be signed in to change notification settings - Fork 1
Add SSE streaming support to Python SDK #10
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestsdkSDK implementations (Python, TypeScript, Go)SDK implementations (Python, TypeScript, Go)
Description
Summary
The Python SDK's LdpClient.submit_task() currently blocks until the task completes. For long-running tasks, clients need to stream progress updates via Server-Sent Events (SSE).
What to do
- Add
stream_task()method toLdpClientthat returns an async iterator ofTaskEvent - Add SSE endpoint to
LdpDelegateat/ldp/stream/{task_id} - Yield
TaskEvent.Progress,TaskEvent.Completed, orTaskEvent.Failedevents - Add
on_progresscallback support inLdpDelegate.handle_task()
Example API
# Client side
async for event in client.stream_task(url, skill="reasoning", input_data={...}):
if event.type == "progress":
print(f"Progress: {event.progress}%")
elif event.type == "completed":
print(f"Result: {event.output}")# Delegate side
class MyDelegate(LdpDelegate):
async def handle_task(self, skill, input_data, task_id):
await self.send_progress(task_id, 0.25, "Analyzing...")
await self.send_progress(task_id, 0.75, "Synthesizing...")
return {"answer": "done"}, 0.92Why this matters
Streaming is table-stakes for production agent systems. Without it, long tasks appear frozen from the client's perspective. A2A supports streaming via SSE — LDP should too.
References
- Current polling implementation:
src/adapter.rs(Rust, lines 195-254) - SSE spec: https://html.spec.whatwg.org/multipage/server-sent-events.html
- httpx SSE: https://www.python-httpx.org/advanced/sse/
Acceptance criteria
-
client.stream_task()returns an async iterator - Delegate can send progress updates during task execution
- Works with the existing message protocol (TASK_UPDATE messages)
- Integration test covering the streaming flow
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestsdkSDK implementations (Python, TypeScript, Go)SDK implementations (Python, TypeScript, Go)