A tiny, swappable LLM orchestration core.
Project description
Loomkit
A tiny, swappable LLM orchestration core. The seam under an agent harness — without LangChain-scale bloat.
v0 ships the smallest useful surface:
- A
ProviderProtocol — anything with the rightgenerate()signature is a provider, no inheritance. Message/Response/Usagedataclasses.- One concrete provider:
GeminiProvider(officialgoogle-genaiSDK).
That's it. Streaming, tool calling, agents, retries, and graphs are deliberately deferred — they layer on through the Provider seam without breaking call sites.
Install
pip install loomkit # core only, zero deps
pip install 'loomkit[gemini]' # adds google-genai
pip install 'loomkit[gemini,dev]' # plus pytest
Requires Python 3.10+.
Quickstart
import os
from loomkit import Message
from loomkit.providers.gemini import GeminiProvider
# Reads GEMINI_API_KEY (or GOOGLE_API_KEY) from env; or pass api_key=...
provider = GeminiProvider()
resp = provider.generate(
[
Message(role="system", content="You are concise."),
Message(role="user", content="Name three primary colors."),
],
model="gemini-2.5-flash",
temperature=0.2,
)
print(resp.text)
print(resp.finish_reason, resp.usage)
Why a Protocol, not a base class
Provider is a typing.Protocol. Adding a new backend means writing one class with a generate() method matching the signature — no imports from loomkit, no inheritance, no registration. Call sites typed against Provider accept any conforming class.
class MyProvider:
def generate(self, messages, *, model, temperature=None,
max_tokens=None, stop=None) -> Response: ...
What's deferred (and how it lands)
| Feature | How it'll be added |
|---|---|
| Streaming | generate_stream() method returning chunk iterables |
| Tool / function calling | tools= kwarg; Message.content grows to a parts list |
| Async | Sibling AsyncProvider Protocol with async def generate(...) |
| Retries / rate limiting | Decorator providers — RetryingProvider(inner, ...) |
| Tracing / observability | Same shape — TracingProvider(inner, sink) |
| Agent loops | One layer up: loomkit.agents consumes a Provider |
| Graphs | Top of the stack; consumes agents |
Development
pip install -e '.[gemini,dev]'
pytest -q
The Gemini smoke test is skipped unless GEMINI_API_KEY is set.
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 loomkit-0.0.2.tar.gz.
File metadata
- Download URL: loomkit-0.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6063ead656228bcefd55ed28f78c6bb4f0a92a96e85de3131bf47e26c8eedc
|
|
| MD5 |
601bcf40c2452bdc351f1c3c7550df65
|
|
| BLAKE2b-256 |
cb95445745f40431e02e106553691e567e5ee13d8f79e34e595d6ab1a435905f
|
File details
Details for the file loomkit-0.0.2-py3-none-any.whl.
File metadata
- Download URL: loomkit-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
922fb3015bc6fdcd8ba83ac7a7fdf8df03c78170ac64c73c17fc0b27a61a3e9d
|
|
| MD5 |
e3be274fc64009789eef0c7979b66058
|
|
| BLAKE2b-256 |
da2186586a9fc9eeb88a9eaa4f3fd7afc7961c58b769b9412b2b71b3f5d82968
|