Skip to main content

A declarative orchestration framework for AI-powered business workflows

Project description

Memra SDK

A declarative orchestration framework for AI-powered business workflows. Think of it as "Kubernetes for business logic" where agents are the pods and departments are the deployments.

🚀 Quick Start

from memra import Agent, Department, LLM
from memra.execution import ExecutionEngine

# Define your agents declaratively
data_engineer = Agent(
    role="Data Engineer",
    job="Extract invoice schema from database",
    llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.1),
    tools=[
        {"name": "DatabaseQueryTool", "hosted_by": "memra"}
    ],
    output_key="invoice_schema"
)

invoice_parser = Agent(
    role="Invoice Parser", 
    job="Extract structured data from invoice PDF",
    llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.0),
    tools=[
        {"name": "PDFProcessor", "hosted_by": "memra"},
        {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
    ],
    input_keys=["file", "invoice_schema"],
    output_key="invoice_data"
)

# Create a department
ap_department = Department(
    name="Accounts Payable",
    mission="Process invoices accurately into financial system",
    agents=[data_engineer, invoice_parser],
    workflow_order=["Data Engineer", "Invoice Parser"]
)

# Execute the workflow
engine = ExecutionEngine()
result = engine.execute_department(ap_department, {
    "file": "invoice.pdf",
    "connection": "postgresql://user@host/db"
})

if result.success:
    print("✅ Invoice processed successfully!")
    print(f"Data: {result.data}")

📦 Installation

pip install memra-sdk

🔑 Configuration

Step 1: Get Your API Key

Contact info@memra.co to request an API key for early access.

Step 2: Set Your API Key

Once you receive your API key, configure it:

export MEMRA_API_KEY="your-api-key-here"
export MEMRA_API_URL="https://api.memra.co"  # Optional, defaults to production

Or in Python:

import os
os.environ["MEMRA_API_KEY"] = "your-api-key-here"

🎯 Key Features

  • Declarative: Define workflows like Kubernetes YAML
  • AI-Powered: Built-in LLM integrations for document processing
  • Conversational: Agents explain what they're doing in real-time
  • Production Ready: Real database connectivity and file processing
  • Scalable: Tools execute on Memra's cloud infrastructure

🏗️ Core Concepts

Agents

Agents are the workers in your workflow. Each agent has:

  • Role: What they do (e.g., "Data Engineer")
  • Job: Their specific responsibility
  • Tools: What capabilities they use
  • LLM: Their AI model configuration

Departments

Departments coordinate multiple agents:

  • Mission: Overall goal
  • Workflow Order: Sequence of agent execution
  • Manager: Optional oversight and validation

Tools

Tools are hosted capabilities:

  • memra: Hosted by Memra (PDF processing, LLMs, databases)
  • mcp: Customer-hosted via Model Context Protocol

📊 Example Output

🏢 Starting Accounts Payable Department
📋 Mission: Process invoices accurately into financial system
👥 Team: Data Engineer, Invoice Parser
🔄 Workflow: Data Engineer → Invoice Parser

👤 Data Engineer: Hi! I'm starting my work now...
💭 Data Engineer: My job is to extract invoice schema from database
⚡ Data Engineer: Using tool 1/1: DatabaseQueryTool
✅ Data Engineer: Great! DatabaseQueryTool did real work and gave me useful results
🎉 Data Engineer: Perfect! I completed my work with real data processing

👤 Invoice Parser: Hi! I'm starting my work now...
💭 Invoice Parser: My job is to extract structured data from invoice pdf
⚡ Invoice Parser: Using tool 1/2: PDFProcessor
✅ Invoice Parser: Great! PDFProcessor did real work and gave me useful results

🔍 Tool Discovery

Discover available tools:

from memra import discover_tools, get_api_status

# Check API health
status = get_api_status()
print(f"API Health: {status['api_healthy']}")
print(f"Tools Available: {status['tools_available']}")

# Discover tools
tools = discover_tools()
for tool in tools:
    print(f"- {tool['name']}: {tool['description']}")

📚 Examples

See the examples/ directory for complete workflows:

  • accounts_payable_client.py: Invoice processing with database integration
  • More examples coming soon!

🆘 Support

📄 License

MIT License - see LICENSE file for details.


Built with ❤️ by the Memra team Note: The SDK will not work without a valid API key.

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.1.2.tar.gz (12.2 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.1.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for memra-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b724dfb0b41520e66788f77e343daf90bbd18340afa1bc9a615d5e3a22173b4d
MD5 d370696b1e98770ea71d0bd6e84e61cb
BLAKE2b-256 abeb744e3b2c412d550056caa8abdb2387f2368d6ce0ded465413126597ba019

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for memra-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3bc821a4567569e8873719812ed957b2230e01d92cd2c1387ad30a0c340753f
MD5 3f245eb9e4c015ff955b34f7edffa6ea
BLAKE2b-256 f5e7287167658650ced01bd04192506fe144333d24569bf91719b01c96ba692f

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