JIT Infrastructure & Self-Healing SDK for AI Agents - Generate tools on the fly with BYO API keys
Project description
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.
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 anvil_agent-0.1.1.tar.gz.
File metadata
- Download URL: anvil_agent-0.1.1.tar.gz
- Upload date:
- Size: 72.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fab856091cfd5dd3425693e0bd3d26edf7e8532dfbbe7ee24ed26061e728f450
|
|
| MD5 |
5e845f27dbef0a7bd48f3f6638e7b38b
|
|
| BLAKE2b-256 |
60595279e47173a487e3c3432dcf678fa760e912e88e9a8b67681fb1509fec34
|
File details
Details for the file anvil_agent-0.1.1-py3-none-any.whl.
File metadata
- Download URL: anvil_agent-0.1.1-py3-none-any.whl
- Upload date:
- Size: 53.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fef44e80e9b3054586b0365ed64a11ce269c26c13991eb76f37f4497854eb49c
|
|
| MD5 |
b411d8380714c44a006d13bf6d4d1585
|
|
| BLAKE2b-256 |
8491fc70fc97faf275f24cf13df3727065d87ce98df635bef5e5991aa5bda1b2
|