Skip to content

Add SSE streaming support to Python SDK #10

@sunilp

Description

@sunilp

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

  1. Add stream_task() method to LdpClient that returns an async iterator of TaskEvent
  2. Add SSE endpoint to LdpDelegate at /ldp/stream/{task_id}
  3. Yield TaskEvent.Progress, TaskEvent.Completed, or TaskEvent.Failed events
  4. Add on_progress callback support in LdpDelegate.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.92

Why 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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsdkSDK implementations (Python, TypeScript, Go)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions