# open_style_link

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/tui/widgets/_links/open_style_link)

Open the URL from a Rich link style on click, if present.

Rich `Style(link=...)` embeds OSC 8 terminal hyperlinks, but Textual's
mouse capture intercepts normal clicks before the terminal can act on them.
By handling the Textual click event directly we open the URL with a single
click, matching the behavior of links in the Markdown widget.

URLs that fail the safety check (e.g. containing hidden Unicode or
homograph domains) are blocked and not opened; the event bubbles and a
warning is logged and displayed as a Textual notification.

On success the event is stopped so it does not bubble further and, unless
the user has opted out, a best-effort informational toast reports the URL
that was opened. If the browser cannot be launched -- either
`webbrowser.open` raises or the backend declines and returns a falsy value
-- a warning toast with the URL is shown so it can be copied manually, the
failure is logged, and the event bubbles normally.

## Signature

```python
open_style_link(
    event: Click,
    *,
    app: App | None = None,
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `event` | `Click` | Yes | The Textual click event to inspect. |
| `app` | `App \| None` | No | App used to post browser-open notifications. (default: `None`) |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2f56309d821db4a0d06ee03959cf842c91b7f228/libs/code/deepagents_code/tui/widgets/_links.py#L208)