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

# Tree inspection

> Inspect Nexus stored traces as parent-child execution trees

Nexus includes helper methods to inspect stored events after they are persisted.

## Fetch events

```python theme={null}
events = client.get_all_events()
```

You can pass a specific `trace_id`:

```python theme={null}
events = client.get_all_events(trace_id="your-trace-id")
```

## Print a visual tree

```python theme={null}
client.print_tree_structure()
```

This prints a terminal tree grouped by `parent_run_id` relationships and colorized by event category.

## Build tree data programmatically

```python theme={null}
tree_data = client.build_tree_data_from_events()
```

Use this when you want custom rendering or downstream processing.

## Get an LLM-friendly tree string

```python theme={null}
tree_str = client.get_trace_tree_string()
```

This returns a structured text representation designed for agent or LLM consumption.

## Notes

* Tree methods rely on persisted rows in `agent_logs`.
* Call `flush()` before tree inspection when using manual spans.
