Experimental Python-runner coding agent with a Textual TUI
Project description
uv-agent
Experimental coding agent with a Textual TUI. The agent has one external action surface: it submits Python scripts to a managed uv run runner.
Run
uv run uv-agent
Run the published package without installing it first:
uvx uv-agent
Single prompt smoke test:
uv run uv-agent ask "Reply with exactly: ok"
Resume a thread without opening the TUI:
uv run uv-agent ask --thread thr_xxx "Continue from here"
Local Config
User-level provider config lives at ~/.uv-agent/config.json by default. A project can override it with .uv-agent/config.json; that project-local directory is ignored by git.
The config supports providers, models, levels, runtime options, and runner options. Secrets such as api_key must stay in ignored local config or environment variables.
Minimal shape:
{
"providers": {
"local": {
"base_url": "https://api.example.com",
"api_key_env": "UV_AGENT_API_KEY",
"responses": { "path": "/responses" },
"chat_completions": { "path": "/chat/completions" }
}
},
"models": {
"main": {
"provider": "local",
"model": "gpt-5.5",
"api": "responses",
"context_window_tokens": 258000
},
"chat": {
"provider": "local",
"model": "gpt-5.4-mini",
"api": "chat_completions",
"context_window_tokens": 258000
}
},
"levels": {
"medium": { "model": "main" },
"chat": { "model": "chat" }
},
"ui": {
"language": "auto"
},
"runner": {
"max_saved_scripts": 32
}
}
Supported model APIs:
responseschat_completionsanthropic_messages
Streaming uses SSE when the provider supports it.
Compression can be tuned under runtime.compression with trigger_ratio,
target_ratio, and min_tokens. The TUI reads provider usage when available
and falls back to a local estimate for the context meter.
Runtime Scripts
Agent scripts declare dependencies with PEP 723 inline metadata. The runner records managed script artifacts, run JSONL, and thread JSONL under ~/.uv-agent/projects/<project-id>/, injects the configured runtime dependency into inline metadata when needed, and supports rerunning saved scripts.
The PyPI package currently ships both uv_agent and uv_agent_runtime, so the
default injected runtime dependency is the installed uv-agent version. This
lets uvx uv-agent run the host app while managed scripts install the same
package and import uv_agent_runtime.
For local source development, override the runtime dependency in
.uv-agent/config.json:
{
"runner": {
"runtime_dependency": "uv-agent @ file:///C:/path/to/uv-agent"
}
}
Each project keeps the 32 most recently used managed scripts by default
(runner.max_saved_scripts). Run logs are still kept separately. Scripts can
inspect recent saved scripts with uv_agent_runtime.saved_scripts().
uv_agent_runtime exposes convenience helpers for text/JSON files, unified-diff patches, subprocesses, structured events, nested uv-agent ask calls by model level, image context, saved script summaries, compact thread digests, and MCP stdio servers declared in .agents/mcp.json.
Image context is added from a script with look_at:
from uv_agent_runtime import look_at
look_at("screenshot.png", note="inspect the failed layout")
The host copies the image into the project state attachments directory and appends it to later model input. Large image bytes are not stored directly in thread JSONL.
Saved scripts can be rerun by passing script_id or run_id to run_python;
rerun_mode="replay" inherits a previous run's arguments when a run_id is
available.
Nested agents are launched from Python with level names rather than concrete models:
from uv_agent_runtime import ask
result = ask("inspect the test failure", check=True)
print(result.text)
Pass level only when intentionally selecting one of the level names defined in
the config; omit it to use the default level.
MCP remains a Python-triggered runtime capability, not a direct model tool:
from uv_agent_runtime import connect_named
with connect_named("filesystem") as client:
client.initialize()
print(client.list_tools())
Workspace Rules
AGENTS.md context is loaded from ~/.agents/AGENTS.md and from the current
git root down to the startup directory, including AGENTS.*.md variants.
Rules, discovered skills, and MCP declarations are kept out of the stable system
prompt. The engine appends a compact workspace-context update only when that
context is first seen, changed, removed, or when a thread continues after
compaction. Removal updates explicitly tell the agent not to rely on older
appended rule/capability context unless it appears again. Context update events
are stored in thread JSONL for change tracking, but they are not reconstructed as
ordinary conversation items or included in compression input.
TUI
The default TUI follows a Codex-style shape: a single transcript, inline Python runner events, full-screen focus panels, and a bottom composer with a bordered input box plus a compact status line.
Enter: insert a newline in the composerCtrl+EnterorCtrl+J: send the composer textEsc: clear the composer or close the open panelCtrl+Sor/status: open detailed runtime statusCtrl+Oor/threads: open a searchable thread picker and resume historyCtrl+P: open a full-screen command palette- Selecting composer text copies it after a short delay and shows a notification
Ctrl+C: press twice to interrupt a running turn; when idle, press twice to quit/quit: quit after a second confirmation?+Ctrl+Enteror/help: show local commands/context: show context budget and loaded workspace rules/rules: inspect loadedAGENTS.mdfiles/new [title],/threads, and/clear: light thread controls/config: edit user-facing settings (default_level,language,auto_compress) and show config sources / redacted merged config/models: read-only view of configured models. Add or modify models in the config file; this command never writes/level [name]: the only runtime model switch. Picks one of the levels defined in the config for this session/mcp: show MCP declarations from.agents/mcp.json/skillsand/skill [name]: inspect.agents/skillsentries/runs: show the latest Python run summary from this TUI session/scripts: show recent managed script summaries/panel: reminder that panels close withEsc- Python runs appear inline with script/run ids, exit status, stdout/stderr summaries, and truncation markers
- Reasoning/tool/runtime events appear as compact timeline entries; detailed run output remains available in
/runs. - Typing
/opens the full-screen command picker;Ctrl+Popens the same picker. Type to filter, use arrows/PageUp/PageDown to move, and Enter to select. - Temporary panels open as full-screen overlays with search/scroll/select behavior.
For manual UI checks, Textual's App.export_screenshot() works in headless
tests and writes SVG snapshots. Local debug captures belong under .uv-agent/
so they stay out of git.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uv_agent-0.1.0.tar.gz.
File metadata
- Download URL: uv_agent-0.1.0.tar.gz
- Upload date:
- Size: 209.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5838a5520b6de79739bc67a7a0ec9b18883cf7c5c37b8bffe0f92e46293d01c
|
|
| MD5 |
afe227273e80e534c4381e143e4432ff
|
|
| BLAKE2b-256 |
326589a7a90113f91267144c1ebcc3618c36b23e58aecbe8441aa793a12146a2
|
File details
Details for the file uv_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: uv_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 90.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbb198facbb23005933ab7b3078d3fafc983787873ae3f004a6487ff98f1f43f
|
|
| MD5 |
db7bc2125092bdcad0d6b0c02b8dfa94
|
|
| BLAKE2b-256 |
5f3e1cdf88895acc49e43949a1c270eeb25fc41b54a5c71d73975d5556cdbce4
|