Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Doc: Document new command line inspector (#913)

Kilian Lieret4659dd9d2453
diff --git a/docs/installation/migration.md b/docs/installation/migration.md
index a1db4045..4bfe9758 100644
--- a/docs/installation/migration.md
+++ b/docs/installation/migration.md
@@ -10,6 +10,7 @@ Welcome to SWE-agent 1.0! So much new stuff! Here's a quick rundown of the cool
* :sparkles: Flexible tool definitions with [tool bundles](../config/tools.md).
* :sparkles: All language models supported using `litellm` (see [models](../installation/keys.md)).
* :sparkles: Override any configuration option from the command line (see [command line basics](../usage/cl_tutorial.md)).
+* :sparkles: New [command line trajectory inspector](../usage/inspector.md) to scroll few hundreds of trajectories with ease.
* :sparkles: Greatly simplified and cleaned up codebase. In particular, the `Agent` class is now much easier to modify.
If you're familiar with the old SWE-agent, here are the main changes you need to be aware of.
diff --git a/docs/usage/inspector.md b/docs/usage/inspector.md
index 787d7eb6..3c76512a 100644
--- a/docs/usage/inspector.md
+++ b/docs/usage/inspector.md
@@ -2,14 +2,11 @@
!!! abstract "Inspecting trajectories"
* Trajectories are the main output of SWE-agent. They are the best way to understand what SWE-agent does, especially when running on many problem instances.
- * We provide a web interface for visualizing [`.traj` files](trajectories.md) from the `trajectories` folder more easily.
+ * We provide two tools for visualizing the [`.traj` files](trajectories.md) from the `trajectories` folder more easily.
+ * Use `swe-agent inspect` (or `sweagent i`) to open the command line inspector.
+ * Use `swe-agent inspector` (or `sweagent I`) to open the web inspector.
* Please complete the [hello world](hello_world.md) tutorial before proceeding.
-!!! tip "New inspector"
- We now also have a new command line trajectory viewer!
-
- Try it out with `sweagent inspect` or `sweagent i`.
-
You should see a folder called `trajectories` in your working directory. Let's go to one of the *experiment directories*:
```bash
@@ -18,6 +15,34 @@ cd trajectories/$USER/<some directory> # (1)!
1. Don't have a folder here? Make sure to run SWE-agent at least once.
+## Command line inspector
+
+<img src="https://github.com/user-attachments/assets/808a1a9c-69c2-47c2-bd65-b50a16a03711">
+
+Run the inspector in the directory containing your `.traj` files:
+
+```bash
+sweagent inspect
+# or
+sweagent i
+```
+
+You will be put into a pager that lets you navigate between trajectories.
+Here's how to navigate (this is similar to vim keybindings):
+
+* Use `q` to quit
+* Switching between trajectories:
+ * `H` and `L` go to the previous/next trajectory
+ * `t` brings up a list of all trajectories. Use type-ahead search to find a specific trajectory (once your search string results in a single match, the trajectory will be opened). Press `<TAB>` to cycle through the list of matches.
+* Use `h` and `l` to navigate between the steps in the trjaectory
+* Use `j` and `k` to scroll down/up
+* By default we only show reduced information. You can press `v` to toggle the view.
+* Press `o` to open the logs
+* Sometimes you see that you can press `e` to open a file in your `$EDITOR`. For this to work, the `EDITOR` environment variable must be set (e.g., to `nano` or `vim`).
+
+## Web-based inspector
+
+
Run the inspector in this directory (this is where your `*.traj` files are):
```bash