Skip to main content

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 agent
  • inputs (Dict): Input parameters for the agent
  • validate_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

ai_mesh_sdk-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

ai_mesh_sdk-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_mesh_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: ai_mesh_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ai_mesh_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 dce2ba819234fd90ff00348e32548cac2c8092660a1d6baa803fc0a1543275e6
MD5 b9ddab8e1191c3690041a4cfae4a4a22
BLAKE2b-256 f5876d3dc33a012f995000150bbcd4a39a48a9bf3062f4e4bd66cd66091c9f28

See more details on using hashes here.

File details

Details for the file ai_mesh_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ai_mesh_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for ai_mesh_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c7aea50a054cc8685f8d07c2734fcf2b77f09a7538632e19a0afa12a95266211
MD5 6efe3237f66ed13ecb6987124b01aa8f
BLAKE2b-256 6fdbe1df1bd62197262df1852590f5b7b16e62ef9b18deebdf3af06355f7b17d

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