Baretools AI
The un-framework for AI Engineers — Build AI Agents, Not Framework Wrappers.
Status: Alpha. Documentation · API Reference · Why Baretools? · Changelog
Why
Modern agent frameworks own your prompts, your orchestration, and your state. That trade-off is fine for demos and POCs, but in production it costs you the control needed to build your own Agent Harness. You also end up knowing the framework better than the underlying engineering — which is exactly backwards.
Baretools handles only the mechanical glue between your Python functions and the LLM:
- Function → provider tool schema (OpenAI, Anthropic, Gemini, generic JSON Schema)
- Parsing tool calls out of provider responses
- Validating and executing those calls (sync, async, parallel, streaming)
- Formatting results back into provider-shaped messages
Everything else — prompts, loops, retries, memory, guardrails — stays in your code.
Install
pip install baretools-ai
Pre-requisite:
- Python >=3.10x
- Optional Pydantic support:
pip install "baretools-ai[pydantic]".
Quickstart
from baretools import tool, ToolRegistry, parse_tool_calls, format_tool_results
from openai import OpenAI
@tool
def get_weather(location: str) -> str:
"""Get current weather for a location."""
return f"Sunny, 72°F in {location}"
tools = ToolRegistry()
tools.register(get_weather)
client = OpenAI()
messages = [{"role": "user", "content": "What's the weather in Paris?"}]
max_iterations = 5 # Can be very high in real world agents
iteration = 0
while iteration < max_iterations:
response = client.chat.completions.create(
model="gpt-4.1",
messages=messages,
tools=tools.get_schemas("openai"),
)
iteration += 1
message = response.choices[0].message
messages.append(message)
tool_calls = parse_tool_calls(message, "openai")
if not tool_calls:
print("Final Response:", message.content)
break
results = tools.execute(tool_calls)
messages.extend(format_tool_results(results, "openai"))
You write the loop. Baretools handles the schema, parsing, execution, and formatting on each side.
Runnable Examples
Working agents for each provider are in examples/:
OPENAI_API_KEY=... uv run python examples/openai_agent.py
ANTHROPIC_API_KEY=... uv run python examples/anthropic_agent.py
GOOGLE_API_KEY=... uv run python examples/gemini_agent.py
Features
- Zero runtime dependencies — stdlib only; no transitive supply chain to audit
- Multi-provider schemas —
tools.get_schemas("openai" | "anthropic" | "gemini" | "json_schema") - Sync, async, streaming —
execute,execute_async,execute_stream,execute_stream_async - Parallel tool execution — pass
parallel=Truewithmax_workers(sync) ormax_concurrency(async) to fan out independent calls - Tool call hooks —
before_toolandafter_toolcallbacks let you plug in guardrails, redaction, auditing, or tracing around every call - Retries with structured events — pass
on_event=...to observe attempts/retries/failures - Type-driven validation —
dataclasseswork out of the box;pydanticBaseModels supported when installed - Provider-native parsing/formatting —
parse_tool_calls()andformat_tool_results()for all four providers
See the docs site for the full API reference, advanced patterns, and design notes.
Development
uv sync --group dev
uv run ruff check .
uv run pytest -q
Contributing
Baretools is designed to be strictly minimal. Preferably, we only add features that are universally needed across tool-calling applications and difficult for developers to implement themselves. Please open an issue to discuss your idea before proposing a new feature.
License
MIT — see LICENSE.
Metadata
Release files for baretools-ai 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| baretools_ai-0.4.4.tar.gz | 13.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baretools_ai-0.4.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / baretools_ai-0.4.4.tar.gz
| Download URL | baretools_ai-0.4.4.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
657239f5683b3144bb2967882e264afcb0a9de8f4acb8f22a47f2b178976b6fd
|
|
BLAKE2b-256 checksum How to use checksums |
dbb0d4b778cd6c39938e8342c1d2e712ae7bcbc375333d0eab10ef3991a3362d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 24, 2026.
Transparency logRelease files / baretools_ai-0.4.4-py3-none-any.whl
| Download URL | baretools_ai-0.4.4-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb38a20dc0ed42f84b04eb4a8ce5606848e52c6b8ed060534bb87cd0bdeaf73b
|
|
BLAKE2b-256 checksum How to use checksums |
bb5ef7c41bef10f249be90b9cd3eeadc6af6e6fe4db794dcff461a27e843bb9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 24, 2026.
Transparency logSecurity for baretools-ai 0.4.4
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.
Attestation for baretools_ai-0.4.4.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 Apr 24, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.