# Event streams

Go inputs, results, permissions and executable examples for event streams.

Use this reference with the [complete developer tour](https://beepgrid.com/docs/sdks/go/tour.md) and [Go types](https://beepgrid.com/docs/sdks/go/types.md). The example at the end runs after the tour setup.

## StreamEvents

Consume authorized canonical events with reconnect and a sequence checkpoint.

```text
func (c *Client) StreamEvents(ctx context.Context, options EventOptions, handle func(Event) error) error
```

| Parameter | Type and default | Usage |
| --- | --- | --- |
| `ctx` | `context.Context` (required) | Required Go context. Cancellation bounds this local call; it does not withdraw a durable request. |
| `options` | `EventOptions` (required) | Optional fields supported by this operation, listed in the linked HTTP input. Unknown fields are not a supported extension mechanism. |
| `handle` | `func(Event) error` (required) | Required event callback; return an error to stop without advancing the handled checkpoint. |

**Returns:** Python iterator or TypeScript async iterator of events; Go callback with error return.

**Permissions, lifecycle and errors:** Persist a checkpoint after applying each event. Go options add conversation filtering; Python supports conversation_id; TypeScript EventOptions exposes after, summary and signal. Summary streams omit full bodies. A denial stops reconnecting.

[Working Go example](https://beepgrid.com/docs/sdks/go/events/#example). Input/output fields are in the [types reference](https://beepgrid.com/docs/sdks/go/types.md).

## Example

Run this region after [the shared setup](https://beepgrid.com/docs/sdks/go/tour.md). Assertions check the returned data; the full tour is a runnable program.



```go
streamCtx, cancelStream := context.WithTimeout(ctx, 5*time.Second)
found := false
err = billing.StreamEvents(streamCtx, beepgrid.EventOptions{}, func(event beepgrid.Event) error {
	if event.Kind == "message.created" && event.ConversationID == sent.ConversationID {
		check(event.Sequence > 0)
		found = true
		cancelStream()
	}
	return nil // Persist the checkpoint only after applying the event.
})
check(found && err != nil)
cancelStream()
```
