AsyncToolkit
AsyncToolkit is a lightweight, extensible framework for building and running asynchronous tools in Python. It provides a unified interface for executing asynchronous operations, such as HTTP requests and file system operations, with support for multiple backends. Out of the box, AsyncToolkit comes with several HTTP backends (using libraries such as aiohttp, httpx, requests, and even pyodide for browser-based Python environments) and a file system tool. You can also easily register your own custom tools and extensions.
Features
- Unified Async Interface: Standardized API for executing asynchronous operations.
- Multiple HTTP Backends: Choose from
aiohttp,httpx,requests(wrapped for async), orpyodide(in browser environments). - Extendable: Easily register and retrieve custom tools and extensions.
- Built-in Tools: Includes sample tools for common tasks like HTTP requests and file system operations.
- Test Suite: Comprehensive tests using
pytestandtoxto ensure reliability.
Installation
AsyncToolkit requires Python 3.10 or later. You can install the package and its optional dependencies using pip:
# Install the core package
pip install asynctoolkit
# For HTTP functionality, install one or more of the following:
pip install aiohttp # For aiohttp backend
pip install httpx # For httpx backend
pip install requests # For requests backend
pip install pyodide # For pyodide backend (if running in a Pyodide environment)
Quick Start
Here’s a brief example demonstrating how to use AsyncToolkit to perform an HTTP GET request and list directory contents:
import asyncio
from asynctoolkit.base import run_tool
async def main():
# Example 1: File System Operation
# Using the "filesystem" tool to list directory contents.
file_list = await run_tool("filesystem", path=".", operation="list")
print("Directory Contents:", file_list)
# Example 2: HTTP Request
# Using the "http" tool with the default (first registered) HTTP backend.
TEST_URL = "https://httpbin.org/get"
async with await run_tool("http", url=TEST_URL, method="GET") as response:
status = await response.status()
data = await response.json()
print("HTTP Status:", status)
print("Response JSON:", data)
if __name__ == "__main__":
asyncio.run(main())
Specifying HTTP Extensions
AsyncToolkit's HTTP tool supports multiple extensions. You can explicitly choose which backend to use by specifying the extension parameter:
# Example using the aiohttp backend explicitly
async with await run_tool("http", url="https://httpbin.org/get", method="GET", extension="aiohttp") as response:
print("HTTP Status (aiohttp):", await response.status())
If no extension is specified, the tool will default to the first registered extension.
Extending AsyncToolkit
You can easily create and register your own asynchronous tools or extend existing ones.
Creating a Custom Tool
Define a new tool by subclassing AsyncTool and implement the asynchronous run() method:
from asynctoolkit.base import AsyncTool, register_tool
class MyCustomTool(AsyncTool):
async def run(self, *args, **kwargs):
# Your custom async operation here
return "custom_result"
# Register the custom tool under a unique name
register_tool("my_custom", MyCustomTool)
# Running the custom tool later:
import asyncio
from asynctoolkit.base import run_tool
async def run_my_tool():
result = await run_tool("my_custom")
print(result) # Outputs: custom_result
asyncio.run(run_my_tool())
Adding Extensions
For tools that support multiple implementations (like the HTTP tool), you can register extensions. Each extension is simply an asynchronous function that conforms to the tool’s expected interface. See the built-in HTTP tool in asynctoolkit.defaults.http for examples using aiohttp, httpx, requests, and pyodide.
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for asynctoolkit 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asynctoolkit-0.3.0.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asynctoolkit-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.1 kB
Release files / asynctoolkit-0.3.0.tar.gz
| Download URL | asynctoolkit-0.3.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93a00a941158dacc81d751b92a0fb7b5c8e1e540b6b76e47e742017425efc54a
|
|
BLAKE2b-256 checksum How to use checksums |
7fe24388bc06000f194501858ea85ae0a0502ff3d6bccf97972a547414ee8029
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.
Transparency logRelease files / asynctoolkit-0.3.0-py3-none-any.whl
| Download URL | asynctoolkit-0.3.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51268542be970a429cc00f619880e2d1e263e6e310333326b940a5ae29537aa9
|
|
BLAKE2b-256 checksum How to use checksums |
7767dd7d396706cc6e9e80963a4fc7f5a53a69e5bc3f134b5d58c3719c5dfb92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.
Transparency log