Skip to main content

Agent-native API execution. No wrappers, no Composio. OAuth + API specs + direct HTTP.

Project description

anytool

Agent-native API integration SDK. Curated specs. Direct execution. Zero wrappers.

Give your AI agent curated API specs + OAuth tokens — it calls any API directly.

Quick Start

from anytool import AnyTool

api = AnyTool(nango_secret_key="nango-secret-xxx")

# Call any API by action name
result = await api.call(
    "gmail_send_email",
    connection_id="workspace-123",
    to="vendor@example.com",
    subject="Invoice Follow-up",
    body="Hi, please send the updated invoice.",
)
# → {"data": {"id": "msg-123", "threadId": "thread-456"}, "successful": True, "extracted_ids": {"message_id": "msg-123", "thread_id": "thread-456"}}

# Get LangChain tools for an app
tools = api.get_tools("google", connection_id="workspace-123")
# → [gmail_send_email, gmail_search, gmail_get_thread, sheets_append_row, ...]

# Or get tools for ALL apps at once
all_tools = api.get_all_tools(connection_id="workspace-123")
# → 49 tools across 5 apps, ready for llm.bind_tools()

The Problem

Existing integration platforms pre-build wrappers for each API action. These wrappers:

  • Drop nested data — complex payloads like templateRoles: [{roleName, email, name}] arrive at the API as [{}]
  • Break across versions — SDK updates introduce Python version incompatibilities that crash your production server
  • Return non-standard formats — responses come back as Python repr strings instead of JSON, requiring custom parsing
  • Silently limit results — only 20 tools returned by default, with no indication that actions are missing
  • Add unnecessary latency — every request routes through a third-party proxy before reaching the actual API

How anytool Works

Layer What How
Auth OAuth, token refresh, storage Nango (700+ apps, open-source)
Knowledge Curated API specs — params, paths, descriptions anytool specs (~15 lines per action)
Execution Build HTTP request, handle API quirks, parse response anytool executor (direct HTTP)

No intermediate wrappers. No serialization layers. What the LLM constructs is what the API receives.

Install

pip install anytool                    # Core (httpx + pydantic + loguru)
pip install anytool[langchain]         # + LangChain tool generation

Supported Apps — 49 Actions

App Actions Auth
Gmail 7 — send, search, get, thread, reply, labels, modify OAuth2
Google Sheets 2 — append row, read range OAuth2
Google Drive 2 — list files, get file OAuth2
DocuSign 6 — create envelope, get status, list, recipients, void, resend OAuth2
Freshdesk 10 — create/get/update/delete ticket, reply, note, list, search, conversations, agents API Key
Slack 7 — send/update message, channels, history, thread, reaction, lookup user OAuth2
HubSpot 15 — contacts, companies, deals (CRUD + search), notes, associations, owners OAuth2

Two Modes

Mode 1: Nango (Recommended)

Nango handles OAuth for 700+ apps. anytool calls APIs through Nango's proxy which auto-injects tokens.

from anytool import AnyTool

api = AnyTool(nango_secret_key="nango-secret-xxx")

# Check connection
connected = await api.is_connected("google", "workspace-123")

# Call API
result = await api.call("gmail_search", connection_id="workspace-123", q="from:vendor@example.com is:unread")

# Get LangChain tools
tools = api.get_tools("google", connection_id="workspace-123")

Mode 2: Standalone

Manage OAuth yourself. Bring your own token store.

from anytool import AnyTool, MemoryTokenStore, AppCredentials

api = AnyTool(token_store=MemoryTokenStore())

api.register_app(AppCredentials(
    app="google",
    client_id="xxx.apps.googleusercontent.com",
    client_secret="GOCSPX-xxx",
    scopes=["https://www.googleapis.com/auth/gmail.send"],
    redirect_uri="http://localhost:8000/oauth/callback",
))

# Start OAuth flow
auth_url = await api.get_auth_url("google", connection_id="user-123")

# Handle callback
tokens = await api.handle_callback("google", code="xxx", state="xxx")

# Call APIs
result = await api.call("gmail_send_email", connection_id="user-123", to="...", subject="...", body="...")

LangChain Integration

from anytool import AnyTool

api = AnyTool(nango_secret_key="xxx")

# Get tools for one app
gmail_tools = api.get_tools("google", connection_id="workspace-123")

# Get tools for specific actions only
send_tools = api.get_tools("google", connection_id="workspace-123", actions=["gmail_send_email", "gmail_search"])

# Get tools for multiple apps
all_tools = api.get_all_tools(connection_id="workspace-123", apps=["google", "slack", "freshdesk"])

# Use with LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o")
llm_with_tools = llm.bind_tools(all_tools)

Triggers (Event Detection)

Poll-based triggers that detect new events and POST to your webhook:

from anytool import AnyTool, TriggerEngine, MemoryTriggerStore, TriggerConfig

api = AnyTool(nango_secret_key="xxx")
engine = TriggerEngine(api=api, store=MemoryTriggerStore())

await engine.register(TriggerConfig(
    id="t1",
    trigger_type="gmail_new_message",
    provider="google",
    connection_id="workspace-123",
    webhook_url="https://your-app.com/api/webhook/trigger",
    filters={"from_contains": "vendor@example.com"},
    poll_interval_seconds=90,
))

await engine.start()

Adding a New App

  1. apps/registry.py — Add AppConfig (OAuth URLs, base URL)
  2. specs/newapp.py — Write ActionSpec per endpoint (~15 lines each)
  3. client.py — Import and register specs
  4. executor.py — Add _build_* method only if the API has payload quirks
  5. tests/test_core.py — Add tests

Architecture

┌─────────────────────────────────────────────┐
│  Your AI Agent (LangChain / CrewAI / raw)   │
│                                             │
│  tools = api.get_tools("google", conn_id)   │
│  result = await api.call("gmail_send_email")│
└──────────────────┬──────────────────────────┘
                   │
         ┌─────────▼─────────┐
         │  anytool client   │
         │                   │
         │  Spec Registry    │  ← 49 curated ActionSpecs
         │  Provider Mapping │  ← app slug → Nango key
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐
         │   API Executor    │
         │                   │
         │  Build URL/path   │
         │  Build query      │
         │  Build body       │  ← request transforms for quirky APIs
         │  Extract IDs      │  ← response_ids mapping
         └─────────┬─────────┘
                   │
         ┌─────────▼─────────┐         ┌──────────────┐
         │  Nango Proxy      │────────▶│  Real API    │
         │  (auth injection) │◀────────│  (Gmail etc) │
         └───────────────────┘         └──────────────┘

License

MIT

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

anytool-0.1.1.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

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

anytool-0.1.1-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file anytool-0.1.1.tar.gz.

File metadata

  • Download URL: anytool-0.1.1.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for anytool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ffb8b09f606070caece3d9154e812e2cc9fd510fb38566f2fc75637ec340af9c
MD5 8b282cb6448e921bfcdce34dbb0cab60
BLAKE2b-256 9a5dcffd2b3171758e6ef504134c5bc64e436d84852ecce35d93252d1900da02

See more details on using hashes here.

File details

Details for the file anytool-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: anytool-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for anytool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33b6ce0821d476aa9bafa35c314c46190d04a0044928eb729c2041b3a450b055
MD5 323101dad7509b6d13a3c5bf9a8e4fea
BLAKE2b-256 a2e9d3249113d18bdc15a310bef5145d24e0969fa87e683a55b613756dbe71d2

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