> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

> Use the Laravel events emitted by the Laravel Copilot SDK for logging, debugging, and asynchronous processing.

## Laravel events

Event classes under [Events](https://github.com/invokable/laravel-copilot-sdk/tree/main/src/Events) are dispatched at many points throughout the SDK, so you can use them for logging and debugging.

You can achieve similar things with [hooks](/en/packages/laravel-copilot-sdk/hooks), but events also cover places without hooks.

```text theme={null}
src/
├── Events/
│   ├── Client/
│   │   ├── ClientStarted.php
│   │   ├── ToolCall.php
│   │   └── PingPong.php
│   ├── JsonRpc/
│   │   ├── MessageReceived.php
│   │   ├── MessageSending.php
│   │   └── ResponseReceived.php
│   ├── Process/
│   │   └── ProcessStarted.php
│   └── Session/
│       ├── CreateSession.php
│       ├── MessageSend.php
│       ├── MessageSendAndWait.php
│       ├── SessionEventReceived.php
│       └── ResumeSession.php
```

For example, you can push slow work into a queue or `defer`. You won't receive the result of `Copilot::run()` directly, but you can receive it in a listener for the `MessageSendAndWait` event instead.

```php theme={null}
dispatch(fn() => Copilot::run(''));
```

```php theme={null}
use function Illuminate\Support\defer;

defer(fn() => Copilot::run(''));
```

<Info>
  For the latest updates, see the [GitHub repository](https://github.com/invokable/laravel-copilot-sdk).
</Info>


## Related topics

- [Events & Listeners](/en/events.md)
- [Streaming events](/en/packages/laravel-copilot-sdk/streaming-events.md)
- [SessionEvent](/en/packages/laravel-copilot-sdk/session-event.md)
- [Session lifecycle events](/en/packages/laravel-copilot-sdk/session-lifecycle-event.md)
- [Eloquent Observers and Model Events](/en/advanced/eloquent-observers.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.