Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/swe-agent/mini-swe-agent/llms.txt

Use this file to discover all available pages before exploring further.

Every time mini-swe-agent completes a run, it saves a trajectory file — a JSON record of everything that happened. This includes the full conversation between the agent and the model, every command that was executed and its output, API costs, timestamps, the final exit status, and any submitted output (such as a patch). Trajectories are the primary way to review, debug, and audit what an agent did. They can also be used as training data or as input to evaluation pipelines like SWE-bench.

Where trajectories are saved

By default, mini saves the trajectory to last_mini_run.traj.json in your global config directory. The path to this directory is printed when you start mini. To save to a custom path, use the -o/--output flag:
mini --task "Refactor the auth module" --output ./runs/refactor.traj.json
Or set output_path in your config file:
agent:
  output_path: ./runs/refactor.traj.json
File names conventionally use the .traj.json extension so the inspector can find them automatically.

Trajectory JSON structure

Trajectory files use the mini-swe-agent-1.1 format (introduced in v2.0). The top-level structure has three keys: info, messages, and trajectory_format.
{
  "info": {
    "model_stats": {
      "instance_cost": 0.05,
      "api_calls": 12
    },
    "config": {
      "agent": { },
      "agent_type": "minisweagent.agents.default.DefaultAgent",
      "model": { },
      "model_type": "minisweagent.models.litellm_model.LitellmModel",
      "environment": { },
      "environment_type": "minisweagent.environments.local.LocalEnvironment"
    },
    "mini_version": "2.0.0",
    "exit_status": "Submitted",
    "submission": "diff --git a/file.py b/file.py\n..."
  },
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant..."
    },
    {
      "role": "user",
      "content": "Please solve this issue: ..."
    },
    {
      "role": "assistant",
      "content": "Let me check the files...\n\n```mswea_bash_command\nls -la\n```",
      "extra": {
        "actions": [{"command": "ls -la"}],
        "cost": 0.003,
        "timestamp": 1706000000.0,
        "response": {}
      }
    },
    {
      "role": "user",
      "content": "<returncode>0</returncode>\n<output>\nfile1.py\nfile2.py\n</output>",
      "extra": {
        "returncode": 0,
        "timestamp": 1706000001.0
      }
    },
    {
      "role": "user",
      "content": "",
      "extra": {
        "exit_status": "Submitted",
        "submission": "diff --git a/file.py..."
      }
    }
  ],
  "trajectory_format": "mini-swe-agent-1.1"
}

info object

The info object contains metadata about the run:
FieldDescription
model_stats.instance_costTotal cost in dollars for all API calls in this run
model_stats.api_callsNumber of API calls made
configFull resolved configuration used for this run (agent, model, environment)
mini_versionVersion of mini-swe-agent that produced this file
exit_statusFinal status: Submitted, LimitsExceeded, or other terminal states
submissionFinal output or patch submitted by the agent, if any

messages array

The messages array contains the full conversation in OpenAI chat format. Each message has a role and content, plus an extra field added by mini-swe-agent.
RoleDescription
systemInitial system prompt with agent instructions
user (task)The task description sent to the model
assistantModel response, including the proposed command in a code block. The extra field contains actions (parsed commands), cost, and timestamp.
user (observation)The result of executing a command. The extra field contains returncode and timestamp.
user (final)The terminal message when the agent exits. The extra field contains exit_status and submission.
When using tool-calling model classes (e.g., LitellmModel, the default), assistant messages include a tool_calls field instead of a text-embedded command, and observation messages use role: "tool" with a matching tool_call_id.

trajectory_format

The trajectory_format field identifies the schema version. The current version is mini-swe-agent-1.1, introduced in v2.0.
If you are reading trajectory files produced by mini-swe-agent before v2.0, the format differs. See the v2 migration guide for details.

Browsing trajectories with the inspector

mini-swe-agent includes a terminal UI for browsing trajectory files interactively. It is built with Textual and lets you step through each turn of a run, inspect messages, and navigate between multiple trajectory files.
# Search for .traj.json files from the current directory
mini-extra inspector

# Shorter alias
mini-e i

# Open a specific trajectory file
mini-e i ./runs/my-run.traj.json

# Search for trajectory files in a specific directory
mini-e i ./runs/

Inspector key bindings

KeyAction
h / LEFTPrevious step
l / RIGHTNext step
j / DOWNScroll down
k / UPScroll up
HPrevious trajectory
LNext trajectory
eOpen current step in jless
qQuit
To select and copy text in the inspector, hold Alt (or Option on macOS) while using the mouse.

The preds.json format

When running batch evaluations (e.g., on SWE-bench), mini-swe-agent produces a preds.json file that aggregates results across all instances:
{
  "owner__repo__123": {
    "model_name_or_path": "anthropic/claude-sonnet-4-5-20250929",
    "instance_id": "owner__repo__123",
    "model_patch": "diff --git a/file.py b/file.py\n..."
  }
}
This format is compatible with SWE-bench evaluation tooling.

Build docs developers (and LLMs) love