Skip to content

Introduction

Anvil is a JIT (Just-In-Time) Infrastructure SDK for AI agents. Instead of hardcoding tool implementations that break when APIs change, you define intents and Anvil generates the code on the fly.

Every AI agent needs tools - functions to search the web, call APIs, process data. Traditional approaches have a critical flaw:

# Traditional approach - brittle, breaks when API changes
def search_notion(query: str) -> dict:
response = requests.post(
"https://api.notion.com/v1/search",
headers={"Authorization": f"Bearer {NOTION_KEY}"},
json={"query": query}
)
return response.json()

This works until:

  • The API endpoint changes
  • Authentication requirements update
  • Response format evolves
  • Rate limiting is introduced

Then your agent breaks, and you’re manually fixing code.

With Anvil, you describe what you want, not how to do it:

from anvil import Anvil
anvil = Anvil()
search_tool = anvil.use_tool(
name="search_notion",
intent="Search a Notion workspace for pages matching a query",
docs_url="https://developers.notion.com/reference/post-search"
)

Anvil:

  1. Fetches the latest API documentation
  2. Generates working Python code using an LLM
  3. Caches the generated code for future use
  4. Automatically regenerates if the tool fails

Tools are generated at runtime using LLMs. Provide the intent and optionally a documentation URL, and Anvil produces working code.

When a tool fails, Anvil captures the error context and regenerates the code automatically. No manual intervention needed.

Use Claude (Anthropic), GPT-4 (OpenAI), or Grok (xAI). Bring your own API keys.

One tool works everywhere:

# 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()

All generated code is saved to disk, visible, and editable. You can:

  • Inspect what Anvil generated
  • Manually edit and “eject” tools
  • Version control everything

Anvil is ideal when:

  • You’re building AI agents that need dynamic tool capabilities
  • You want tools that adapt to API changes automatically
  • You’re working with multiple AI frameworks and want portable tools
  • You need transparency into what your tools are doing

Ready to get started?

  1. Install Anvil
  2. Follow the Quick Start guide
  3. Learn how tool generation works