Skip to main content

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

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
  • 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 .gitignore to 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anvil_agent-0.1.0.tar.gz (65.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anvil_agent-0.1.0-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file anvil_agent-0.1.0.tar.gz.

File metadata

  • Download URL: anvil_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 65.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for anvil_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 544812788d9d347071c78bfa87f0da5316de35ff991b14e932bac2c05b729233
MD5 fe96b66891300f2bce4bf1eef4eae8cc
BLAKE2b-256 498ea46726ea58fa7ee3fb4bdf0a44793322efba5ecc0206889b3ecdf8b41fe1

See more details on using hashes here.

File details

Details for the file anvil_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anvil_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for anvil_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31b06d9167e2ac1e6e8d52351c0e25b65b66a40f018f471a380b0ca6381192c0
MD5 52e8444c149e275bbb649ab411608d9a
BLAKE2b-256 576e5c356eda7c17ae49d39c1577c8e2a91e61d6ab8ad6d7384946a4a6dedcd9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page