memra 0.2.0__tar.gz → 0.2.1__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.1/CHANGELOG.md +44 -0
- memra-0.2.1/MANIFEST.in +29 -0
- {memra-0.2.0/memra.egg-info → memra-0.2.1}/PKG-INFO +6 -37
- {memra-0.2.0 → memra-0.2.1}/README.md +0 -28
- memra-0.2.1/memra/__init__.py +27 -0
- {memra-0.2.0/memra-sdk-package → memra-0.2.1}/memra/execution.py +2 -2
- memra-0.2.1/memra/tool_registry.py +70 -0
- memra-0.2.1/memra.egg-info/SOURCES.txt +13 -0
- {memra-0.2.0 → memra-0.2.1}/pyproject.toml +8 -5
- {memra-0.2.0 → memra-0.2.1}/setup.py +6 -4
- memra-0.2.0/PKG-INFO +0 -161
- memra-0.2.0/memra/__init__.py +0 -24
- memra-0.2.0/memra/discovery_client.py +0 -49
- memra-0.2.0/memra/execution.py +0 -434
- memra-0.2.0/memra/models.py +0 -98
- memra-0.2.0/memra/tool_registry.py +0 -190
- memra-0.2.0/memra-sdk-package/examples/accounts_payable_client.py +0 -207
- memra-0.2.0/memra-sdk-package/memra/__init__.py +0 -28
- memra-0.2.0/memra-sdk-package/memra/tool_registry_client.py +0 -105
- memra-0.2.0/memra.egg-info/SOURCES.txt +0 -23
- memra-0.2.0/memra.egg-info/dependency_links.txt +0 -1
- memra-0.2.0/memra.egg-info/entry_points.txt +0 -2
- memra-0.2.0/memra.egg-info/requires.txt +0 -12
- memra-0.2.0/memra.egg-info/top_level.txt +0 -2
- {memra-0.2.0 → memra-0.2.1}/LICENSE +0 -0
- {memra-0.2.0 → memra-0.2.1}/memra/discovery.py +0 -0
- {memra-0.2.0/memra-sdk-package → memra-0.2.1}/memra/discovery_client.py +0 -0
- {memra-0.2.0/memra-sdk-package → memra-0.2.1}/memra/models.py +0 -0
- {memra-0.2.0 → memra-0.2.1}/memra/tool_registry_client.py +0 -0
- {memra-0.2.0 → memra-0.2.1}/setup.cfg +0 -0
memra-0.2.1/CHANGELOG.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to the Memra SDK will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [0.2.0] - 2024-01-17
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- **MCP (Model Context Protocol) Integration**: Execute operations on local infrastructure while leveraging cloud AI processing
|
12
|
+
- New `mcp_bridge_server.py` for local resource bridging
|
13
|
+
- HMAC authentication for secure cloud-to-local communication
|
14
|
+
- Support for `hosted_by: "mcp"` in agent tool configurations
|
15
|
+
- PostgreSQL integration via MCP bridge
|
16
|
+
- Tool-level configuration support in execution engine
|
17
|
+
- New MCP tools: `PostgresInsert`, `DataValidator`
|
18
|
+
|
19
|
+
### Enhanced
|
20
|
+
- **Execution Engine**: Updated to support tool-level configuration and MCP routing
|
21
|
+
- **Tool Registry Client**: Enhanced API client with better error handling and MCP support
|
22
|
+
- **Agent Configuration**: Added support for tool-specific configuration alongside agent-level config
|
23
|
+
|
24
|
+
### Examples
|
25
|
+
- `examples/accounts_payable_mcp.py` - Complete invoice processing with MCP database integration
|
26
|
+
- `test_mcp_success.py` - Simple MCP integration test
|
27
|
+
|
28
|
+
### Documentation
|
29
|
+
- `docs/mcp_integration.md` - Comprehensive MCP integration guide
|
30
|
+
- Updated README with MCP overview and quick start
|
31
|
+
|
32
|
+
### Dependencies
|
33
|
+
- Added `aiohttp>=3.8.0` for MCP bridge server
|
34
|
+
- Added `aiohttp-cors>=0.7.0` for CORS support
|
35
|
+
- Added `psycopg2-binary>=2.9.0` for PostgreSQL integration
|
36
|
+
|
37
|
+
## [0.1.0] - 2024-01-01
|
38
|
+
|
39
|
+
### Added
|
40
|
+
- Initial release of Memra SDK
|
41
|
+
- Core agent and department framework
|
42
|
+
- API client for Memra cloud services
|
43
|
+
- Basic tool registry and execution engine
|
44
|
+
- Examples for accounts payable and propane delivery workflows
|
memra-0.2.1/MANIFEST.in
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Include only the client SDK files
|
2
|
+
include README.md
|
3
|
+
include LICENSE
|
4
|
+
include CHANGELOG.md
|
5
|
+
recursive-include memra *.py
|
6
|
+
|
7
|
+
# Explicitly exclude server-only files and directories
|
8
|
+
exclude app.py
|
9
|
+
exclude server_tool_registry.py
|
10
|
+
exclude mcp_bridge_server.py
|
11
|
+
exclude config.py
|
12
|
+
exclude fly.toml
|
13
|
+
exclude Dockerfile
|
14
|
+
exclude Procfile
|
15
|
+
exclude docker-compose.yml
|
16
|
+
exclude requirements.txt
|
17
|
+
recursive-exclude logic *
|
18
|
+
recursive-exclude scripts *
|
19
|
+
recursive-exclude docs *
|
20
|
+
recursive-exclude examples *
|
21
|
+
recursive-exclude tests *
|
22
|
+
recursive-exclude temp_processing *
|
23
|
+
recursive-exclude invoices *
|
24
|
+
recursive-exclude local *
|
25
|
+
recursive-exclude dist *
|
26
|
+
recursive-exclude __pycache__ *
|
27
|
+
recursive-exclude *.egg-info *
|
28
|
+
exclude .DS_Store
|
29
|
+
exclude .dockerignore
|
@@ -1,10 +1,10 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: memra
|
3
|
-
Version: 0.2.
|
4
|
-
Summary: Declarative framework for enterprise workflows with MCP integration
|
3
|
+
Version: 0.2.1
|
4
|
+
Summary: Declarative framework for enterprise workflows with MCP integration - Client SDK
|
5
5
|
Home-page: https://github.com/memra/memra-sdk
|
6
6
|
Author: Memra
|
7
|
-
Author-email: Memra <
|
7
|
+
Author-email: Memra <support@memra.com>
|
8
8
|
License: MIT
|
9
9
|
Project-URL: Homepage, https://memra.co
|
10
10
|
Project-URL: Repository, https://github.com/memra-platform/memra-sdk
|
@@ -25,16 +25,13 @@ Requires-Dist: httpx>=0.24.0
|
|
25
25
|
Requires-Dist: typing-extensions>=4.0.0
|
26
26
|
Requires-Dist: aiohttp>=3.8.0
|
27
27
|
Requires-Dist: aiohttp-cors>=0.7.0
|
28
|
-
Requires-Dist: psycopg2-binary>=2.9.0
|
29
28
|
Provides-Extra: dev
|
30
29
|
Requires-Dist: pytest>=6.0; extra == "dev"
|
31
30
|
Requires-Dist: pytest-asyncio; extra == "dev"
|
32
31
|
Requires-Dist: black; extra == "dev"
|
33
32
|
Requires-Dist: flake8; extra == "dev"
|
34
|
-
|
35
|
-
|
36
|
-
Dynamic: license-file
|
37
|
-
Dynamic: requires-python
|
33
|
+
Provides-Extra: mcp
|
34
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "mcp"
|
38
35
|
|
39
36
|
# Memra SDK
|
40
37
|
|
@@ -131,31 +128,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
131
128
|
├── local/dependencies/ # Database setup & schemas
|
132
129
|
└── docker-compose.yml # Database setup
|
133
130
|
```
|
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)**
|
@@ -93,31 +93,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
93
93
|
├── local/dependencies/ # Database setup & schemas
|
94
94
|
└── docker-compose.yml # Database setup
|
95
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,27 @@
|
|
1
|
+
"""
|
2
|
+
Memra SDK - Declarative AI Workflows
|
3
|
+
|
4
|
+
A framework for building AI-powered business workflows using a declarative approach.
|
5
|
+
Think of it as "Kubernetes for business logic" where agents are the pods and
|
6
|
+
departments are the deployments.
|
7
|
+
"""
|
8
|
+
|
9
|
+
__version__ = "0.2.1"
|
10
|
+
|
11
|
+
# Core imports
|
12
|
+
from .models import Agent, Department, Tool
|
13
|
+
from .execution import ExecutionEngine
|
14
|
+
|
15
|
+
# Make key classes available at package level
|
16
|
+
__all__ = [
|
17
|
+
"Agent",
|
18
|
+
"Department",
|
19
|
+
"Tool",
|
20
|
+
"ExecutionEngine",
|
21
|
+
"__version__"
|
22
|
+
]
|
23
|
+
|
24
|
+
# Optional: Add version check for compatibility
|
25
|
+
import sys
|
26
|
+
if sys.version_info < (3, 8):
|
27
|
+
raise RuntimeError("Memra requires Python 3.8 or higher")
|
@@ -2,7 +2,7 @@ import time
|
|
2
2
|
import logging
|
3
3
|
from typing import Dict, Any, List, Optional
|
4
4
|
from .models import Department, Agent, DepartmentResult, ExecutionTrace, DepartmentAudit
|
5
|
-
from .
|
5
|
+
from .tool_registry import ToolRegistry
|
6
6
|
|
7
7
|
logger = logging.getLogger(__name__)
|
8
8
|
|
@@ -10,7 +10,7 @@ class ExecutionEngine:
|
|
10
10
|
"""Engine that executes department workflows by coordinating agents and tools"""
|
11
11
|
|
12
12
|
def __init__(self):
|
13
|
-
self.tool_registry =
|
13
|
+
self.tool_registry = ToolRegistry()
|
14
14
|
self.last_execution_audit: Optional[DepartmentAudit] = None
|
15
15
|
|
16
16
|
def execute_department(self, department: Department, input_data: Dict[str, Any]) -> DepartmentResult:
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import importlib
|
2
|
+
import logging
|
3
|
+
import sys
|
4
|
+
import os
|
5
|
+
from typing import Dict, Any, List, Optional, Callable
|
6
|
+
from pathlib import Path
|
7
|
+
|
8
|
+
logger = logging.getLogger(__name__)
|
9
|
+
|
10
|
+
class ToolRegistry:
|
11
|
+
"""Registry for managing and executing tools via API calls only"""
|
12
|
+
|
13
|
+
def __init__(self):
|
14
|
+
self.tools: Dict[str, Dict[str, Any]] = {}
|
15
|
+
self._register_known_tools()
|
16
|
+
|
17
|
+
def _register_known_tools(self):
|
18
|
+
"""Register known tools with their metadata (no actual implementations)"""
|
19
|
+
# Server-hosted tools (executed via Memra API)
|
20
|
+
server_tools = [
|
21
|
+
("DatabaseQueryTool", "Query database schemas and data"),
|
22
|
+
("PDFProcessor", "Process PDF files and extract content"),
|
23
|
+
("OCRTool", "Perform OCR on images and documents"),
|
24
|
+
("InvoiceExtractionWorkflow", "Extract structured data from invoices"),
|
25
|
+
("FileReader", "Read files from the filesystem"),
|
26
|
+
]
|
27
|
+
|
28
|
+
for tool_name, description in server_tools:
|
29
|
+
self.register_tool(tool_name, None, "memra", description)
|
30
|
+
|
31
|
+
# MCP-hosted tools (executed via MCP bridge)
|
32
|
+
mcp_tools = [
|
33
|
+
("DataValidator", "Validate data against schemas"),
|
34
|
+
("PostgresInsert", "Insert data into PostgreSQL database"),
|
35
|
+
]
|
36
|
+
|
37
|
+
for tool_name, description in mcp_tools:
|
38
|
+
self.register_tool(tool_name, None, "mcp", description)
|
39
|
+
|
40
|
+
logger.info(f"Registered {len(self.tools)} tool definitions")
|
41
|
+
|
42
|
+
def register_tool(self, name: str, tool_class: Optional[type], hosted_by: str, description: str):
|
43
|
+
"""Register a tool in the registry (metadata only)"""
|
44
|
+
self.tools[name] = {
|
45
|
+
"class": tool_class, # Will be None for API-based tools
|
46
|
+
"hosted_by": hosted_by,
|
47
|
+
"description": description
|
48
|
+
}
|
49
|
+
logger.debug(f"Registered tool: {name} (hosted by {hosted_by})")
|
50
|
+
|
51
|
+
def discover_tools(self, hosted_by: Optional[str] = None) -> List[Dict[str, Any]]:
|
52
|
+
"""Discover available tools, optionally filtered by host"""
|
53
|
+
tools = []
|
54
|
+
for name, info in self.tools.items():
|
55
|
+
if hosted_by is None or info["hosted_by"] == hosted_by:
|
56
|
+
tools.append({
|
57
|
+
"name": name,
|
58
|
+
"hosted_by": info["hosted_by"],
|
59
|
+
"description": info["description"]
|
60
|
+
})
|
61
|
+
return tools
|
62
|
+
|
63
|
+
def execute_tool(self, tool_name: str, hosted_by: str, input_data: Dict[str, Any],
|
64
|
+
config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
65
|
+
"""Execute a tool - this should not be called directly in API-based mode"""
|
66
|
+
logger.warning(f"Direct tool execution attempted for {tool_name}. Use API client instead.")
|
67
|
+
return {
|
68
|
+
"success": False,
|
69
|
+
"error": "Direct tool execution not supported. Use API client for tool execution."
|
70
|
+
}
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "memra"
|
7
|
-
version = "0.2.
|
8
|
-
description = "Declarative framework for enterprise workflows with MCP integration"
|
7
|
+
version = "0.2.1"
|
8
|
+
description = "Declarative framework for enterprise workflows with MCP integration - Client SDK"
|
9
9
|
readme = "README.md"
|
10
10
|
license = {text = "MIT"}
|
11
11
|
authors = [
|
12
|
-
{name = "Memra", email = "
|
12
|
+
{name = "Memra", email = "support@memra.com"}
|
13
13
|
]
|
14
14
|
classifiers = [
|
15
15
|
"Development Status :: 3 - Alpha",
|
@@ -29,7 +29,6 @@ dependencies = [
|
|
29
29
|
"typing-extensions>=4.0.0",
|
30
30
|
"aiohttp>=3.8.0",
|
31
31
|
"aiohttp-cors>=0.7.0",
|
32
|
-
"psycopg2-binary>=2.9.0",
|
33
32
|
]
|
34
33
|
|
35
34
|
[project.optional-dependencies]
|
@@ -39,6 +38,9 @@ dev = [
|
|
39
38
|
"black",
|
40
39
|
"flake8",
|
41
40
|
]
|
41
|
+
mcp = [
|
42
|
+
"psycopg2-binary>=2.9.0",
|
43
|
+
]
|
42
44
|
|
43
45
|
[project.urls]
|
44
46
|
Homepage = "https://memra.co"
|
@@ -48,4 +50,5 @@ Repository = "https://github.com/memra-platform/memra-sdk"
|
|
48
50
|
memra = "memra.cli:main"
|
49
51
|
|
50
52
|
[tool.setuptools.packages.find]
|
51
|
-
include = ["memra*"]
|
53
|
+
include = ["memra*"]
|
54
|
+
exclude = ["logic*", "server*", "app*", "mcp_bridge*"]
|
@@ -5,10 +5,10 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="memra",
|
8
|
-
version="0.2.
|
8
|
+
version="0.2.1",
|
9
9
|
author="Memra",
|
10
|
-
author_email="
|
11
|
-
description="Declarative framework for enterprise workflows with MCP integration",
|
10
|
+
author_email="support@memra.com",
|
11
|
+
description="Declarative framework for enterprise workflows with MCP integration - Client SDK",
|
12
12
|
long_description=long_description,
|
13
13
|
long_description_content_type="text/markdown",
|
14
14
|
url="https://github.com/memra/memra-sdk",
|
@@ -31,7 +31,6 @@ setup(
|
|
31
31
|
"typing-extensions>=4.0.0",
|
32
32
|
"aiohttp>=3.8.0",
|
33
33
|
"aiohttp-cors>=0.7.0",
|
34
|
-
"psycopg2-binary>=2.9.0",
|
35
34
|
],
|
36
35
|
extras_require={
|
37
36
|
"dev": [
|
@@ -40,6 +39,9 @@ setup(
|
|
40
39
|
"black",
|
41
40
|
"flake8",
|
42
41
|
],
|
42
|
+
"mcp": [
|
43
|
+
"psycopg2-binary>=2.9.0",
|
44
|
+
],
|
43
45
|
},
|
44
46
|
entry_points={
|
45
47
|
"console_scripts": [
|
memra-0.2.0/PKG-INFO
DELETED
@@ -1,161 +0,0 @@
|
|
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/memra/__init__.py
DELETED
@@ -1,24 +0,0 @@
|
|
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
|
-
]
|
@@ -1,49 +0,0 @@
|
|
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
|
-
}
|