Skip to main content

A Python agent harness with configurable tools and guardrails - one who yokes agents together

Project description

Yoker

PyPI Python uv CI Coverage License Agentic

A Python agent harness with configurable tools, guardrails, and Ollama backend integration.

Installation

pip install yoker

Quick Start

python -m yoker

Or with an agent definition:

python -m yoker --agent examples/agents/researcher.md

Example session:

Yoker Session

Why Yoker?

Yoker fills a unique gap in the coding agent ecosystem: a library-first, transparent agent harness designed for developers who want full control, visibility, and simplicity.

Key Differentiators:

  • Library-first - Embed in your applications, not locked into a CLI
  • LLM-neutral - Choose your provider, your model, your cost model
  • No hidden manipulation - All prompts visible, editable, configurable
  • Static permissions - Deterministic boundaries, not runtime prompts
  • Full transparency - Event-driven, everything inspectable

See docs/rationale.md for the full rationale and comparison with other solutions.

Features

Current Features:

  • Chat loop - Interactive conversation with Ollama
  • Tool calling - Structured tool execution with parameters
  • read tool - Read file contents with guardrails
  • list tool - Directory listing with pattern filtering
  • write tool - Write files with overwrite protection
  • update tool - Edit existing files with replace, insert, and delete operations
  • search tool - Search file contents with regex or filenames with glob
  • existence tool - Check if files or folders exist with security hardening
  • mkdir tool - Create directories with recursive parent creation and depth limits
  • git tool - Git operations (status, log, diff, branch, show) with permission-controlled commit/push
  • web_search tool - Web search with SSRF protection, domain filtering, and rate limiting
  • web_fetch tool - Fetch web content with SSRF protection, URL validation, and size limits
  • agent tool - Spawn subagents with isolated context and recursion limits
  • Slash commands - Built-in commands: /help, /think on|off
  • Thinking mode - LLM reasoning trace with gray output
  • Streaming - Real-time token streaming from Ollama
  • Configuration - TOML-based configuration system
  • Agent definitions - Load agents from Markdown files with YAML frontmatter
  • Multiline input - Esc+Enter for newlines, Enter to submit
  • Rich output - Styled terminal output with Rich
  • Event-driven architecture - Library-first design with event emission
  • Context persistence - Session resumption with JSONL storage
  • Event logging - Full session replay capability
  • Demo scripts - Generate documentation screenshots from Markdown scripts
  • Update tool - Edit existing files with replace, insert, and delete operations

Planned Features:

  • Guardrails - Tool parameter validation
  • Permissions - Static TOML-based access control
  • Multi-agent orchestration - Run coordinated agent teams
  • Backend providers - OpenAI, Anthropic, custom backends
  • Tool timing metrics - Performance tracking
  • Token usage tracking - Cost monitoring
  • Tool result caching - Reduce redundant calls
  • Parallel tool execution - Concurrent read operations

Interactive Input

The interactive session supports:

  • Multiline input: Press Esc+Enter to add newlines, Enter to submit
  • Command history: Up/Down arrows navigate previous messages
  • History search: Ctrl+R to search through history
  • Keyboard navigation: Arrow keys, Ctrl+A/E for cursor positioning
  • Text selection: Click and drag to select output, copy with Ctrl+Shift+C or Cmd+C

Slash Commands

Command Description
/help Show available commands
/think on|off Enable/disable LLM thinking trace

Thinking Mode

When thinking is enabled, the LLM shows its reasoning process:

[Thinking]
Let me analyze this step by step...
First, I need to understand the file structure...

[Response]
Based on my analysis, here's what I found...

Demo Session Script

Generate terminal screenshots for documentation from Markdown script files:

# Run default demo script (demos/session.md)
python scripts/demo_session.py

# Run a specific demo script
python scripts/demo_session.py --script demos/list-tool.md

# Run all demo scripts in a directory
python scripts/demo_session.py --scripts-dir demos/

# Real LLM + log conversation for replay
python scripts/demo_session.py --script demos/session.md --log

# Replay from log (no LLM calls)
python scripts/demo_session.py --script demos/session.md --replay

# With an agent definition
python scripts/demo_session.py --script demos/session.md --agent examples/agents/markdown.md

Configuration

Yoker auto-discovers configuration files:

  1. ./yoker.toml (current directory)
  2. ~/.yoker.toml (user home directory)
  3. Built-in defaults
# Zero-configuration startup - uses auto-discovered config
python -m yoker

Or create a yoker.toml file for explicit configuration:

[harness]
name = "my-yoke"
log_level = "INFO"

[backend]
provider = "ollama"

[backend.ollama]
base_url = "http://localhost:11434"
model = "llama3.2:latest"

[agents]
definition = "./agents/researcher.md"  # Optional: agent definition file

[tools.read]
enabled = true
allowed_extensions = [".txt", ".md", ".py"]

See examples/yoker.toml for the full configuration reference.

Architecture

Yoker uses an event-driven architecture for library-first design. The Agent emits events; application code handles UI.

Architecture Diagram

Event Types: Session (start/end), Turn (start/end), Thinking (start/chunk/end), Content (start/chunk/end), Tool (call/result), Error, Command

Documentation

Development

git clone https://github.com/christophevg/yoker.git
cd yoker
make setup    # Create virtual environment and install dependencies

make test     # Run tests with coverage
make check    # Type checking + linting
make docs     # Build documentation

Requires Python 3.10+. Uses uv for dependency management. See CLAUDE.md for project conventions.

Contributing

Contributions welcome! Please read CLAUDE.md for project conventions and development guidelines.

Changelog

See GitHub Releases for version history.

License

MIT License - see LICENSE for details.


Name: "yoker" - One who yokes. The agent noun from "yoke" (PIE yeug- meaning "to join"). Pairs with "clitic" (both are joining tools). See docs/NAME.md for full etymology.

Project details


Download files

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

Source Distribution

yoker-0.4.0.tar.gz (831.0 kB view details)

Uploaded Source

Built Distribution

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

yoker-0.4.0-py3-none-any.whl (123.0 kB view details)

Uploaded Python 3

File details

Details for the file yoker-0.4.0.tar.gz.

File metadata

  • Download URL: yoker-0.4.0.tar.gz
  • Upload date:
  • Size: 831.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for yoker-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dcadbfda209b3a1f19bf8c4a213adeea99149220fba6631370c5c6027d4f8c1b
MD5 3374430970764c7c514a9bf317f1b593
BLAKE2b-256 d3188fae0cd0210c082dcc18211237dc632575cf56ce1b0a25e9dd9152159954

See more details on using hashes here.

File details

Details for the file yoker-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: yoker-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 123.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for yoker-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9948d5dddda558c5027099b25de4f5fef7d2d9ed5b8486ae9e8f2a586f343a1d
MD5 3dabd8990f8dd62b973fe7680ec3e611
BLAKE2b-256 4e9caa9b4a2c4d909452e244c6e5560455fc64a891e138e648715b2fd7180570

See more details on using hashes here.

Supported by

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