memra 0.0.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
memra-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: memra
3
+ Version: 0.1.2
4
+ Summary: A declarative orchestration framework for AI-powered business workflows
5
+ Author-email: Memra Team <info@memra.co>
6
+ License: MIT
7
+ Project-URL: Homepage, https://memra.co
8
+ Project-URL: Repository, https://github.com/memra-platform/memra-sdk
9
+ Project-URL: Documentation, https://memra.co
10
+ Project-URL: Bug Reports, https://github.com/memra-platform/memra-sdk/issues
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: httpx>=0.24.0
25
+ Requires-Dist: typing-extensions>=4.0.0
26
+ Dynamic: license-file
27
+
28
+ # Memra SDK
29
+
30
+ 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.
31
+
32
+ ## 🚀 Quick Start
33
+
34
+ ```python
35
+ from memra import Agent, Department, LLM
36
+ from memra.execution import ExecutionEngine
37
+
38
+ # Define your agents declaratively
39
+ data_engineer = Agent(
40
+ role="Data Engineer",
41
+ job="Extract invoice schema from database",
42
+ llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.1),
43
+ tools=[
44
+ {"name": "DatabaseQueryTool", "hosted_by": "memra"}
45
+ ],
46
+ output_key="invoice_schema"
47
+ )
48
+
49
+ invoice_parser = Agent(
50
+ role="Invoice Parser",
51
+ job="Extract structured data from invoice PDF",
52
+ llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.0),
53
+ tools=[
54
+ {"name": "PDFProcessor", "hosted_by": "memra"},
55
+ {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
56
+ ],
57
+ input_keys=["file", "invoice_schema"],
58
+ output_key="invoice_data"
59
+ )
60
+
61
+ # Create a department
62
+ ap_department = Department(
63
+ name="Accounts Payable",
64
+ mission="Process invoices accurately into financial system",
65
+ agents=[data_engineer, invoice_parser],
66
+ workflow_order=["Data Engineer", "Invoice Parser"]
67
+ )
68
+
69
+ # Execute the workflow
70
+ engine = ExecutionEngine()
71
+ result = engine.execute_department(ap_department, {
72
+ "file": "invoice.pdf",
73
+ "connection": "postgresql://user@host/db"
74
+ })
75
+
76
+ if result.success:
77
+ print("✅ Invoice processed successfully!")
78
+ print(f"Data: {result.data}")
79
+ ```
80
+
81
+ ## 📦 Installation
82
+
83
+ ```bash
84
+ pip install memra-sdk
85
+ ```
86
+
87
+ ## 🔑 Configuration
88
+
89
+ ### Step 1: Get Your API Key
90
+ Contact **info@memra.co** to request an API key for early access.
91
+
92
+ ### Step 2: Set Your API Key
93
+ Once you receive your API key, configure it:
94
+
95
+ ```bash
96
+ export MEMRA_API_KEY="your-api-key-here"
97
+ export MEMRA_API_URL="https://api.memra.co" # Optional, defaults to production
98
+ ```
99
+
100
+ Or in Python:
101
+
102
+ ```python
103
+ import os
104
+ os.environ["MEMRA_API_KEY"] = "your-api-key-here"
105
+ ```
106
+
107
+ ## 🎯 Key Features
108
+
109
+ - **Declarative**: Define workflows like Kubernetes YAML
110
+ - **AI-Powered**: Built-in LLM integrations for document processing
111
+ - **Conversational**: Agents explain what they're doing in real-time
112
+ - **Production Ready**: Real database connectivity and file processing
113
+ - **Scalable**: Tools execute on Memra's cloud infrastructure
114
+
115
+ ## 🏗️ Core Concepts
116
+
117
+ ### Agents
118
+ Agents are the workers in your workflow. Each agent has:
119
+ - **Role**: What they do (e.g., "Data Engineer")
120
+ - **Job**: Their specific responsibility
121
+ - **Tools**: What capabilities they use
122
+ - **LLM**: Their AI model configuration
123
+
124
+ ### Departments
125
+ Departments coordinate multiple agents:
126
+ - **Mission**: Overall goal
127
+ - **Workflow Order**: Sequence of agent execution
128
+ - **Manager**: Optional oversight and validation
129
+
130
+ ### Tools
131
+ Tools are hosted capabilities:
132
+ - **memra**: Hosted by Memra (PDF processing, LLMs, databases)
133
+ - **mcp**: Customer-hosted via Model Context Protocol
134
+
135
+ ## 📊 Example Output
136
+
137
+ ```
138
+ 🏢 Starting Accounts Payable Department
139
+ 📋 Mission: Process invoices accurately into financial system
140
+ 👥 Team: Data Engineer, Invoice Parser
141
+ 🔄 Workflow: Data Engineer → Invoice Parser
142
+
143
+ 👤 Data Engineer: Hi! I'm starting my work now...
144
+ 💭 Data Engineer: My job is to extract invoice schema from database
145
+ ⚡ Data Engineer: Using tool 1/1: DatabaseQueryTool
146
+ ✅ Data Engineer: Great! DatabaseQueryTool did real work and gave me useful results
147
+ 🎉 Data Engineer: Perfect! I completed my work with real data processing
148
+
149
+ 👤 Invoice Parser: Hi! I'm starting my work now...
150
+ 💭 Invoice Parser: My job is to extract structured data from invoice pdf
151
+ ⚡ Invoice Parser: Using tool 1/2: PDFProcessor
152
+ ✅ Invoice Parser: Great! PDFProcessor did real work and gave me useful results
153
+ ```
154
+
155
+ ## 🔍 Tool Discovery
156
+
157
+ Discover available tools:
158
+
159
+ ```python
160
+ from memra import discover_tools, get_api_status
161
+
162
+ # Check API health
163
+ status = get_api_status()
164
+ print(f"API Health: {status['api_healthy']}")
165
+ print(f"Tools Available: {status['tools_available']}")
166
+
167
+ # Discover tools
168
+ tools = discover_tools()
169
+ for tool in tools:
170
+ print(f"- {tool['name']}: {tool['description']}")
171
+ ```
172
+
173
+ ## 📚 Examples
174
+
175
+ See the `examples/` directory for complete workflows:
176
+
177
+ - `accounts_payable_client.py`: Invoice processing with database integration
178
+ - More examples coming soon!
179
+
180
+ ## 🆘 Support
181
+
182
+ - **Support**: info@memra.co
183
+
184
+ ## 📄 License
185
+
186
+ MIT License - see LICENSE file for details.
187
+
188
+ ---
189
+
190
+ **Built with ❤️ by the Memra team**
191
+ **Note**: The SDK will not work without a valid API key.
memra-0.1.2/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # Memra SDK
2
+
3
+ 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.
4
+
5
+ ## 🚀 Quick Start
6
+
7
+ ```python
8
+ from memra import Agent, Department, LLM
9
+ from memra.execution import ExecutionEngine
10
+
11
+ # Define your agents declaratively
12
+ data_engineer = Agent(
13
+ role="Data Engineer",
14
+ job="Extract invoice schema from database",
15
+ llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.1),
16
+ tools=[
17
+ {"name": "DatabaseQueryTool", "hosted_by": "memra"}
18
+ ],
19
+ output_key="invoice_schema"
20
+ )
21
+
22
+ invoice_parser = Agent(
23
+ role="Invoice Parser",
24
+ job="Extract structured data from invoice PDF",
25
+ llm=LLM(model="llama-3.2-11b-vision-preview", temperature=0.0),
26
+ tools=[
27
+ {"name": "PDFProcessor", "hosted_by": "memra"},
28
+ {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
29
+ ],
30
+ input_keys=["file", "invoice_schema"],
31
+ output_key="invoice_data"
32
+ )
33
+
34
+ # Create a department
35
+ ap_department = Department(
36
+ name="Accounts Payable",
37
+ mission="Process invoices accurately into financial system",
38
+ agents=[data_engineer, invoice_parser],
39
+ workflow_order=["Data Engineer", "Invoice Parser"]
40
+ )
41
+
42
+ # Execute the workflow
43
+ engine = ExecutionEngine()
44
+ result = engine.execute_department(ap_department, {
45
+ "file": "invoice.pdf",
46
+ "connection": "postgresql://user@host/db"
47
+ })
48
+
49
+ if result.success:
50
+ print("✅ Invoice processed successfully!")
51
+ print(f"Data: {result.data}")
52
+ ```
53
+
54
+ ## 📦 Installation
55
+
56
+ ```bash
57
+ pip install memra-sdk
58
+ ```
59
+
60
+ ## 🔑 Configuration
61
+
62
+ ### Step 1: Get Your API Key
63
+ Contact **info@memra.co** to request an API key for early access.
64
+
65
+ ### Step 2: Set Your API Key
66
+ Once you receive your API key, configure it:
67
+
68
+ ```bash
69
+ export MEMRA_API_KEY="your-api-key-here"
70
+ export MEMRA_API_URL="https://api.memra.co" # Optional, defaults to production
71
+ ```
72
+
73
+ Or in Python:
74
+
75
+ ```python
76
+ import os
77
+ os.environ["MEMRA_API_KEY"] = "your-api-key-here"
78
+ ```
79
+
80
+ ## 🎯 Key Features
81
+
82
+ - **Declarative**: Define workflows like Kubernetes YAML
83
+ - **AI-Powered**: Built-in LLM integrations for document processing
84
+ - **Conversational**: Agents explain what they're doing in real-time
85
+ - **Production Ready**: Real database connectivity and file processing
86
+ - **Scalable**: Tools execute on Memra's cloud infrastructure
87
+
88
+ ## 🏗️ Core Concepts
89
+
90
+ ### Agents
91
+ Agents are the workers in your workflow. Each agent has:
92
+ - **Role**: What they do (e.g., "Data Engineer")
93
+ - **Job**: Their specific responsibility
94
+ - **Tools**: What capabilities they use
95
+ - **LLM**: Their AI model configuration
96
+
97
+ ### Departments
98
+ Departments coordinate multiple agents:
99
+ - **Mission**: Overall goal
100
+ - **Workflow Order**: Sequence of agent execution
101
+ - **Manager**: Optional oversight and validation
102
+
103
+ ### Tools
104
+ Tools are hosted capabilities:
105
+ - **memra**: Hosted by Memra (PDF processing, LLMs, databases)
106
+ - **mcp**: Customer-hosted via Model Context Protocol
107
+
108
+ ## 📊 Example Output
109
+
110
+ ```
111
+ 🏢 Starting Accounts Payable Department
112
+ 📋 Mission: Process invoices accurately into financial system
113
+ 👥 Team: Data Engineer, Invoice Parser
114
+ 🔄 Workflow: Data Engineer → Invoice Parser
115
+
116
+ 👤 Data Engineer: Hi! I'm starting my work now...
117
+ 💭 Data Engineer: My job is to extract invoice schema from database
118
+ ⚡ Data Engineer: Using tool 1/1: DatabaseQueryTool
119
+ ✅ Data Engineer: Great! DatabaseQueryTool did real work and gave me useful results
120
+ 🎉 Data Engineer: Perfect! I completed my work with real data processing
121
+
122
+ 👤 Invoice Parser: Hi! I'm starting my work now...
123
+ 💭 Invoice Parser: My job is to extract structured data from invoice pdf
124
+ ⚡ Invoice Parser: Using tool 1/2: PDFProcessor
125
+ ✅ Invoice Parser: Great! PDFProcessor did real work and gave me useful results
126
+ ```
127
+
128
+ ## 🔍 Tool Discovery
129
+
130
+ Discover available tools:
131
+
132
+ ```python
133
+ from memra import discover_tools, get_api_status
134
+
135
+ # Check API health
136
+ status = get_api_status()
137
+ print(f"API Health: {status['api_healthy']}")
138
+ print(f"Tools Available: {status['tools_available']}")
139
+
140
+ # Discover tools
141
+ tools = discover_tools()
142
+ for tool in tools:
143
+ print(f"- {tool['name']}: {tool['description']}")
144
+ ```
145
+
146
+ ## 📚 Examples
147
+
148
+ See the `examples/` directory for complete workflows:
149
+
150
+ - `accounts_payable_client.py`: Invoice processing with database integration
151
+ - More examples coming soon!
152
+
153
+ ## 🆘 Support
154
+
155
+ - **Support**: info@memra.co
156
+
157
+ ## 📄 License
158
+
159
+ MIT License - see LICENSE file for details.
160
+
161
+ ---
162
+
163
+ **Built with ❤️ by the Memra team**
164
+ **Note**: The SDK will not work without a valid API key.
@@ -0,0 +1,28 @@
1
+ """
2
+ Memra SDK - A declarative orchestration framework for AI-powered business workflows
3
+ """
4
+
5
+ from .models import (
6
+ Agent,
7
+ Department,
8
+ LLM,
9
+ Tool,
10
+ ExecutionPolicy,
11
+ ExecutionTrace,
12
+ DepartmentResult,
13
+ DepartmentAudit
14
+ )
15
+ from .discovery_client import discover_tools, check_api_health, get_api_status
16
+
17
+ __version__ = "0.1.2"
18
+ __all__ = [
19
+ "Agent",
20
+ "Department",
21
+ "LLM",
22
+ "Tool",
23
+ "ExecutionPolicy",
24
+ "ExecutionTrace",
25
+ "DepartmentResult",
26
+ "DepartmentAudit",
27
+ "discover_tools"
28
+ ]
@@ -0,0 +1,49 @@
1
+ """
2
+ Client-side tool discovery for Memra SDK
3
+ Queries the Memra API to discover available tools
4
+ """
5
+
6
+ from typing import List, Dict, Any, Optional
7
+ from .tool_registry_client import ToolRegistryClient
8
+
9
+ def discover_tools(hosted_by: Optional[str] = None) -> List[Dict[str, Any]]:
10
+ """
11
+ Discover available tools from the Memra API
12
+
13
+ Args:
14
+ hosted_by: Filter tools by hosting provider ("memra" or "mcp")
15
+
16
+ Returns:
17
+ List of available tools with their descriptions
18
+ """
19
+ registry = ToolRegistryClient()
20
+ return registry.discover_tools(hosted_by)
21
+
22
+ def check_api_health() -> bool:
23
+ """
24
+ Check if the Memra API is available
25
+
26
+ Returns:
27
+ True if API is healthy, False otherwise
28
+ """
29
+ registry = ToolRegistryClient()
30
+ return registry.health_check()
31
+
32
+ def get_api_status() -> Dict[str, Any]:
33
+ """
34
+ Get detailed API status information
35
+
36
+ Returns:
37
+ Dictionary with API status details
38
+ """
39
+ registry = ToolRegistryClient()
40
+
41
+ is_healthy = registry.health_check()
42
+ tools = registry.discover_tools() if is_healthy else []
43
+
44
+ return {
45
+ "api_healthy": is_healthy,
46
+ "api_url": registry.api_base,
47
+ "tools_available": len(tools),
48
+ "tools": tools
49
+ }