| 1 | # Inspector: Browse agent trajectories
|
| 2 |
|
| 3 | !!! abstract "Overview"
|
| 4 |
|
| 5 | * The `inspector` is a tool that allows you to browse `.traj.json` files that show the history of a mini-SWE-agent run.
|
| 6 | * Quickly start it with `mini-e i` or `mini-extra inspector`.
|
| 7 | * See [output files](output_files.md) for the trajectory file format.
|
| 8 | * Alternative: [jless](https://jless.io/) is a great command-line JSON viewer for browsing trajectories.
|
| 9 |
|
| 10 | <figure markdown="span">
|
| 11 | <div class="gif-container gif-container-styled" data-glightbox-disabled>
|
| 12 | <img src="https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/png/inspector.png?raw=true"
|
| 13 | data-gif="https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/gif/inspector.gif?raw=true"
|
| 14 | alt="inspector" data-glightbox="false" width="600" />
|
| 15 | </div>
|
| 16 | </figure>
|
| 17 |
|
| 18 | ## Usage
|
| 19 |
|
| 20 | ```bash
|
| 21 | # Find all .traj.json files recursively from current directory
|
| 22 | mini-extra inspector
|
| 23 | # or shorter
|
| 24 | mini-e i
|
| 25 | # Open the inspector for a specific file
|
| 26 | mini-e i <path_to_traj.json>
|
| 27 | # Search for trajectory files in a specific directory
|
| 28 | mini-e i <path_to_directory>
|
| 29 | ```
|
| 30 |
|
| 31 | ## Key bindings
|
| 32 |
|
| 33 | - `q`: Quit the inspector
|
| 34 | - `h`/`LEFT`: Previous step
|
| 35 | - `l`/`RIGHT`: Next step
|
| 36 | - `j`/`DOWN`: Scroll down
|
| 37 | - `k`/`UP`: Scroll up
|
| 38 | - `H`: Previous trajectory
|
| 39 | - `L`: Next trajectory
|
| 40 | - `e`: Open current step in [jless](https://jless.io/)
|
| 41 |
|
| 42 | ### FAQ
|
| 43 |
|
| 44 | > How can I select/copy text on the screen?
|
| 45 |
|
| 46 | Hold down the `Alt`/`Option` key and use the mouse to select the text.
|
| 47 |
|
| 48 | ## Implementation
|
| 49 |
|
| 50 | The inspector is implemented with [textual](https://textual.textualize.io/).
|
| 51 |
|
| 52 | ??? note "Implementation"
|
| 53 |
|
| 54 | - [Read on GitHub](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/run/utilities/inspector.py)
|
| 55 |
|
| 56 | ```python linenums="1"
|
| 57 | --8<-- "src/minisweagent/run/utilities/inspector.py"
|
| 58 | ```
|
| 59 |
|
| 60 | {% include-markdown "../_footer.md" %}
|