Anvil SDK
JIT Infrastructure & Self-Healing SDK for AI Agents
Documentation | PyPI | GitHub
Anvil prevents "Tool Rot" in AI agents. Instead of hard-coding tool implementations that break when APIs change, define intents and Anvil generates the code on the fly.
Features
- JIT Code Generation - Generate tool code at runtime using LLMs
- Smart Parameterization - Automatically generates reusable, parameterized tools (no hardcoded values)
- Self-Healing - Automatic regeneration when tools fail
- Multi-Provider - Works with Claude, GPT, Grok (BYO API keys)
- Glass-Box - All generated code is visible and editable
- Framework Adapters - Works with LangChain, CrewAI, AutoGen, OpenAI Agents SDK
- Beautiful CLI - Professional terminal experience with Rich
Quick Start
1. Install
pip install anvil-agent
With Claude support (recommended):
pip install "anvil-agent[anthropic]"
2. Initialize Your Project
anvil init
This interactive wizard will:
- Create the
anvil_tools/directory for generated tools - Set up
.gitignoreto protect your API keys - Securely prompt for your API keys and save them to
.env - Create an example script to get you started
3. Start Building
from dotenv import load_dotenv
from anvil import Anvil
load_dotenv()
# Initialize Anvil
anvil = Anvil(tools_dir="./anvil_tools")
# Define what you want, not how
search_tool = anvil.use_tool(
name="search_notion",
intent="Search the user's Notion workspace using the official API",
docs_url="https://developers.notion.com/reference/post-search"
)
# Execute
result = search_tool.run(query="Project Anvil")
# Code is saved to ./anvil_tools/search_notion.py
print(anvil.get_tool_code("search_notion"))
CLI Commands
anvil init # Initialize a new project with interactive setup
anvil doctor # Check system requirements and API keys
anvil list # List all generated tools
anvil clean # Clear tool cache to force regeneration
anvil verify # Verify tool code in sandbox
Installation Options
# Basic installation
pip install anvil-agent
# With LLM provider
pip install "anvil-agent[anthropic]" # Claude (recommended)
pip install "anvil-agent[openai]" # GPT-4
# With framework adapter
pip install "anvil-agent[langchain]"
pip install "anvil-agent[crewai]"
pip install "anvil-agent[autogen]"
pip install "anvil-agent[openai-agents]"
# Everything
pip install "anvil-agent[all]"
Multi-Provider Support
# Use Claude (default)
anvil = Anvil(provider="anthropic")
# Use OpenAI GPT-4
anvil = Anvil(provider="openai", model="gpt-4o")
# Use Grok
anvil = Anvil(provider="grok", model="grok-2")
Framework Integration
# LangChain
lc_tool = search_tool.to_langchain()
# CrewAI
crew_tool = search_tool.to_crewai()
# AutoGen
autogen_tool = search_tool.to_autogen()
# OpenAI Agents SDK
oai_tool = search_tool.to_openai_agents()
Testing Without API Keys
anvil = Anvil(use_stub=True) # Returns mock implementations
Anvil Cloud (Coming Soon)
For instant cached tools without LLM latency:
pip install anvil-cloud
anvil = Anvil(mode="cloud") # Instant retrieval from global cache
Development
# Clone the repository
git clone https://github.com/Kart-ing/anvil-sdk.git
cd anvil-sdk
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest -v
# Run examples
python examples/basic_usage.py --stub
Documentation
Full documentation is available at anvil-sdk-docs.vercel.app
- Getting Started
- How It Works
- Self-Healing
- LangChain Integration
- CrewAI Integration
- AutoGen Integration
- OpenAI Agents SDK
- API Reference
Building & Publishing
# Build the package
python -m build
# Upload to TestPyPI first
twine upload --repository testpypi dist/*
# Upload to PyPI
twine upload dist/*
License
MIT License - See LICENSE for details.
Metadata
Release files for anvil-agent 0.1.1
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 | Actions |
|---|---|---|---|---|
| anvil_agent-0.1.1.tar.gz | 72.2 kB | Without provenance | Details for anvil_agent-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anvil_agent-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for anvil_agent-0.1.1-py3-none-any.whl |
Total release size: 125.3 kB
Release files / anvil_agent-0.1.1.tar.gz
| Download URL | anvil_agent-0.1.1.tar.gz |
|---|---|
| Size | 72.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fab856091cfd5dd3425693e0bd3d26edf7e8532dfbbe7ee24ed26061e728f450
|
|
BLAKE2b-256 checksum How to use checksums |
60595279e47173a487e3c3432dcf678fa760e912e88e9a8b67681fb1509fec34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / anvil_agent-0.1.1-py3-none-any.whl
| Download URL | anvil_agent-0.1.1-py3-none-any.whl |
|---|---|
| Size | 53.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fef44e80e9b3054586b0365ed64a11ce269c26c13991eb76f37f4497854eb49c
|
|
BLAKE2b-256 checksum How to use checksums |
8491fc70fc97faf275f24cf13df3727065d87ce98df635bef5e5991aa5bda1b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for anvil-agent 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.