Skip to main content

A lightweight wrapper to tailor and secure your Python functions for AI agents.

Project description

toolsuit

PyPI Tests License: MIT

Stop giving LLMs direct access to your raw backend.

toolsuit is a zero-dependency Python decorator that acts as a secure middleware between your AI agents (LangChain, OpenAI, Anthropic, Pydantic) and your actual code.

If you pass backend functions directly to AI SDKs, the LLM reads your entire signature. It will try to hallucinate database connection strings, expose secure API keys, and blow up your token limits by reading massive return payloads it doesn't need.

toolsuit dynamically rewrites the __signature__ of your function at import-time. It tailors the function so the AI only sees a clean, lightweight schema, while your backend safely handles the heavy lifting locally.

Installation

pip install toolsuit

Why use Toolsuit?

  • Zero-Knowledge Security: The AI never sees your API keys, database sessions, or local environment variables.
  • Token Efficiency: Stop feeding 10MB database rows back into the context window just to tell the AI an operation succeeded.
  • Prevents Hallucinations: A clean, minimal function signature keeps the agent focused and prevents it from hallucinating system-level arguments.

Quickstart: The @equip Decorator

You don't need to rewrite your backend logic. Just decorate it. toolsuit intercepts the execution loop, natively tricking standard SDKs (like Pydantic or OpenAI) into generating a safe schema.

from typing import Any, Dict
from toolsuit import equip

@equip( 
hide=["db_session"],# 1. HIDE: Completely remove these from the AI's generated JSON schema
inject={"db_session": lambda: get_secure_database()}, # 2. INJECT: Securely fetch the missing state locally at runtime 
alias={"user_id": lambda ai_string: resolve_internal_uuid(ai_string)}, # 3. ALIAS: Translate the AI's simplified input into your complex local internal ID
mask_output=lambda raw_row: {"status": "ok", "user": raw_row.get("public_alias")} # 4. MASK: Strip the massive raw output down to exactly what the AI needs

)
def fetch_user(user_id: str, db_session: Any) -> Dict[str, Any]:
"""Fetches a user profile from the secure database.""" # Your unmodified backend logic runs here securely
return {
"public_alias": "usr_fake",
"internal_id": user_id,
"password": "super_secret_hash_992",
"credit_card": "4242_1111_2222_3333"
}

Execution Trace

When you pass fetch_user to your AI agent, toolsuit cleanly intercepts the translation layer.

1. What the AI Schema Parser sees: A perfectly clean, safe function. No database sessions, no secrets.

def fetch_user(user_id: str):
"""Fetches a user profile from the secure database."""

2. What the AI sends during execution:

{
"name": "fetch_user",
"arguments": {"user_id": "usr_fake"}
}

3. What the AI receives after execution: The massive database row full of PII and passwords was masked securely on your server. The AI only gets the lightweight summary.

{
"status": "ok",
"user": "usr_fake"
}

Limitations & Roadmap

  • Status: Sync Only. Currently supports synchronous functions only. Async support (async def) is coming in v0.2.
  • Methods: Class method support (self parameter handling) is under active development.

Contributing

Toolsuit is actively looking for open-source contributors. See CONTRIBUTING.md for current issues, architecture details, and good first issues.

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

toolsuit-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

toolsuit-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for toolsuit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e74e29a70ff70dd6d9ee9e4c8dab4770c0050d2d2162dd6bd9cf7de85b42260a
MD5 b478ddf3e454441a3b35fa5de7c1381c
BLAKE2b-256 b9efe08afb99e1c774ec9637016ab87c338602a813262a9865157c7112008309

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for toolsuit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29624f8826477211d48e08575f880a7eb507a7ead4e4248613684102580211cc
MD5 75f3371fdffa8352f68a03808080910b
BLAKE2b-256 dc06292f10c3654c3d8aeab4eaa3ce6d624881ad78664b91ebff821f2f1f04ae

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