Skip to main content

agent7

A real agent7 session: the REPL opens with Seven, one sentence is typed, and agent7 changes and tests greet.py

A real session — one sentence in, four tools out.

The simplest coding agent. Four tools, one loop.

A deliberately minimal harness — all-in on modern, carefully chosen model providers. Fast and precise. No seatbelt; hold on.

No orchestration: no plan mode, no subagents, no parallel tasks, no background jobs. You give it one sentence; it reads files, edits files, runs commands, then stops. Built for people who work on one thing at a time — you hold one task in your head, and so does it.

Meet Seven

Seven, the little pixel robot

Seven is agent7's tiny coding companion: a lavender pixel robot with a seven-shaped antenna, cursor-green eyes, and a lucky 7 on its chest. It stays out of the way until you open the REPL.

The SVG and PNG are original pixel artwork with matching terminal art. Set AGENT7_NO_MASCOT=1 to hide the REPL welcome; one-shot commands never show it. To tweak the design, edit agent7/mascot.py, then run python scripts/generate_mascot.py.

Features

  • Deliberately minimal harness — four tools, one loop, no orchestration
  • Complete CLI agent UX — streaming thinking + answer, tool lines with ✓/✗, edit/write preview, vi-mode REPL with a bottom status bar, fuzzy @path completion, session resume
  • Slash commands — /help /model /status /login /logout /compact
  • Markdown rendering — final replies rendered as Rich Markdown in the terminal, thanks rich.
  • Paged final replies — interactive answers that exceed one screen open in your system pager (usually less), or a built-in pager on Windows; shorter answers print directly. The built-in pager shows which lines are on screen and accepts the arrow keys, PageUp/PageDown, Space, Home/End, the mouse wheel, and q (or Esc) to continue. The rendered reply stays in the terminal after you quit. Redirected output is never paged.
  • Provider login — paste an API key for DeepSeek, Grok, or Kimi (/login or env); switch models in-session

Install

pip install agent7
# or: uv tool install agent7
# or from source: uv sync && uv run agent7

Auth

Paste an API key; there is no OAuth. Keys are stored in ~/.config/agent7/auth.json.

export DEEPSEEK_API_KEY=sk-...   # or /login deepseek
export XAI_API_KEY=xai-...       # Grok, from console.x.ai  (or /login grok)
export KIMI_API_KEY=sk-...       # Kimi Code, from the Kimi Code Console (or /login kimi)
# export AGENT7_MODEL=grok-4

You can also log in from inside the REPL:

/login deepseek
/login grok              # xAI — Grok models
/login kimi              # Kimi Code — kimi-for-coding and other available models
/model                   # list models for every logged-in provider
/model deepseek-flash
/model grok-4
/model kimi-for-coding

Usage

uv run agent7 "create hello.py that prints hi"   # one-shot
uv run agent7 -m deepseek-flash "say hi"         # one-shot on a chosen model
uv run agent7 -m                                 # pick the model from a menu
uv run agent7                                    # new REPL session
uv run agent7 -r                                 # resume this cwd's session
uv run agent7 -r "continue"                      # resume + one-shot
uv run agent7 --help                             # --cwd, --max-turns, -m, -r, --version

The command line is a click command in agent7/cli.py (options, session bootstrap, one-shot runs); the prompt, completion menu and reply rendering live in agent7/repl.py.

Each workspace keeps a single snapshot — starting without -r begins a fresh conversation but reuses the last selected model. Opening or leaving an empty REPL does not touch the saved snapshot; a new conversation replaces it only after the first agent task. Set $AGENT7_MODEL to override the model choice. Active sessions are saved automatically after tasks, commands, interruptions, and exit. With -r, the saved user/assistant conversation is printed before the REPL prompt or one-shot task; system and tool messages are omitted. Model calls use the OpenAI Responses API with local function tools. Sessions replay raw output items to their originating provider where required, without using server-side conversation state; older snapshots and provider switches use portable function calls and results instead. New files are snapshot format 2. Format 1 still loads; older releases refuse format 2 instead of replaying fields they do not know.

Snapshots contain resumable model context, not a separate full transcript; compaction is reflected in both the saved context and the displayed history. Files live in ${XDG_STATE_HOME:-~/.local/state}/agent7/sessions/ and do not store API keys. Hard process kills can lose the in-progress turn.

-m/--model chooses the model for this run. -m deepseek-flash resolves a name exactly like /model does; a bare -m opens an fzp picker over every model the logged-in providers offer — type to filter, Enter to choose, Esc or Ctrl-C to cancel. The menu starts from the model the workspace would otherwise use, and falls back to each provider's default when the model list cannot be fetched. Precedence is -m > $AGENT7_MODEL > the workspace's last model. A -m that names nothing usable stops the run instead of quietly picking another model, and a run that never starts (cancelled menu, bad -m) leaves the workspace snapshot untouched. Because -m takes the following word as its value, a bare -m before a task needs a separator: agent7 -m -- "fix it" (or put the task first: agent7 "fix it" -m).

REPL commands: /help /model /status /login /logout /compact. Status lives in a bar docked to the bottom row of the terminal while you type: model · context · cwd, with the context gauge turning yellow then red as the window fills, and the vi mode (INSERT / NORMAL / REPLACE) on the right. The prompt itself stays a bare >. Set AGENT7_NO_STATUSBAR=1 to go back to a plain prompt. Press Ctrl-E to edit multiline input in $VISUAL / $EDITOR (falling back to the system editor). After :wq, the text returns to the prompt for review; Enter submits it. Set EDITOR=vim to use Vim. Exit with Ctrl-D (or Ctrl-Z on Windows). Ctrl-C discards the current input or interrupts the running turn, then returns to the prompt instead of exiting the REPL.

Reasoning models (DeepSeek, Grok, Kimi) stream their Responses reasoning events live: they show up dimmed under a thinking header, before the answer and above each tool line. In a terminal, the latest six visual lines scroll inside a fixed-height viewport that is cleared afterward; redirected output retains the full text without control codes. Reasoning text is display only; opaque protocol items needed to continue a tool call are kept with the session.

Type @ in the REPL to complete files and directories from the cwd: fix @agent7/agent.py. A bare @ lists the cwd, @dir/ lists that directory, and a typed fragment searches the whole tree (@setup → docs/guides/setup.md). Scanning runs in a worker thread and stops after 10k entries, skipping generated directories, so a large working directory or a slow disk never blocks the prompt. Tab accepts, directories keep going (@agent7/ → @agent7/session.py), and spaces are escaped (@my\ file.txt), so the path the model sees is the path it can read.

The menu is fuzzy, powered by fzp: @mn finds main.py, /mdl finds /model, /model sonnet finds anthropic/claude-sonnet-4. Candidates are subsequence-matched and ranked by score (consecutive hits and word starts win). Matched characters are marked in bright green and bold, foreground only; the background is reserved for the selected row, so a match never punches a colored hole in the highlight. Commands, @paths, /model refs and /login providers all go through the same scorer.

--cwd sets the working directory. --max-turns caps the loop at 200 model rounds per task — high enough that ordinary work never hits it, low enough to stop a runaway. The current model round and its tool calls finish before the run pauses. When it runs out, a yellow notice explains that the task may be unfinished and how to recover. The session is preserved: type continue in the REPL, run agent7 -r "continue" for a one-shot, or use agent7 --max-turns 500 -r "continue" to resume with a higher cap. Reaching the cap never silently starts a new session or extends the same run indefinitely.

The cap is per run, not per session: -r never pins you to the --max-turns an already-saved session was created with. Precedence is --max-turns > $AGENT7_MAX_TURNS

A run that ends with no visible text never ends silently: you get either # (stopped after N turns), # no text in the reply … or # … hit the output token limit ….

Tools

Tool What it does Output budget
read Read a file with line numbers 200 lines per call by default; page with offset=
write Create or overwrite a whole file +N -M diff stats
edit Precise replacements; one call may include multiple edits[] against the original file (no overlaps) +N -M diff stats
bash Host shell in the cwd (bash / PowerShell / cmd) ~12k chars

That's it. No grep, no list_dir, no todo, no task. Need more capability? Let the agent use bash.

On startup agent7 picks a shell from sys.platform: Git Bash → PowerShell → cmd on Windows, bash elsewhere. The choice is written into the system prompt so the model matches the host. Override with AGENT7_SHELL=bash|powershell|cmd|/path/to/shell.

Tools run serially, one after another — so the log always reads in order and you never get three outputs interleaved. Edits are applied without a confirmation prompt; you just get a one-line diff stat.

Context

At 75% context usage, old tool/assistant text is compacted automatically: the last 3 user turns are kept, or for one-shot tasks the last 4 tool results. /compact triggers the same compaction manually.

Providers that never report usage are measured by an estimate, so compaction still kicks in; if the server rejects a request as too long anyway, it compacts harder and retries that turn once.

AGENT7_CONTEXT_LIMIT overrides the context limit.

When things go wrong

  • 429 / 5xx / connection errors are retried up to 3 times (0.5s, 1.5s, 3s) — but only while nothing has been printed yet, so you never see a reply twice. After that you get # error: … and, in the REPL, the prompt comes back instead of the process dying.
  • Ctrl-C in the middle of a tool batch answers every remaining tool call with error: interrupted, so the next request is still valid.
  • Writes are atomic (temp file + rename): an interrupted write/edit leaves the original file untouched, and symlinks keep pointing where they did.
  • Large outputs are bounded: read streams the file and keeps only the window it returns; bash captures to temp files and reads back ~12k chars. A 100 MB log costs a few hundred KB of memory, not 300 MB.

What it is not

  • Not an orchestrator: no branching, no subagents
  • Not a parallel framework: single-threaded, one thing at a time
  • Not a background service: work runs only in the foreground
  • No sandbox: tools run as you, and bash can do anything your account can do

If that kind of "small" is exactly what you want, this is enough. If it's missing the abstraction you had in mind, that omission is probably the point — not an oversight.

Metadata

Release files for agent7 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent7 0.2.6
File Size Uploaded Provenance Actions
agent7-0.2.6.tar.gz 144.9 kB With provenance Details for agent7-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent7 0.2.6
File Interpreter ABI Platform Actions
agent7-0.2.6-py3-none-any.whl Python 3 none any Details for agent7-0.2.6-py3-none-any.whl

Total release size: 191.2 kB

Release files / agent7-0.2.6.tar.gz

Download URL agent7-0.2.6.tar.gz
Size 144.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9a123d7de49e6339428394621aa6a3549d084f33eaa49046b778b28073169da2
BLAKE2b-256 checksum
How to use checksums
033e1fb6b09bec35fae5a3488363662c8b0d3a6e7b247eb394758eea641f8217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / agent7-0.2.6-py3-none-any.whl

Download URL agent7-0.2.6-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb0537990436a45c8531d2c1eda85b1c8cd040d4ca2ae364750054ae8bb1e091
BLAKE2b-256 checksum
How to use checksums
0e755c55249329f3d10264a91394cca3b3fcc41b416deee4bf670a7997e48295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for agent7 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent7-0.2.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page