memra 0.0.1__tar.gz → 0.2.0__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.2.0/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: memra
3
+ Version: 0.2.0
4
+ Summary: Declarative framework for enterprise workflows with MCP integration
5
+ Home-page: https://github.com/memra/memra-sdk
6
+ Author: Memra
7
+ Author-email: Memra <info@memra.co>
8
+ License: MIT
9
+ Project-URL: Homepage, https://memra.co
10
+ Project-URL: Repository, https://github.com/memra-platform/memra-sdk
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pydantic>=1.8.0
24
+ Requires-Dist: httpx>=0.24.0
25
+ Requires-Dist: typing-extensions>=4.0.0
26
+ Requires-Dist: aiohttp>=3.8.0
27
+ Requires-Dist: aiohttp-cors>=0.7.0
28
+ Requires-Dist: psycopg2-binary>=2.9.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=6.0; extra == "dev"
31
+ Requires-Dist: pytest-asyncio; extra == "dev"
32
+ Requires-Dist: black; extra == "dev"
33
+ Requires-Dist: flake8; extra == "dev"
34
+ Dynamic: author
35
+ Dynamic: home-page
36
+ Dynamic: license-file
37
+ Dynamic: requires-python
38
+
39
+ # Memra SDK
40
+
41
+ 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.
42
+
43
+ ## 🚀 Team Setup
44
+
45
+ **New team member?** See the complete setup guide: **[TEAM_SETUP.md](TEAM_SETUP.md)**
46
+
47
+ This includes:
48
+ - Database setup (PostgreSQL + Docker)
49
+ - Local development environment
50
+ - Testing instructions
51
+ - Troubleshooting guide
52
+
53
+ ## Quick Start
54
+
55
+ ```python
56
+ from memra.sdk.models import Agent, Department, Tool
57
+
58
+ # Define your agents
59
+ data_extractor = Agent(
60
+ role="Data Extraction Specialist",
61
+ job="Extract and validate data",
62
+ tools=[Tool(name="DataExtractor", hosted_by="memra")],
63
+ input_keys=["input_data"],
64
+ output_key="extracted_data"
65
+ )
66
+
67
+ # Create a department
68
+ dept = Department(
69
+ name="Data Processing",
70
+ mission="Process and validate data",
71
+ agents=[data_extractor]
72
+ )
73
+
74
+ # Run the workflow
75
+ result = dept.run({"input_data": {...}})
76
+ ```
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ pip install memra
82
+ ```
83
+
84
+ ## API Access
85
+
86
+ Memra requires an API key to execute workflows on the hosted infrastructure.
87
+
88
+ ### Get Your API Key
89
+ Contact [info@memra.co](mailto:info@memra.co) for API access.
90
+
91
+ ### Set Your API Key
92
+ ```bash
93
+ # Set environment variable
94
+ export MEMRA_API_KEY="your-api-key-here"
95
+
96
+ # Or add to your shell profile for persistence
97
+ echo 'export MEMRA_API_KEY="your-api-key-here"' >> ~/.zshrc
98
+ ```
99
+
100
+ ### Test Your Setup
101
+ ```bash
102
+ python examples/accounts_payable_client.py
103
+ ```
104
+
105
+ ## Documentation
106
+
107
+ Documentation is coming soon. For now, see the examples below and in the `examples/` directory.
108
+
109
+ ## Example: Propane Delivery Workflow
110
+
111
+ See the `examples/propane_delivery.py` file for a complete example of how to use Memra to orchestrate a propane delivery workflow.
112
+
113
+ ## Contributing
114
+
115
+ We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
116
+
117
+ ## License
118
+
119
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
120
+
121
+ ## Examples
122
+
123
+ ```
124
+ ├── examples/
125
+ │ ├── accounts_payable_client.py # API-based example
126
+ │ ├── accounts_payable.py # Local example
127
+ │ ├── invoice_processing.py # Simple workflow
128
+ │ └── propane_delivery.py # Domain example
129
+ ├── memra/ # Core SDK
130
+ ├── logic/ # Tool implementations
131
+ ├── local/dependencies/ # Database setup & schemas
132
+ └── docker-compose.yml # Database setup
133
+ ```
134
+
135
+ ## ✨ New: MCP Integration
136
+
137
+ Memra now supports **Model Context Protocol (MCP)** integration, allowing you to execute operations on your local infrastructure while leveraging Memra's cloud-based AI processing.
138
+
139
+ **Key Benefits:**
140
+ - 🔒 **Keep sensitive data local** - Your databases stay on your infrastructure
141
+ - ⚡ **Hybrid processing** - AI processing in the cloud, data operations locally
142
+ - 🔐 **Secure communication** - HMAC-authenticated requests between cloud and local
143
+ - 🛠️ **Easy setup** - Simple bridge server connects your local resources
144
+
145
+ **Quick Example:**
146
+ ```python
147
+ # Agent that uses local database via MCP
148
+ agent = Agent(
149
+ role="Data Writer",
150
+ tools=[{
151
+ "name": "PostgresInsert",
152
+ "hosted_by": "mcp", # Routes to your local infrastructure
153
+ "config": {
154
+ "bridge_url": "http://localhost:8081",
155
+ "bridge_secret": "your-secret"
156
+ }
157
+ }]
158
+ )
159
+ ```
160
+
161
+ 📖 **[Complete MCP Integration Guide →](docs/mcp_integration.md)**
memra-0.2.0/README.md ADDED
@@ -0,0 +1,123 @@
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
+ ## 🚀 Team Setup
6
+
7
+ **New team member?** See the complete setup guide: **[TEAM_SETUP.md](TEAM_SETUP.md)**
8
+
9
+ This includes:
10
+ - Database setup (PostgreSQL + Docker)
11
+ - Local development environment
12
+ - Testing instructions
13
+ - Troubleshooting guide
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from memra.sdk.models import Agent, Department, Tool
19
+
20
+ # Define your agents
21
+ data_extractor = Agent(
22
+ role="Data Extraction Specialist",
23
+ job="Extract and validate data",
24
+ tools=[Tool(name="DataExtractor", hosted_by="memra")],
25
+ input_keys=["input_data"],
26
+ output_key="extracted_data"
27
+ )
28
+
29
+ # Create a department
30
+ dept = Department(
31
+ name="Data Processing",
32
+ mission="Process and validate data",
33
+ agents=[data_extractor]
34
+ )
35
+
36
+ # Run the workflow
37
+ result = dept.run({"input_data": {...}})
38
+ ```
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install memra
44
+ ```
45
+
46
+ ## API Access
47
+
48
+ Memra requires an API key to execute workflows on the hosted infrastructure.
49
+
50
+ ### Get Your API Key
51
+ Contact [info@memra.co](mailto:info@memra.co) for API access.
52
+
53
+ ### Set Your API Key
54
+ ```bash
55
+ # Set environment variable
56
+ export MEMRA_API_KEY="your-api-key-here"
57
+
58
+ # Or add to your shell profile for persistence
59
+ echo 'export MEMRA_API_KEY="your-api-key-here"' >> ~/.zshrc
60
+ ```
61
+
62
+ ### Test Your Setup
63
+ ```bash
64
+ python examples/accounts_payable_client.py
65
+ ```
66
+
67
+ ## Documentation
68
+
69
+ Documentation is coming soon. For now, see the examples below and in the `examples/` directory.
70
+
71
+ ## Example: Propane Delivery Workflow
72
+
73
+ See the `examples/propane_delivery.py` file for a complete example of how to use Memra to orchestrate a propane delivery workflow.
74
+
75
+ ## Contributing
76
+
77
+ We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
78
+
79
+ ## License
80
+
81
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
82
+
83
+ ## Examples
84
+
85
+ ```
86
+ ├── examples/
87
+ │ ├── accounts_payable_client.py # API-based example
88
+ │ ├── accounts_payable.py # Local example
89
+ │ ├── invoice_processing.py # Simple workflow
90
+ │ └── propane_delivery.py # Domain example
91
+ ├── memra/ # Core SDK
92
+ ├── logic/ # Tool implementations
93
+ ├── local/dependencies/ # Database setup & schemas
94
+ └── docker-compose.yml # Database setup
95
+ ```
96
+
97
+ ## ✨ New: MCP Integration
98
+
99
+ Memra now supports **Model Context Protocol (MCP)** integration, allowing you to execute operations on your local infrastructure while leveraging Memra's cloud-based AI processing.
100
+
101
+ **Key Benefits:**
102
+ - 🔒 **Keep sensitive data local** - Your databases stay on your infrastructure
103
+ - ⚡ **Hybrid processing** - AI processing in the cloud, data operations locally
104
+ - 🔐 **Secure communication** - HMAC-authenticated requests between cloud and local
105
+ - 🛠️ **Easy setup** - Simple bridge server connects your local resources
106
+
107
+ **Quick Example:**
108
+ ```python
109
+ # Agent that uses local database via MCP
110
+ agent = Agent(
111
+ role="Data Writer",
112
+ tools=[{
113
+ "name": "PostgresInsert",
114
+ "hosted_by": "mcp", # Routes to your local infrastructure
115
+ "config": {
116
+ "bridge_url": "http://localhost:8081",
117
+ "bridge_secret": "your-secret"
118
+ }
119
+ }]
120
+ )
121
+ ```
122
+
123
+ 📖 **[Complete MCP Integration Guide →](docs/mcp_integration.md)**
@@ -0,0 +1,24 @@
1
+ """
2
+ Memra SDK - Declarative framework for enterprise workflows with MCP integration
3
+
4
+ A powerful orchestration framework that allows you to build AI-powered business workflows
5
+ with hybrid cloud/local execution capabilities.
6
+ """
7
+
8
+ __version__ = "0.2.0"
9
+ __author__ = "Memra"
10
+ __email__ = "info@memra.co"
11
+
12
+ # Core imports
13
+ from .models import Agent, Department, LLM, Tool
14
+ from .execution import ExecutionEngine
15
+
16
+ # Make key classes available at package level
17
+ __all__ = [
18
+ "Agent",
19
+ "Department",
20
+ "LLM",
21
+ "Tool",
22
+ "ExecutionEngine",
23
+ "__version__"
24
+ ]
@@ -0,0 +1,15 @@
1
+ from typing import List, Dict, Any, Optional
2
+ from .tool_registry import ToolRegistry
3
+
4
+ def discover_tools(hosted_by: Optional[str] = None) -> List[Dict[str, Any]]:
5
+ """
6
+ Discover available tools in the Memra platform.
7
+
8
+ Args:
9
+ hosted_by: Filter tools by host ("memra" or "mcp"). If None, returns all tools.
10
+
11
+ Returns:
12
+ List of available tools with their metadata
13
+ """
14
+ registry = ToolRegistry()
15
+ return registry.discover_tools(hosted_by)
@@ -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
+ }