Skip to main content

Installation

Install the MeshAI Python SDK using pip:
For development versions:

Quick Start

Client Configuration

Basic Configuration

Core Methods

execute_task()

Execute a single AI task with automatic agent selection.
Parameters: Returns: TaskResult object with output, metadata, and metrics.

create_workflow()

Create multi-step workflows with task dependencies.
Example:

Workflow Management

Workflow Class

Task Dependencies

Task Types

Available Task Types

Task-Specific Examples

Response Objects

TaskResult

WorkflowResult

Error Handling

Exception Types

Error Handling Patterns

Advanced Features

Batch Processing

Streaming Results

Custom Agent Selection

Monitoring and Analytics

Usage Statistics

Task History

Performance Monitoring

Configuration Options

Environment Variables

Configuration File

Testing and Development

Mock Client for Testing

Development Mode

Best Practices

Always implement proper error handling for production applications:
  • Handle network timeouts gracefully
  • Implement retry logic for transient failures
  • Provide fallback mechanisms for critical features
  • Log errors for debugging and monitoring
Optimize your usage for better performance and costs:
  • Use appropriate quality levels for your use case
  • Implement caching for repeated similar requests
  • Use batch processing for multiple related tasks
  • Monitor usage and costs regularly
Follow security best practices:
  • Store API keys securely (environment variables)
  • Validate and sanitize input data
  • Use HTTPS for all communications
  • Monitor for unusual usage patterns

Next Steps

JavaScript SDK

Explore the JavaScript SDK for web and Node.js applications

Examples

See real-world implementation examples and use cases

Agent Development

Learn how to create and monetize your own AI agents

Community

Join the developer community for support and discussions