Skip to main content

koina

An agentic toolset.

Reusable, provider-neutral building blocks for agents on low-level LLM SDKs: the six core file/shell tools (Read, Write, Edit, Bash, Glob, Grep), a never-raising dispatch, structured JSONL logging, and a thin adapter per provider. koina gives you the tools and the dispatch; the agentic loop stays in your code.

Requirements

  • Python 3.12+
  • ripgrep (rg) on PATH (for Glob and Grep)

Install

uv add koina

The library depends only on pydantic. Provider SDKs (anthropic, openai) are the caller's dependency, used in your loop, not by koina.

Usage

dispatch and the tools are provider-neutral; an adapter translates a provider's wire format to and from the neutral ToolCall/ToolResult. With the Anthropic adapter:

from pathlib import Path
from anthropic import AsyncAnthropic
from koina import default_registry, dispatch, ToolContext
from koina.adapters import anthropic as adapter

client = AsyncAnthropic()
reg = default_registry()
ctx = ToolContext(cwd=Path.cwd())
msgs = [{"role": "user", "content": "List the Python files."}]

while True:
    resp = await client.messages.create(
        model="claude-opus-4-8", max_tokens=4096,
        messages=msgs, tools=adapter.tools_param(reg),
    )
    msgs.append({"role": "assistant", "content": resp.content})
    calls = adapter.parse_tool_calls(resp.content)
    if not calls:
        break
    results = [await dispatch(c, reg, ctx) for c in calls]
    msgs.append(adapter.format_results(results))

Swap koina.adapters.anthropic for koina.adapters.openai to run the same tools against the OpenAI Chat Completions API (or any OpenAI-compatible server, e.g. llama.cpp). See examples/ for runnable read-only code-review scripts on both.

What's in the box

  • Six core tools (Read, Write, Edit, Bash, Glob, Grep), faithful to Claude Code's observable behavior, headless (no permissions or hooks).
  • dispatch never raises: it always returns a ToolResult (errors set is_error=True).
  • Provider-neutral core (ToolCall, ToolResult) with per-provider adapters (koina.adapters.anthropic, koina.adapters.openai). The library never imports a provider SDK at runtime.
  • Structured logging: typed events (tool calls, model calls, token usage, reasoning) emitted to a pluggable EventSink (JsonlSink/NullSink), so a run reconstructs from a JSONL transcript. Off by default, near-zero overhead when inactive.

Permissions, web tools, and concurrency orchestration are out of scope.

Metadata

Release files for koina 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for koina 0.1.0
File Size Uploaded Provenance
koina-0.1.0.tar.gz 12.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for koina 0.1.0
File Interpreter ABI Platform
koina-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / koina-0.1.0.tar.gz

Download URL koina-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e433075c38ef16f14c05c21d6689290edf1b7408e8087dc6ce40bbe25c87626
BLAKE2b-256 checksum
How to use checksums
aa397ecfe7a40d82e0e7c6a0b5dd00c93ba39849bf64c235f2ed1be321fe55d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Release files / koina-0.1.0-py3-none-any.whl

Download URL koina-0.1.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3426e19b2881c3b4766c222366880a06af94951cd09a4b0eaba9eba00b9cb31
BLAKE2b-256 checksum
How to use checksums
34fd3034172e07874408053d0024821108b80ed37dfe9f543c186f661346dfd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

Security for koina 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for koina-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page