summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/python/docs/usage/streaming.md
blob: 31066e8dec90263879c0f14f27e9701f456151ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Streaming (SSE)

Subscribe to the event stream. The wrapper provides both sync and async interfaces.

```python
from opencode_ai import OpenCodeClient

client = OpenCodeClient()

# Sync streaming
for event in client.subscribe_events():
    print(event)
    break
```

Async variant:

```python
import asyncio
from opencode_ai import OpenCodeClient

async def main():
    client = OpenCodeClient()
    async for event in client.subscribe_events_async():
        print(event)
        break

asyncio.run(main())
```