Python SDK for Building Production AI Agents
Declarative framework for AI agents that handle document processing, data pipelines, and workflow automation. Self-hosted or managed cloud. SOC 2 Type II certified.
from memra import Agent, MemraCloud
import os
# Configure auth (or use MEMRA_API_KEY env var)
client = MemraCloud(api_key=os.environ['MEMRA_API_KEY'])
# Define agent with explicit capabilities
invoice_agent = Agent(
name="invoice_processor",
description="Extract and validate invoice data from PDFs",
capabilities=["pdf_parse", "data_extraction", "validation"],
model="gpt-4", # or "claude-3", "llama-2-70b"
timeout_seconds=30,
max_retries=3
)
# Run with structured I/O
result = await invoice_agent.run(
input_file="invoice.pdf",
validation_rules=validation_schema,
output_format="json"
)
# Returns typed response with metadata
assert result.success
print(result.data) # {"vendor": "...", "amount": 1234.56, ...}
print(result.latency_ms) # 847
print(result.tokens_used) # {"prompt": 1823, "completion": 156}
Technical Specifications
Hard numbers for production deployments
Performance
- Requests/second 1,000 RPS
- P95 latency < 1.2s
- P99 latency < 2.5s
- Concurrent agents 10,000
- Max file size 100 MB
Infrastructure
- Regions US-East, EU-West
- Uptime SLA 99.9%
- Data retention 30 days
- Deployment K8s / Docker
- Min Python 3.8+
Models & Limits
- GPT-4 8k context
- Claude 3 100k context
- Llama 2 4k context
- Rate limit 1M tokens/hr
- Batch size 1,000 docs
How It Actually Works

Your code → API Gateway → Agent Orchestrator → Model Router → Response. Full traces available via OpenTelemetry. Logs ship to your preferred sink (Datadog, CloudWatch, etc).
Production Use Cases
Real implementations with performance metrics
Invoice Processing Pipeline
1.2M docs/monthname="invoice_processor",
capabilities=["pdf_parse", "ocr", "validation"]
)
Support Ticket Router
50k tickets/dayname="ticket_classifier",
capabilities=["classify", "prioritize", "route"]
)
Contract Analysis
10k contracts/weekname="contract_analyzer",
capabilities=["extract_terms", "risk_assessment"]
)
Configuration & Deployment
Self-Hosted Setup
# docker-compose.yml
version: '3.8'
services:
memra-api:
image: memra/agent-runtime:2.4.1
environment:
- MODEL_ENDPOINTS=http://your-llm-gateway:8080
- REDIS_URL=redis://cache:6379
- POSTGRES_URL=postgresql://db/memra
- TELEMETRY_ENDPOINT=http://otel-collector:4317
deploy:
replicas: 3
resources:
limits:
cpus: '2'
memory: 4G
# Terraform example at github.com/memra-platform/memra-terraform
Required Environment Variables
MEMRA_API_KEY
- Your API key (get from dashboard)MEMRA_REGION
- Deployment region (us-east-1, eu-west-1)MEMRA_LOG_LEVEL
- Logging verbosity (INFO, DEBUG)MEMRA_TELEMETRY_ENABLED
- OpenTelemetry export (true/false)
Pricing
Usage-based with no hidden fees
Tier | Price | Included | Overage |
---|---|---|---|
Developer | $0/month | 10k API calls | $0.001 per call |
Startup | $299/month | 500k API calls | $0.0006 per call |
Scale | $999/month | 5M API calls | $0.0002 per call |
Enterprise | Custom | Custom models, SLA, dedicated support | Volume pricing |
All tiers include: Multi-region deployment, 99.9% uptime SLA, Email support. Enterprise adds: Custom models, VPC peering, 24/7 phone support, Training.
Security & Compliance
Annual audit by Deloitte
EU data residency available
Available on Enterprise
TLS 1.3 + AES-256 at rest
Opt-in logging only
Automated with zero downtime
Full security documentation: docs.memra.co/security
Report vulnerabilities: security@memra.co (PGP available)
Start Building
Full SDK documentation, examples, and API reference available. Self-serve API keys in 2 minutes.
$ pip install memra
$ export MEMRA_API_KEY=your_key_here
$ python examples/invoice_processor.py
✓ Agent initialized
✓ Processing invoice.pdf...
✓ Extracted 14 fields in 1.1s
✓ Results saved to output.json