Skip to main content

Declarative framework for enterprise workflows with MCP integration - Client SDK

Project description

Memra SDK

The core Memra framework for building AI-powered business workflows.

Installation

pip install memra

Quick Start

from memra import Agent, Department, LLM, ExecutionEngine

# Define an agent
agent = Agent(
    role="Data Analyst",
    job="Analyze customer data",
    llm=LLM(model="llama-3.2-11b-vision-preview"),
    sops=["Load data", "Perform analysis", "Generate report"],
    output_key="analysis_result"
)

# Create a department
department = Department(
    name="Analytics",
    mission="Provide data insights",
    agents=[agent],
    workflow_order=["Data Analyst"]
)

# Execute the workflow
engine = ExecutionEngine()
result = engine.execute_department(department, {"data": "customer_data.csv"})

Core Components

Agent

An AI worker that performs specific tasks using LLMs and tools.

Department

A team of agents working together to accomplish a mission.

ExecutionEngine

Orchestrates the execution of departments and their workflows.

LLM

Configuration for language models used by agents.

Examples

See the examples/ directory for basic usage examples:

  • simple_text_to_sql.py - Basic text-to-SQL conversion
  • ask_questions.py - Simple question answering

Documentation

For detailed documentation, visit docs.memra.co

Documentation is also available locally in the examples/ directory.

Example: Propane Delivery Workflow

See the examples/propane_delivery.py file for a complete example of how to use Memra to orchestrate a propane delivery workflow.

🔍 Smart File Discovery

Memra includes intelligent file discovery and management capabilities:

File Discovery Tools

  • FileDiscovery: Automatically scan directories for files matching patterns
  • FileCopy: Copy files from external locations to standard processing directories
  • Smart Routing: Automatically handle file paths and directory management

Example: Smart Invoice Processing

from memra import Agent

# Smart agent that discovers and processes files automatically
smart_parser = Agent(
    role="Smart Invoice Parser",
    job="Discover and process invoice files intelligently",
    tools=[
        {"name": "FileDiscovery", "hosted_by": "memra"},
        {"name": "FileCopy", "hosted_by": "memra"},
        {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
    ]
)

# Three modes of operation:
# 1. Auto-discovery: Scan invoices/ directory
# 2. External file: Copy from Downloads to invoices/
# 3. Specific file: Process exact file path

See examples/accounts_payable_smart.py for a complete implementation.

Contributing

We welcome contributions! Please see our contributing guide for details.

License

MIT License - see LICENSE file for details.

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

memra-0.2.4.tar.gz (88.5 kB view details)

Uploaded Source

Built Distribution

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

memra-0.2.4-py3-none-any.whl (113.8 kB view details)

Uploaded Python 3

File details

Details for the file memra-0.2.4.tar.gz.

File metadata

  • Download URL: memra-0.2.4.tar.gz
  • Upload date:
  • Size: 88.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for memra-0.2.4.tar.gz
Algorithm Hash digest
SHA256 48a8479963721493d59f5fba17f35fc111b09e481ca04ca7d95f30ec10f3018a
MD5 8106be94dddf5b93484c05dd8a8b3fa4
BLAKE2b-256 b865b8111e84f61122123308219d6167c4b26dc0ce8171c99097cff901e5b25b

See more details on using hashes here.

File details

Details for the file memra-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: memra-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 113.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for memra-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 13e49c87b27256a20149a729864e202621f5307156d32b5da54dc0cd8f3d7572
MD5 8ac438a56ad6bfc28dd656981b56ba65
BLAKE2b-256 9c4aa01e9e074ff22f96fc43c63ed7806d3cd0c2135afb8cc27b7e02faef6e2b

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