An agentic toolset: provider-neutral tools and dispatch for building agents on low-level LLM SDKs
Project description
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).
dispatchnever raises: it always returns aToolResult(errors setis_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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file koina-0.1.0rc1.tar.gz.
File metadata
- Download URL: koina-0.1.0rc1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff9347fbc0c1833b369dadabf0a7e3be0102d49cd8a9a3752b0e97e777556113
|
|
| MD5 |
f4bcc14f5f025b40dabaaf7d642742a6
|
|
| BLAKE2b-256 |
3708e3a93b255047a5020d00972480e67e6cf4cea0a8a2960af4dfaee43bdccd
|
Provenance
The following attestation bundles were made for koina-0.1.0rc1.tar.gz:
Publisher:
release.yml on ggueret/koina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
koina-0.1.0rc1.tar.gz -
Subject digest:
ff9347fbc0c1833b369dadabf0a7e3be0102d49cd8a9a3752b0e97e777556113 - Sigstore transparency entry: 1792506198
- Sigstore integration time:
-
Permalink:
ggueret/koina@ba39d9400dc06f11f91a8f1abf05cd944200a9ed -
Branch / Tag:
refs/tags/v0.1.0rc1 - Owner: https://github.com/ggueret
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ba39d9400dc06f11f91a8f1abf05cd944200a9ed -
Trigger Event:
push
-
Statement type:
File details
Details for the file koina-0.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: koina-0.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddd60564c71eedefce037ccc286d95053ac0347c2721d41adca4c435269d5055
|
|
| MD5 |
4e64e8bc313058c3e705524050b169d8
|
|
| BLAKE2b-256 |
2e1d5ccf16530ae427af4c5bb99d864796643f511826aa8ca0e8832d97a2752f
|
Provenance
The following attestation bundles were made for koina-0.1.0rc1-py3-none-any.whl:
Publisher:
release.yml on ggueret/koina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
koina-0.1.0rc1-py3-none-any.whl -
Subject digest:
ddd60564c71eedefce037ccc286d95053ac0347c2721d41adca4c435269d5055 - Sigstore transparency entry: 1792506315
- Sigstore integration time:
-
Permalink:
ggueret/koina@ba39d9400dc06f11f91a8f1abf05cd944200a9ed -
Branch / Tag:
refs/tags/v0.1.0rc1 - Owner: https://github.com/ggueret
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ba39d9400dc06f11f91a8f1abf05cd944200a9ed -
Trigger Event:
push
-
Statement type: