Skip to main content

Тонкий harness-фреймворк для AI-агентов: сменный провайдер рантайма (API/Claude Code/Codex), middleware-pipeline и слой skills/MCP.

Project description

agentyoke

Тонкий harness-фреймворк для AI-агентов: сменный провайдер рантайма (API / Claude Code / Codex), middleware-pipeline и слой skills/MCP.

Один интерфейс — любой агентный рантайм. Yoke (ярмо/упряжь) — это та самая упряжь, что заставляет несколько волов тянуть в одну сторону. agentyoke делает то же с разными агентными рантаймами и моделями: прикладной код агента не знает, кто внутри — собственный цикл над LiteLLM, Claude Code или Codex.

Статус: 0.1.0 — рабочая реализация. Конфиг, middleware-pipeline (logging / cost / rate-limit / guardrails / cache / retry), observability, загрузчик skills, ApiProvider (agentic-loop) и CLI-провайдеры реализованы и покрыты тестами (ruff + mypy --strict + pytest).


Ключевая идея

  1. Гибрид: тонкое собственное ядро — не монолитный фреймворк. Ядро владеет контрактами (AgentProvider, AgentEvent); Pydantic отвечает за конфиг и валидацию, а собственный agentic-loop ходит в модель через LiteLLM.
  2. Provider как сменный модуль на двух уровнях:
    • модель — через LiteLLM (любой LLM за единым API);
    • агентный рантайм — через AgentProvider (свой цикл / Claude Code / Codex).
  3. CLI как провайдер — Claude Code и Codex CLI за тем же интерфейсом, что и API.
  4. Middleware-pipeline — логи, стоимость, лимиты, кеш, guardrails как композируемые кросс-срезы, а не код внутри ядра.
  5. Skills/SKILL.md + AGENTS.md + MCP — три слоя инструкций и доступа.
  6. OpenTelemetry GenAI conventions — наблюдаемость из коробки.
flowchart LR
    App["Агент-приложение<br/>(agents/&lt;name&gt;)"] --> MW["Middleware<br/>pipeline"]
    MW --> P{"AgentProvider"}
    P -->|api| API["ApiProvider<br/>(собственный цикл + LiteLLM)"]
    P -->|claude_code| CC["ClaudeCodeProvider<br/>(Claude Agent SDK / CLI)"]
    P -->|codex| CX["CodexProvider<br/>(Codex CLI / SDK)"]
    API --> M[("LLM через LiteLLM")]
    MW -.->|спаны/метрики| OTel["OpenTelemetry"]

Установка

# из PyPI (после первого релиза: тег v0.1.0 публикует пакет через CI)
pip install agentyoke
# опциональные CLI-рантаймы:
pip install "agentyoke[claude-code]"

Quick start

# для разработки — из исходников
uv venv --python 3.12
uv pip install -e ".[dev]"

# запуск примера агента (нужен ключ модели, напр. ANTHROPIC_API_KEY)
python -m agents.example.run

Высокоуровневый API — класс Agent: загружает конфиг, собирает провайдер и middleware-цепочку, и отдаёт либо поток событий, либо агрегированный результат.

from agentyoke import Agent, Message, ToolRegistry

tools = ToolRegistry()


@tools.register
def current_time() -> str:
    """Текущее время."""
    from datetime import UTC, datetime
    return datetime.now(UTC).isoformat()


agent = Agent.from_config("agents/example/config.yaml", tools=tools)

# Поток событий (TextDelta / ToolCallEvent / UsageEvent / ...):
async for event in agent.run_stream([Message(role="user", content="Который час?")]):
    print(event)

# Или агрегированный результат целиком:
result = await agent.run([Message(role="user", content="Который час?")])
print(result.text, result.usage)

Сменить рантайм — это поменять одну строку provider: в config.yaml (apiclaude_codecodex). Прикладной код не меняется.

Если выбран provider: api, но ANTHROPIC_API_KEY не задан, агент прозрачно использует локальную сессию Claude Code (провайдер claude_code) — удобно для подписочного доступа без API-ключа. Отключается флагом Agent(..., local_session_fallback=False).

Документация

Документ О чём
docs/ARCHITECTURE.md Архитектурный обзор: два уровня провайдеров, ядро, потоки
docs/PROVIDERS.md Спека AgentProvider, AgentEvent, контракт каждого провайдера
docs/MIDDLEWARE.md Middleware-pipeline, встроенные middleware, 3 уровня политик
docs/SKILLS.md Три слоя: skills (SKILL.md) / AGENTS.md / MCP
docs/OBSERVABILITY.md OpenTelemetry, GenAI semantic conventions
docs/ROADMAP.md Этапы 0–4 с оценками сроков
docs/REFERENCES.md Источники: Omnigent, Pydantic AI, LiteLLM и др.

Структура репозитория

agentyoke/
├── src/agentyoke/        # ядро (тонкое): провайдеры, middleware, skills, observability
├── agents/               # агенты-приложения (каждый — свой config.yaml)
├── docs/                 # спецификации (источник истины)
├── CLAUDE.md / AGENTS.md # инструкции для агентных инструментов
└── pyproject.toml

English summary

agentyoke is a thin harness framework for AI agents. The core idea is a slim own core rather than a monolithic framework: the core owns the contracts, while its own agentic loop talks to models through LiteLLM. Providers are swappable on two levels: the model (via LiteLLM) and the agent runtime (AgentProvider: own loop, Claude Code, or Codex — "CLI as a provider"). Cross-cutting concerns (logging, cost tracking, rate limits, caching, guardrails) live in a composable middleware pipeline. Instructions and access come in three layers — Skills (SKILL.md) + AGENTS.md + MCP — and observability follows OpenTelemetry GenAI semantic conventions.

Switching the runtime is a one-line provider: change in config.yaml; the application agent code stays the same. See docs/ for full specifications.

Status: 0.1.0 — the core is implemented and tested: config loading, the middleware pipeline, observability, the skills loader, the ApiProvider agentic loop, and the CLI providers.

License

MIT.

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

agentyoke-0.1.0.tar.gz (146.9 kB view details)

Uploaded Source

Built Distribution

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

agentyoke-0.1.0-py3-none-any.whl (65.0 kB view details)

Uploaded Python 3

File details

Details for the file agentyoke-0.1.0.tar.gz.

File metadata

  • Download URL: agentyoke-0.1.0.tar.gz
  • Upload date:
  • Size: 146.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentyoke-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd398774255a1a1ef43ad0441a4592c3ca8a59f01ec45d37519bd29809294ce3
MD5 b7aea834ca6ce2bf31b995d02ae00904
BLAKE2b-256 994468321a87d0e820df195d7fce7d0595c7a3cc511fd40942e4c2be1af9e06a

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentyoke-0.1.0.tar.gz:

Publisher: release.yml on mogilevtsevdmitry/agentyoke

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

File details

Details for the file agentyoke-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentyoke-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 65.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentyoke-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5298e9df54dfd069885942966f65cec1ebe75155cdcb68330af7bfd536730ba
MD5 d0c8650f1bddbe59237361f7b956bcde
BLAKE2b-256 7d8722b2b7abcfcc0abec4401068a2d2157eb14133d4e12b0107b0404c630a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentyoke-0.1.0-py3-none-any.whl:

Publisher: release.yml on mogilevtsevdmitry/agentyoke

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 Pingdom Monitoring Sentry Error logging StatusPage Status page