Skip to main content

Application framework for building AI agents with Pydantic AI - environment abstractions, session management, and hierarchical agent patterns

Project description

ya-agent-sdk

Yet Another Agent SDK

Release Build status codecov Commit activity License

Yet Another Agent SDK for building AI agents with Pydantic AI. Used at my homelab for research and prototyping.

Key Features

  • Environment-based Architecture: Protocol-based design for file operations, shell access, and resources. Built-in LocalEnvironment and DockerEnvironment, easily extensible for custom backends (SSH, S3, cloud VMs, etc.)
  • Fully Typed: Complete type annotations validated with pyright (standard mode). Enjoy full IDE autocompletion and catch errors before runtime
  • Resumable Sessions: Export and restore AgentContext state for multi-turn conversations across restarts
  • Hierarchical Agents: Subagent system with task delegation, tool inheritance, and markdown-based configuration
  • Skills System: Markdown-based instruction files with hot reload and progressive loading
  • Human-in-the-Loop: Built-in approval workflows for sensitive tool operations
  • Toolset Architecture: Extensible tool system with pre/post hooks for logging, validation, and error handling
  • Resumable Resources: Export and restore resource states (like browser sessions) across process restarts
  • Browser Automation: Docker-based headless Chrome sandbox for safe browser automation
  • Streaming Support: Real-time streaming of agent responses and tool executions

Installation

# Recommended: install with all optional dependencies
pip install ya-agent-sdk[all]
uv add ya-agent-sdk[all]

# Or install individual extras as needed
pip install ya-agent-sdk[docker]    # Docker sandbox support
pip install ya-agent-sdk[web]       # Web tools (tavily, firecrawl, markitdown)
pip install ya-agent-sdk[document]  # Document processing (pymupdf, markitdown)

Project Structure

This repository contains:

  • ya_agent_sdk/ - Core SDK with environment abstraction, toolsets, and session management
  • yaai/ - Reference CLI implementation with TUI for interactive agent sessions
  • examples/ - Code examples demonstrating SDK features
  • docs/ - Documentation for SDK architecture and APIs

Quick Start

Using the SDK

from ya_agent_sdk.agents import create_agent, stream_agent

# create_agent returns AgentRuntime (not a context manager)
runtime = create_agent("openai:gpt-4o")

# stream_agent manages runtime lifecycle automatically
async with stream_agent(runtime, "Hello") as streamer:
    async for event in streamer:
        print(event)

Using YAAI CLI

For a ready-to-use terminal interface, try yaai - a TUI reference implementation built on top of ya-agent-sdk:

# Run directly with uvx (no installation needed)
uvx yaai

# Or install globally
uv tool install yaai
pip install yaai

Features:

  • Rich terminal UI with syntax highlighting and streaming output
  • Built-in tool approval workflows (human-in-the-loop)
  • Session management with conversation history
  • Browser automation support via Docker sandbox
  • MCP (Model Context Protocol) server integration

Examples

Check out the examples/ directory:

Example Description
general.py Complete pattern with streaming, HITL approval, and session persistence
deepresearch.py Autonomous research agent with web search and content extraction
browser_use.py Browser automation with Docker-based headless Chrome sandbox

For Agent Users

If you're using an AI agent (e.g., Claude, Cursor) that supports skills:

  • Clone this repo: The SKILL.md file in the repository root provides comprehensive guidance for agents
  • Download release package: Get the latest SKILL.zip from the Releases page (automatically built during each release)

Configuration

Copy examples/.env.example to examples/.env and configure your API keys.

Documentation

Development

See CONTRIBUTING.md for development setup and guidelines.

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

ya_agent_sdk-0.17.0.tar.gz (706.2 kB view details)

Uploaded Source

Built Distribution

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

ya_agent_sdk-0.17.0-py3-none-any.whl (242.9 kB view details)

Uploaded Python 3

File details

Details for the file ya_agent_sdk-0.17.0.tar.gz.

File metadata

  • Download URL: ya_agent_sdk-0.17.0.tar.gz
  • Upload date:
  • Size: 706.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for ya_agent_sdk-0.17.0.tar.gz
Algorithm Hash digest
SHA256 5f8194afff8aa1b9bbd3360083b82c29daac805023249b1c143bd9df1c0df75d
MD5 a054401a651ef8ac2821228349db72b5
BLAKE2b-256 94acf88465086393ac1fbc63e7d965b85aec4cb3b50f0bdfd9132603ef12289d

See more details on using hashes here.

File details

Details for the file ya_agent_sdk-0.17.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ya_agent_sdk-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3602baf4a27d3eba49888f0b1bef2a6c0d8c1dc10544da10221c72d3764a291f
MD5 7fd1e4082e16068498870ae168f23062
BLAKE2b-256 801a04ce38a96a3afbde08771f10019f4cd349663a89fdfaf6d33a0685dd9ec1

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