memra 0.2.3__tar.gz → 0.2.4__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.
Files changed (65) hide show
  1. memra-0.2.4/CHANGELOG.md +63 -0
  2. memra-0.2.4/LICENSE +0 -0
  3. {memra-0.2.3 → memra-0.2.4}/PKG-INFO +45 -1
  4. memra-0.2.4/README.md +106 -0
  5. memra-0.2.4/mcp_bridge_server.py +851 -0
  6. memra-0.2.4/memra/__init__.py +31 -0
  7. memra-0.2.4/memra/discovery.py +15 -0
  8. memra-0.2.4/memra/discovery_client.py +49 -0
  9. memra-0.2.4/memra/execution.py +491 -0
  10. memra-0.2.4/memra/models.py +99 -0
  11. memra-0.2.4/memra/tool_registry.py +351 -0
  12. memra-0.2.4/memra/tool_registry_client.py +106 -0
  13. memra-0.2.4/memra-ops/app.py +710 -0
  14. memra-0.2.4/memra-ops/config/config.py +25 -0
  15. memra-0.2.4/memra-ops/config.py +34 -0
  16. memra-0.2.4/memra-ops/scripts/release.py +133 -0
  17. memra-0.2.4/memra-ops/scripts/start_memra.py +334 -0
  18. memra-0.2.4/memra-ops/scripts/stop_memra.py +132 -0
  19. memra-0.2.4/memra-ops/server_tool_registry.py +188 -0
  20. memra-0.2.4/memra-ops/tests/test_llm_text_to_sql.py +115 -0
  21. memra-0.2.4/memra-ops/tests/test_llm_vs_pattern.py +130 -0
  22. memra-0.2.4/memra-ops/tests/test_mcp_schema_aware.py +124 -0
  23. memra-0.2.4/memra-ops/tests/test_schema_aware_sql.py +139 -0
  24. memra-0.2.4/memra-ops/tests/test_schema_aware_sql_simple.py +66 -0
  25. memra-0.2.4/memra-ops/tests/test_text_to_sql_demo.py +140 -0
  26. memra-0.2.4/memra-ops/tools/mcp_bridge_server.py +851 -0
  27. memra-0.2.4/memra-sdk/examples/accounts_payable.py +215 -0
  28. memra-0.2.4/memra-sdk/examples/accounts_payable_client.py +217 -0
  29. memra-0.2.4/memra-sdk/examples/accounts_payable_mcp.py +200 -0
  30. memra-0.2.4/memra-sdk/examples/ask_questions.py +123 -0
  31. memra-0.2.4/memra-sdk/examples/invoice_processing.py +116 -0
  32. memra-0.2.4/memra-sdk/examples/propane_delivery.py +87 -0
  33. memra-0.2.4/memra-sdk/examples/simple_text_to_sql.py +158 -0
  34. memra-0.2.4/memra-sdk/scripts/release.py +133 -0
  35. memra-0.2.4/memra-workflows/accounts_payable/accounts_payable.py +215 -0
  36. memra-0.2.4/memra-workflows/accounts_payable/accounts_payable_client.py +216 -0
  37. memra-0.2.4/memra-workflows/accounts_payable/accounts_payable_mcp.py +200 -0
  38. memra-0.2.4/memra-workflows/accounts_payable/accounts_payable_smart.py +221 -0
  39. memra-0.2.4/memra-workflows/invoice_processing/invoice_processing.py +116 -0
  40. memra-0.2.4/memra-workflows/invoice_processing/smart_invoice_processor.py +220 -0
  41. memra-0.2.4/memra-workflows/logic/__init__.py +1 -0
  42. memra-0.2.4/memra-workflows/logic/file_tools.py +50 -0
  43. memra-0.2.4/memra-workflows/logic/invoice_tools.py +501 -0
  44. memra-0.2.4/memra-workflows/logic/propane_agents.py +52 -0
  45. memra-0.2.4/memra-workflows/mcp_bridge_server.py +230 -0
  46. memra-0.2.4/memra-workflows/propane_delivery/propane_delivery.py +87 -0
  47. memra-0.2.4/memra-workflows/text_to_sql/complete_invoice_workflow_with_queries.py +208 -0
  48. memra-0.2.4/memra-workflows/text_to_sql/complete_text_to_sql_system.py +266 -0
  49. memra-0.2.4/memra-workflows/text_to_sql/file_discovery_demo.py +156 -0
  50. memra-0.2.4/memra.egg-info/SOURCES.txt +60 -0
  51. {memra-0.2.3 → memra-0.2.4}/pyproject.toml +1 -1
  52. memra-0.2.4/requirements.txt +6 -0
  53. memra-0.2.4/setup.py +52 -0
  54. memra-0.2.3/README.md +0 -64
  55. memra-0.2.3/memra.egg-info/SOURCES.txt +0 -11
  56. {memra-0.2.3 → memra-0.2.4}/MANIFEST.in +0 -0
  57. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/__init__.py +0 -0
  58. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/discovery.py +0 -0
  59. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/discovery_client.py +0 -0
  60. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/execution.py +0 -0
  61. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/models.py +0 -0
  62. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/tool_registry.py +0 -0
  63. {memra-0.2.3 → memra-0.2.4/memra-sdk}/memra/tool_registry_client.py +0 -0
  64. {memra-0.2.3 → memra-0.2.4/memra-sdk}/setup.py +0 -0
  65. {memra-0.2.3 → memra-0.2.4}/setup.cfg +0 -0
@@ -0,0 +1,63 @@
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.2] - 2025-05-28
9
+
10
+ ### Fixed
11
+ - **MCP Integration**: Fixed broken MCP tool execution after repository separation
12
+ - **Tool Registry**: Updated MCP tool routing to use correct endpoints
13
+ - **Bridge Server**: Added working MCP bridge server implementation
14
+ - **Real Work Detection**: Improved detection of real vs mock work for MCP tools
15
+
16
+ ### Added
17
+ - Complete MCP bridge server with DataValidator and PostgresInsert tools
18
+ - Health check endpoint for MCP bridge monitoring
19
+ - Better error handling and fallback for MCP tool execution
20
+
21
+ ### Changed
22
+ - MCP tools now perform real database operations instead of mock responses
23
+ - Improved logging and debugging for MCP tool execution flow
24
+
25
+ ## [0.2.1] - 2025-05-27
26
+
27
+ ## [0.2.0] - 2024-01-17
28
+
29
+ ### Added
30
+ - **MCP (Model Context Protocol) Integration**: Execute operations on local infrastructure while leveraging cloud AI processing
31
+ - New `mcp_bridge_server.py` for local resource bridging
32
+ - HMAC authentication for secure cloud-to-local communication
33
+ - Support for `hosted_by: "mcp"` in agent tool configurations
34
+ - PostgreSQL integration via MCP bridge
35
+ - Tool-level configuration support in execution engine
36
+ - New MCP tools: `PostgresInsert`, `DataValidator`
37
+
38
+ ### Enhanced
39
+ - **Execution Engine**: Updated to support tool-level configuration and MCP routing
40
+ - **Tool Registry Client**: Enhanced API client with better error handling and MCP support
41
+ - **Agent Configuration**: Added support for tool-specific configuration alongside agent-level config
42
+
43
+ ### Examples
44
+ - `examples/accounts_payable_mcp.py` - Complete invoice processing with MCP database integration
45
+ - `test_mcp_success.py` - Simple MCP integration test
46
+
47
+ ### Documentation
48
+ - `docs/mcp_integration.md` - Comprehensive MCP integration guide
49
+ - Updated README with MCP overview and quick start
50
+
51
+ ### Dependencies
52
+ - Added `aiohttp>=3.8.0` for MCP bridge server
53
+ - Added `aiohttp-cors>=0.7.0` for CORS support
54
+ - Added `psycopg2-binary>=2.9.0` for PostgreSQL integration
55
+
56
+ ## [0.1.0] - 2024-01-01
57
+
58
+ ### Added
59
+ - Initial release of Memra SDK
60
+ - Core agent and department framework
61
+ - API client for Memra cloud services
62
+ - Basic tool registry and execution engine
63
+ - Examples for accounts payable and propane delivery workflows
memra-0.2.4/LICENSE ADDED
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memra
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
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
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
+ License-File: LICENSE
22
23
  Requires-Dist: pydantic>=1.8.0
23
24
  Requires-Dist: httpx>=0.24.0
24
25
  Requires-Dist: typing-extensions>=4.0.0
@@ -33,6 +34,7 @@ Provides-Extra: mcp
33
34
  Requires-Dist: psycopg2-binary>=2.9.0; extra == "mcp"
34
35
  Dynamic: author
35
36
  Dynamic: home-page
37
+ Dynamic: license-file
36
38
  Dynamic: requires-python
37
39
 
38
40
  # Memra SDK
@@ -96,6 +98,48 @@ See the `examples/` directory for basic usage examples:
96
98
 
97
99
  For detailed documentation, visit [docs.memra.co](https://docs.memra.co)
98
100
 
101
+ Documentation is also available locally in the `examples/` directory.
102
+
103
+ ## Example: Propane Delivery Workflow
104
+
105
+ See the `examples/propane_delivery.py` file for a complete example of how to use Memra to orchestrate a propane delivery workflow.
106
+
107
+ ## 🔍 Smart File Discovery
108
+
109
+ Memra includes intelligent file discovery and management capabilities:
110
+
111
+ ### File Discovery Tools
112
+ - **FileDiscovery**: Automatically scan directories for files matching patterns
113
+ - **FileCopy**: Copy files from external locations to standard processing directories
114
+ - **Smart Routing**: Automatically handle file paths and directory management
115
+
116
+ ### Example: Smart Invoice Processing
117
+ ```python
118
+ from memra import Agent
119
+
120
+ # Smart agent that discovers and processes files automatically
121
+ smart_parser = Agent(
122
+ role="Smart Invoice Parser",
123
+ job="Discover and process invoice files intelligently",
124
+ tools=[
125
+ {"name": "FileDiscovery", "hosted_by": "memra"},
126
+ {"name": "FileCopy", "hosted_by": "memra"},
127
+ {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
128
+ ]
129
+ )
130
+
131
+ # Three modes of operation:
132
+ # 1. Auto-discovery: Scan invoices/ directory
133
+ # 2. External file: Copy from Downloads to invoices/
134
+ # 3. Specific file: Process exact file path
135
+ ```
136
+
137
+ See `examples/accounts_payable_smart.py` for a complete implementation.
138
+
139
+ ## Contributing
140
+
141
+ We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
142
+
99
143
  ## License
100
144
 
101
145
  MIT License - see LICENSE file for details.
memra-0.2.4/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # Memra SDK
2
+
3
+ The core Memra framework for building AI-powered business workflows.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install memra
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from memra import Agent, Department, LLM, ExecutionEngine
15
+
16
+ # Define an agent
17
+ agent = Agent(
18
+ role="Data Analyst",
19
+ job="Analyze customer data",
20
+ llm=LLM(model="llama-3.2-11b-vision-preview"),
21
+ sops=["Load data", "Perform analysis", "Generate report"],
22
+ output_key="analysis_result"
23
+ )
24
+
25
+ # Create a department
26
+ department = Department(
27
+ name="Analytics",
28
+ mission="Provide data insights",
29
+ agents=[agent],
30
+ workflow_order=["Data Analyst"]
31
+ )
32
+
33
+ # Execute the workflow
34
+ engine = ExecutionEngine()
35
+ result = engine.execute_department(department, {"data": "customer_data.csv"})
36
+ ```
37
+
38
+ ## Core Components
39
+
40
+ ### Agent
41
+ An AI worker that performs specific tasks using LLMs and tools.
42
+
43
+ ### Department
44
+ A team of agents working together to accomplish a mission.
45
+
46
+ ### ExecutionEngine
47
+ Orchestrates the execution of departments and their workflows.
48
+
49
+ ### LLM
50
+ Configuration for language models used by agents.
51
+
52
+ ## Examples
53
+
54
+ See the `examples/` directory for basic usage examples:
55
+ - `simple_text_to_sql.py` - Basic text-to-SQL conversion
56
+ - `ask_questions.py` - Simple question answering
57
+
58
+ ## Documentation
59
+
60
+ For detailed documentation, visit [docs.memra.co](https://docs.memra.co)
61
+
62
+ Documentation is also available locally in the `examples/` directory.
63
+
64
+ ## Example: Propane Delivery Workflow
65
+
66
+ See the `examples/propane_delivery.py` file for a complete example of how to use Memra to orchestrate a propane delivery workflow.
67
+
68
+ ## 🔍 Smart File Discovery
69
+
70
+ Memra includes intelligent file discovery and management capabilities:
71
+
72
+ ### File Discovery Tools
73
+ - **FileDiscovery**: Automatically scan directories for files matching patterns
74
+ - **FileCopy**: Copy files from external locations to standard processing directories
75
+ - **Smart Routing**: Automatically handle file paths and directory management
76
+
77
+ ### Example: Smart Invoice Processing
78
+ ```python
79
+ from memra import Agent
80
+
81
+ # Smart agent that discovers and processes files automatically
82
+ smart_parser = Agent(
83
+ role="Smart Invoice Parser",
84
+ job="Discover and process invoice files intelligently",
85
+ tools=[
86
+ {"name": "FileDiscovery", "hosted_by": "memra"},
87
+ {"name": "FileCopy", "hosted_by": "memra"},
88
+ {"name": "InvoiceExtractionWorkflow", "hosted_by": "memra"}
89
+ ]
90
+ )
91
+
92
+ # Three modes of operation:
93
+ # 1. Auto-discovery: Scan invoices/ directory
94
+ # 2. External file: Copy from Downloads to invoices/
95
+ # 3. Specific file: Process exact file path
96
+ ```
97
+
98
+ See `examples/accounts_payable_smart.py` for a complete implementation.
99
+
100
+ ## Contributing
101
+
102
+ We welcome contributions! Please see our [contributing guide](CONTRIBUTING.md) for details.
103
+
104
+ ## License
105
+
106
+ MIT License - see LICENSE file for details.