ai-mesh-sdk


Nameai-mesh-sdk JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/yourusername/ai-mesh-sdk
SummaryPython SDK for interacting with AI Mesh platform
upload_time2025-08-02 14:24:24
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.7
licenseNone
keywords ai agents mesh langchain tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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

```bash
pip install ai-mesh-sdk
```

## Quick Start

```python
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:

```python
# 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:

```python
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:

```json
{
  "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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yourusername/ai-mesh-sdk",
    "name": "ai-mesh-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "ai, agents, mesh, langchain, tools",
    "author": "Your Name",
    "author_email": "your@email.com",
    "download_url": "https://files.pythonhosted.org/packages/3b/23/3ea5861b1d6ab10c3559488482559a4ee6ef5093c34689c1fb3f852b9477/ai_mesh_sdk-0.1.1.tar.gz",
    "platform": null,
    "description": "\n# AI Mesh SDK\n\nA lightweight Python SDK for discovering and calling agents on the AI Mesh platform.\n\n## Features\n- List available agents on the mesh\n- Call any agent by ID with custom inputs\n- **Input validation** using JSON Schema (when available)\n- Convert all Mesh agents into LangChain-compatible tools\n- Auto-generated parameter documentation\n- Simple authentication with API tokens\n\n## Installation\n\n```bash\npip install ai-mesh-sdk\n```\n\n## Quick Start\n\n```python\nfrom mesh_sdk import MeshSDK\n\n# Initialize with your API token\nsdk = MeshSDK(token=\"your-api-token\")\n\n# List all available agents\nagents = sdk.list_agents()\nprint(f\"Found {len(agents)} agents\")\n\n# Call a specific agent\nresult = sdk.call_agent(\n    agent_id=\"agent-123\",\n    inputs={\"prompt\": \"Hello, world!\"}\n)\nprint(result)\n\n# Use with LangChain\nfrom langchain.agents import initialize_agent, AgentType\n\ntools = sdk.to_langchain_tools()\nagent = initialize_agent(\n    tools=tools,\n    llm=your_llm,\n    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION\n)\n```\n\n## API Reference\n\n### MeshSDK(token)\nInitialize the SDK with your API token.\n\n**Parameters:**\n- `token` (str): Your AI Mesh API token\n\n### list_agents()\nReturns a list of all available agents on the mesh.\n\n**Returns:** List[Dict] - Agent metadata including ID, name, and description\n\n### call_agent(agent_id, inputs, validate_inputs=True)\nCall a specific agent with provided inputs.\n\n**Parameters:**\n- `agent_id` (str): The unique identifier of the agent\n- `inputs` (Dict): Input parameters for the agent\n- `validate_inputs` (bool): Whether to validate inputs against schema (default: True)\n\n**Returns:** Dict - The agent's response\n\n**Input Validation:**\nIf an agent has an `inputSchema`, the SDK will automatically validate your inputs:\n\n```python\n# This will validate inputs against the agent's schema\nresult = sdk.call_agent(\"summarizer\", {\n    \"text\": \"Long text to summarize...\",\n    \"max_length\": 100\n})\n\n# Skip validation if needed\nresult = sdk.call_agent(\"summarizer\", inputs, validate_inputs=False)\n```\n\n### to_langchain_tools()\nConvert all mesh agents into LangChain Tool objects with automatic input validation.\n\n**Returns:** List[Tool] - LangChain-compatible tools\n\n**Enhanced Tool Descriptions:**\nTools automatically include parameter information from the agent's schema:\n\n```python\ntools = sdk.to_langchain_tools()\nfor tool in tools:\n    print(f\"{tool.name}: {tool.description}\")\n\n# Output example:\n# Summarizer: Summarizes long text into concise summaries\n# \n# Parameters: text: string (required), max_length: integer (optional)\n```\n\n## Agent Schema Format\n\nFor optimal validation, agents should include an `inputSchema` in their metadata:\n\n```json\n{\n  \"id\": \"summarizer\",\n  \"name\": \"Text Summarizer\", \n  \"description\": \"Summarizes long text into concise summaries\",\n  \"inputSchema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"text\": {\n        \"type\": \"string\",\n        \"description\": \"The text to summarize\"\n      },\n      \"max_length\": {\n        \"type\": \"integer\", \n        \"description\": \"Maximum length of summary\",\n        \"default\": 100\n      }\n    },\n    \"required\": [\"text\"]\n  }\n}\n```\n\n**Fallback:** If no `inputSchema` is available, the SDK will look for `exampleInputs` and include those in the tool description.\n\n## License\n\nMIT License\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python SDK for interacting with AI Mesh platform",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/ai-mesh-sdk"
    },
    "split_keywords": [
        "ai",
        " agents",
        " mesh",
        " langchain",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "75a671529efde338e2b654032a4f6c87965f5189cd6578d07b1b84766be7e624",
                "md5": "e972e9d2f986ce87f3ba6f2c7af12602",
                "sha256": "04ecf214e968712f1d4b6f9f2698bfb820a109417dd686fbb45aa3b14091f0e7"
            },
            "downloads": -1,
            "filename": "ai_mesh_sdk-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e972e9d2f986ce87f3ba6f2c7af12602",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3526,
            "upload_time": "2025-08-02T14:24:23",
            "upload_time_iso_8601": "2025-08-02T14:24:23.466358Z",
            "url": "https://files.pythonhosted.org/packages/75/a6/71529efde338e2b654032a4f6c87965f5189cd6578d07b1b84766be7e624/ai_mesh_sdk-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3b233ea5861b1d6ab10c3559488482559a4ee6ef5093c34689c1fb3f852b9477",
                "md5": "c945b59c41b51cea085dd9ace3c4cee9",
                "sha256": "c025ac5bd253577e8388ed86b62870f4b9b61ed2ffe88fa4032a98506cd7c9b9"
            },
            "downloads": -1,
            "filename": "ai_mesh_sdk-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c945b59c41b51cea085dd9ace3c4cee9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3564,
            "upload_time": "2025-08-02T14:24:24",
            "upload_time_iso_8601": "2025-08-02T14:24:24.678158Z",
            "url": "https://files.pythonhosted.org/packages/3b/23/3ea5861b1d6ab10c3559488482559a4ee6ef5093c34689c1fb3f852b9477/ai_mesh_sdk-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-02 14:24:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "ai-mesh-sdk",
    "github_not_found": true,
    "lcname": "ai-mesh-sdk"
}
        
Elapsed time: 0.54756s