Python SDK for interacting with AI Mesh platform
Project description
AI Mesh SDK
A lightweight Python SDK for discovering and calling agents on the AI Mesh platform.
Features
- List available agents on the mesh
- Call any agent by ID with custom inputs
- Input validation using JSON Schema (when available)
- Convert all Mesh agents into LangChain-compatible tools
- Auto-generated parameter documentation
- Simple authentication with API tokens
Installation
pip install ai-mesh-sdk
Quick Start
from mesh_sdk import MeshSDK
# Initialize with your API token
sdk = MeshSDK(token="your-api-token")
# List all available agents
agents = sdk.list_agents()
print(f"Found {len(agents)} agents")
# Call a specific agent
result = sdk.call_agent(
agent_id="agent-123",
inputs={"prompt": "Hello, world!"}
)
print(result)
# Use with LangChain
from langchain.agents import initialize_agent, AgentType
tools = sdk.to_langchain_tools()
agent = initialize_agent(
tools=tools,
llm=your_llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION
)
API Reference
MeshSDK(token)
Initialize the SDK with your API token.
Parameters:
token(str): Your AI Mesh API token
list_agents()
Returns a list of all available agents on the mesh.
Returns: List[Dict] - Agent metadata including ID, name, and description
call_agent(agent_id, inputs, validate_inputs=True)
Call a specific agent with provided inputs.
Parameters:
agent_id(str): The unique identifier of the agentinputs(Dict): Input parameters for the agentvalidate_inputs(bool): Whether to validate inputs against schema (default: True)
Returns: Dict - The agent's response
Input Validation:
If an agent has an inputSchema, the SDK will automatically validate your inputs:
# This will validate inputs against the agent's schema
result = sdk.call_agent("summarizer", {
"text": "Long text to summarize...",
"max_length": 100
})
# Skip validation if needed
result = sdk.call_agent("summarizer", inputs, validate_inputs=False)
to_langchain_tools()
Convert all mesh agents into LangChain Tool objects with automatic input validation.
Returns: List[Tool] - LangChain-compatible tools
Enhanced Tool Descriptions: Tools automatically include parameter information from the agent's schema:
tools = sdk.to_langchain_tools()
for tool in tools:
print(f"{tool.name}: {tool.description}")
# Output example:
# Summarizer: Summarizes long text into concise summaries
#
# Parameters: text: string (required), max_length: integer (optional)
Agent Schema Format
For optimal validation, agents should include an inputSchema in their metadata:
{
"id": "summarizer",
"name": "Text Summarizer",
"description": "Summarizes long text into concise summaries",
"inputSchema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The text to summarize"
},
"max_length": {
"type": "integer",
"description": "Maximum length of summary",
"default": 100
}
},
"required": ["text"]
}
}
Fallback: If no inputSchema is available, the SDK will look for exampleInputs and include those in the tool description.
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_mesh_sdk-0.1.2.tar.gz.
File metadata
- Download URL: ai_mesh_sdk-0.1.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d75af3e0e546f888e6ce5eb10479a460e92b26f80493ed4759363a5008b6637
|
|
| MD5 |
214795bf06ae2b8bcf01a3df84f8931d
|
|
| BLAKE2b-256 |
12c41010f6c252df03e0ed8b8b79cb8f26fc006a100a38ab6fe39fcf7af9d03e
|
File details
Details for the file ai_mesh_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ai_mesh_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa5fbd72f43195e743d4eef75b5c074b4d47d22934d7ae4e51fd10a53c7c919
|
|
| MD5 |
a80601beeb23972797a3f1b3dfe8f0af
|
|
| BLAKE2b-256 |
67368278578b131a2562e7b6d180541cff0fb1581abe9cbf21f0197f07fa6337
|