# dispatch_hook_fire_and_forget

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/hooks/dispatch_hook_fire_and_forget)

Schedule `dispatch_hook` as a background task with a strong reference.

Use this instead of bare `create_task(dispatch_hook(...))` to prevent the
task from being garbage collected before completion.

Safe to call from sync code as long as an event loop is running.

## Signature

```python
dispatch_hook_fire_and_forget(
    event: str,
    payload: dict[str, Any],
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `event` | `str` | Yes | Dotted event name (e.g. `'session.start'`). |
| `payload` | `dict[str, Any]` | Yes | Arbitrary JSON-serializable dict sent on the command's stdin. |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/b710a69b12e49479045eaa54dfb709326473500b/libs/cli/deepagents_cli/hooks.py#L187)