strands-utcp
Universal Tool Calling Protocol (UTCP) community plugin for Strands Agents SDK
Features
- Universal Tool Access - Connect to any UTCP-compatible tool source
- OpenAPI/Swagger Support - Automatic tool discovery from API specifications
- Multiple Sources - Connect to multiple tool sources simultaneously
- Async/Await Support - Full async support with context managers
- Type Safe - Full type hints and validation
- Easy Integration - Drop-in tool adapter for Strands agents
Key Technical Features:
- AgentTool Inheritance: Full inheritance from Strands
AgentToolbase class - Tool Name Sanitization: UUID suffixes for names >64 characters (Bedrock requirement)
Requirements
- Python 3.10+
- Strands Agents SDK 1.7.0+
- UTCP core libraries 1.0+
Installation
pip install strands-agents strands-utcp
Quick Start
Basic Usage
from strands import Agent
from strands_utcp import UtcpToolAdapter
# Configure UTCP tool adapter
config = {
"manual_call_templates": [
{
"name": "weather_api",
"call_template_type": "http",
"url": "https://api.weather.com/utcp",
"http_method": "GET"
}
]
}
# Use UTCP tools with Strands agent
async def main():
async with UtcpToolAdapter(config) as adapter:
# Get available tools
tools = adapter.list_tools()
print(f"Found {len(tools)} UTCP tools")
# Create agent with UTCP tools
agent = Agent(tools=adapter.to_strands_tools())
# Use the agent
response = await agent.invoke_async("What's the weather like today?")
print(response.message)
import asyncio
asyncio.run(main())
Tool Discovery
async with UtcpToolAdapter(config) as adapter:
# List all available tools
all_tools = adapter.list_tools()
# Search for specific tools
weather_tools = await adapter.search_tools("weather")
# Get a specific tool
weather_tool = adapter.get_tool("get_weather")
if weather_tool:
result = await weather_tool.call(location="New York")
print(result)
Multiple Sources
config = {
"manual_call_templates": [
{
"name": "petstore",
"call_template_type": "http",
"url": "https://petstore.swagger.io/v2/swagger.json"
},
{
"name": "openlibrary",
"call_template_type": "http",
"url": "https://openlibrary.org/static/openapi.json"
}
]
}
async with UtcpToolAdapter(config) as adapter:
tools = adapter.list_tools()
print(f"Total tools from all sources: {len(tools)}")
Configuration
Supported Call Template Types
The plugin supports all UTCP call template types:
HTTP Templates
{
"name": "api_name",
"call_template_type": "http",
"url": "https://api.example.com/utcp",
"http_method": "GET", # GET, POST, PUT, DELETE
"content_type": "application/json"
}
Server-Sent Events (SSE)
{
"name": "sse_stream",
"call_template_type": "sse",
"url": "https://api.example.com/stream",
"http_method": "GET"
}
Streamable HTTP
{
"name": "http_stream",
"call_template_type": "streamable_http",
"url": "https://api.example.com/stream",
"http_method": "POST"
}
Command Line Interface
{
"name": "cli_tool",
"call_template_type": "cli",
"command": "python script.py"
}
GraphQL
{
"name": "graphql_api",
"call_template_type": "graphql",
"url": "https://api.example.com/graphql"
}
Model Context Protocol (MCP)
{
"name": "mcp_server",
"call_template_type": "mcp",
"command": "node mcp-server.js"
}
TCP Socket
{
"name": "tcp_service",
"call_template_type": "tcp",
"host": "localhost",
"port": 8080
}
UDP Socket
{
"name": "udp_service",
"call_template_type": "udp",
"host": "localhost",
"port": 8081
}
Text File
{
"name": "text_tools",
"call_template_type": "text",
"file_path": "/path/to/tools.txt"
}
API Reference
UtcpToolAdapter
Main adapter class for UTCP tool integration.
Methods
start()- Initialize the UTCP clientstop()- Clean up resourceslist_tools()- Get all available toolsget_tool(name)- Get specific tool by namesearch_tools(query, max_results)- Search for toolscall_tool(name, arguments)- Execute a toolto_strands_tools()- Convert to Strands tool format
UtcpAgentTool
Wrapper for individual UTCP tools.
Properties
name- Tool name (sanitized)description- Tool descriptioninput_schema- JSON Schema for inputs
Methods
call(**kwargs)- Execute the tool
UtcpToolAdapterError
Exception raised for UTCP-specific errors.
Testing
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=strands_utcp --cov-report=html
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Links
Built for the UTCP and Strands communities 🚀
Metadata
Release files for strands-utcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| strands_utcp-0.1.1.tar.gz | 13.8 kB | Without provenance | Details for strands_utcp-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| strands_utcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for strands_utcp-0.1.1-py3-none-any.whl |
Total release size: 22.9 kB
Release files / strands_utcp-0.1.1.tar.gz
| Download URL | strands_utcp-0.1.1.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f90ad930968167cb82b3ea17baa4693e8518f264b1eb51f7996da9144aba570a
|
|
BLAKE2b-256 checksum How to use checksums |
de787d28a172bae6d2bdf0a124b9bb876c9f6571a49d0f058d1621bd602bafc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / strands_utcp-0.1.1-py3-none-any.whl
| Download URL | strands_utcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1911e9da4a13f1154e3bfa4c8fe0f5335ef65335dcb1e524ab2fd7590913755b
|
|
BLAKE2b-256 checksum How to use checksums |
e5a0e71e4d3fffd2beccda41076ee55552239086e787decd1597000c8746a54b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for strands-utcp 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.