Skip to main content

tsugite

Tsugite (継ぎ手) is an agent framework where you define AI agents as markdown files and run them from the CLI, a web UI, or through scheduled tasks.

I built it because none of the existing agent frameworks did what I wanted. I needed something self-hosted, model-agnostic, and simple enough that an agent is just a text file I can edit and version control.

Originally it was meant to be a framework for micro-agents inspired by ESA, but has grown a lot since that goal.

What an agent looks like

A simple "hello world" agent looks like:

---
name: morning-brief
model: anthropic:claude-sonnet-4-20250514
tools: [web_search, fetch_text, write_file, final_answer]
---

You are a morning briefing assistant.

Current date: {{ now() }}
User location: {{ env("LOCATION", "unknown") }}

Check the weather, scan top news, and write a short briefing.
Use final_answer() to return the result.

YAML frontmatter for config, markdown body for instructions, Jinja for dynamic context. Run it with:

tsu run +morning-brief "what's happening today"

Key ideas

  • Agents are markdown. A basic agent is just markdown with yaml frontmatter. Advanced agents are still just markdown but can use jinja templating and a special <!--tsu --> syntax.
  • Code execution over tool-calling. Inspired by smolagents. Instead of using native tool calling, LLMs write python code. Tools are exposed as python functions.
  • Any LLM. Plugin interface to add support for additional LLM providers. Built-in we have openai-compatible apis, ollama, anthropic, and claude code.
  • Workspaces. Each workspace is a persistent directory with agents, skills, memory files, and config. The agent runs inside its workspace and can read/write files, spawn sub-agents, manage schedules, and persist state across conversations. Workspaces are entirely optional.
  • CLI and/or Daemon with a Web UI Use tsu run commands for cli-only, or run tsu daemon for a daemon that supports scheduled tasks, a web ui, and some other neat things.

Install

tsugite-cli is a light kernel (CLI, built-in tools, providers, history). Optional subsystems install as extras:

uv tool install tsugite-cli              # recommended; kernel only
pipx install tsugite-cli                 # alternative
pip install tsugite-cli                  # or plain pip
Extra Adds
tsugite-cli[daemon] Daemon: HTTP API, web UI, scheduler, jobs, terminals (pty), sandbox, Discord
tsugite-cli[web] web_search + YouTube transcripts
tsugite-cli[sandbox] bwrap sandbox backend (also needs the bwrap binary)
tsugite-cli[all] Everything above plus the optional tmux + provider plugins
uv tool install "tsugite-cli[daemon]"    # full server install

The package is tsugite-cli, the command is tsugite (or tsu for short).

Quick start

# Initialize a workspace
tsu init my-workspace
cd my-workspace

# Run the built-in default agent
tsu run +default "summarize the files in this directory"

# Run an agent file directly
tsu run my-agent.md "do the thing"

# Start the daemon (web UI, Discord/Telegram bots) -- needs the [daemon] extra
tsu daemon

Output modes

tsu run keeps its terminal output plain by default so logs are copy-pasteable and behave in nested tmux / non-Rich-friendly shells. Pick a richer or quieter mode when you need it:

Mode When to use
Default (plain) Everyday interactive runs and piped output (tsu run ... | less).
--headless CI/scripts: result on stdout, no progress chrome. Combine with --verbose for stderr trace.
--plain Force plain explicitly (same as the default; useful when overriding configs/aliases).

Features

  • Multi-step workflows with <!-- tsu:step --> to chain steps and pass data between them
  • Scheduling built-in cron for recurring agent tasks (daily summaries, monitoring, etc.)
  • Web UI for conversations, with Discord as an alternative interface
  • Sub-agents that can spawn other agents for specific subtasks
  • Skills directory-based knowledge modules (mostly) following the agentskills.io SKILL.md format
  • Hooks that fire shell commands on lifecycle events (post-tool, pre-message, pre/post-compact)
  • Sandbox (linux only) via bubblewrap with filesystem and network isolation

Agents in more detail

Agents support YAML frontmatter for configuration:

---
name: code-reviewer
model: anthropic:claude-sonnet-4-20250514
max_turns: 15
tools: [read_file, list_files, web_search, final_answer]
auto_load_skills: [coding-standards]
---

You can restrict which tools an agent has access to, set turn limits, auto-load skills, attach context files, and extend other agents. TODO: See docs/ for the full spec.

Multi-step agents use <!--tsu --> comments as directives:

<!-- tsu:step name="research" model="openai:gpt-4o" -->
Research the topic and save findings to a variable.

<!-- tsu:step name="write" -->
Using the research from the previous step, write a summary.
The variable `research` is available as a Python variable.

For a complete example, check the built-in default agent.

Sandbox

On Linux only (for now), agent code runs inside a bubblewrap sandbox when you pass --sandbox:

tsu run +default "task" --sandbox --allow-domain "github.com"
tsu run +default "task" --sandbox --no-network

Filesystem access is limited to the workspace. Network goes through a filtering proxy that only allows domains you specify.

The daemon can also sandbox its agents (off by default, configured in daemon.yaml). See docs/sandbox.md.

Config and Data Directories

All paths follow XDG Base Directory conventions and can be overridden with the standard environment variables.

Path Default Contents
$XDG_CONFIG_HOME/tsugite/ ~/.config/tsugite/ config.json, daemon.yaml
$XDG_DATA_HOME/tsugite/history/ ~/.local/share/tsugite/history/ Session history (JSONL per session)
$XDG_DATA_HOME/tsugite/daemon/ ~/.local/share/tsugite/daemon/ Daemon state
$XDG_DATA_HOME/tsugite/secrets/ ~/.local/share/tsugite/secrets/ Encrypted secrets (secrets.db)
$XDG_DATA_HOME/tsugite/usage/ ~/.local/share/tsugite/usage/ Usage (cost and token) tracking (usage.db)
$XDG_DATA_HOME/tsugite/workspaces/ ~/.local/share/tsugite/workspaces/ Workspace directories
$XDG_CACHE_HOME/tsugite/attachments/ ~/.cache/tsugite/attachments/ Attachment cache

Development

git clone https://github.com/justyns/tsugite.git
cd tsugite
uv sync --all-extras

Status

This is a personal project I use daily. It works for my use cases but isn't polished for general consumption yet. Issues and PRs welcome, but set expectations accordingly. Documentation is very sparse because I keep changing things.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsugite_cli-0.19.2.tar.gz (405.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsugite_cli-0.19.2-py3-none-any.whl (469.2 kB view details)

Uploaded Python 3

File details

Details for the file tsugite_cli-0.19.2.tar.gz.

File metadata

  • Download URL: tsugite_cli-0.19.2.tar.gz
  • Upload date:
  • Size: 405.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tsugite_cli-0.19.2.tar.gz
Algorithm Hash digest
SHA256 6a2f1c87a657a28fe51341a16beafb1d57e8e3ec57c8b6afc75aceaafeff469c
MD5 19c43de5a601d6528451b2b5d4254988
BLAKE2b-256 4f4658d56623534806dd6019c4c3e568d4df8aa616c56e6e9a196cb3f6103daf

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsugite_cli-0.19.2.tar.gz:

Publisher: pypi-publish.yml on justyns/tsugite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tsugite_cli-0.19.2-py3-none-any.whl.

File metadata

  • Download URL: tsugite_cli-0.19.2-py3-none-any.whl
  • Upload date:
  • Size: 469.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tsugite_cli-0.19.2-py3-none-any.whl
Algorithm Hash digest
SHA256 74af14c45855f35e7b9a20f6cd1c53e109ee21c0fa69c05bba29ebc6d3659158
MD5 a99e117a23deb0567e6cf3336e62b24c
BLAKE2b-256 13e77935e5b409c29952b5d9247ca1e9b1699e179a5adb545788bf00bad25b49

See more details on using hashes here.

Provenance

The following attestation bundles were made for tsugite_cli-0.19.2-py3-none-any.whl:

Publisher: pypi-publish.yml on justyns/tsugite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page