matimo-postgres 0.1.2__tar.gz → 0.1.3__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.
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/PKG-INFO +28 -29
- matimo_postgres-0.1.3/README.md +106 -0
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/pyproject.toml +1 -1
- matimo_postgres-0.1.2/README.md +0 -107
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/.gitignore +0 -0
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/src/matimo_postgres/__init__.py +0 -0
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/src/matimo_postgres/tools/execute-sql/definition.yaml +0 -0
- {matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/src/matimo_postgres/tools/execute-sql/execute-sql.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: matimo-postgres
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Matimo provider — PostgreSQL tools (query, insert, update, delete, execute SQL)
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: agents,ai,matimo,postgres,tools
|
|
@@ -15,7 +15,7 @@ Description-Content-Type: text/markdown
|
|
|
15
15
|
|
|
16
16
|
# matimo-postgres
|
|
17
17
|
|
|
18
|
-
> PostgreSQL tools for [Matimo](https://matimo.dev)
|
|
18
|
+
> PostgreSQL tools for [Matimo](https://matimo.dev) - execute SQL queries safely with policy-gated approval.
|
|
19
19
|
|
|
20
20
|
[](https://pypi.org/project/matimo-postgres/)
|
|
21
21
|
[](https://matimo.dev/docs)
|
|
@@ -34,9 +34,12 @@ pip install matimo matimo-postgres
|
|
|
34
34
|
|
|
35
35
|
| Tool | Description |
|
|
36
36
|
|------|-------------|
|
|
37
|
-
| `execute-sql` | Execute a SQL query against a PostgreSQL database |
|
|
37
|
+
| `postgres-execute-sql` | Execute a SQL query against a PostgreSQL database |
|
|
38
38
|
|
|
39
|
-
The
|
|
39
|
+
The tool does not set `requires_approval` itself - if you want destructive operations
|
|
40
|
+
(INSERT, UPDATE, DELETE, DROP) to require human approval, gate them yourself via a
|
|
41
|
+
[policy file](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE) or a custom
|
|
42
|
+
`PolicyEngine`.
|
|
40
43
|
|
|
41
44
|
---
|
|
42
45
|
|
|
@@ -44,19 +47,15 @@ The `execute-sql` tool is marked `requires_approval: true` — destructive opera
|
|
|
44
47
|
|
|
45
48
|
```python
|
|
46
49
|
import asyncio
|
|
47
|
-
from matimo import Matimo
|
|
50
|
+
from matimo import Matimo
|
|
48
51
|
from matimo_postgres import get_tools_path
|
|
49
52
|
|
|
50
53
|
async def main():
|
|
51
|
-
|
|
52
|
-
matimo = await Matimo.init(
|
|
53
|
-
get_tools_path(),
|
|
54
|
-
InitOptions(on_hitl=lambda req: {'approved': True, 'reason': 'auto'}),
|
|
55
|
-
)
|
|
54
|
+
matimo = await Matimo.init(get_tools_path())
|
|
56
55
|
|
|
57
56
|
# Run a SELECT query
|
|
58
|
-
result = await matimo.execute('execute-sql', {
|
|
59
|
-
'
|
|
57
|
+
result = await matimo.execute('postgres-execute-sql', {
|
|
58
|
+
'sql': 'SELECT id, name FROM users LIMIT 10',
|
|
60
59
|
})
|
|
61
60
|
print(result)
|
|
62
61
|
|
|
@@ -65,20 +64,20 @@ asyncio.run(main())
|
|
|
65
64
|
|
|
66
65
|
### With Interactive Approval (Recommended for Writes)
|
|
67
66
|
|
|
67
|
+
If you've configured a policy that quarantines this tool for HITL review, provide an
|
|
68
|
+
`on_hitl` callback:
|
|
69
|
+
|
|
68
70
|
```python
|
|
69
71
|
async def ask_user(request) -> dict:
|
|
70
|
-
print(f"\nSQL requires approval:\n{request.params.get('
|
|
72
|
+
print(f"\nSQL requires approval:\n{request.params.get('sql')}")
|
|
71
73
|
answer = input("Run this query? [y/n]: ").strip()
|
|
72
74
|
return {'approved': answer == 'y', 'reason': 'user reviewed'}
|
|
73
75
|
|
|
74
|
-
matimo = await Matimo.init(
|
|
75
|
-
get_tools_path(),
|
|
76
|
-
InitOptions(on_hitl=ask_user),
|
|
77
|
-
)
|
|
76
|
+
matimo = await Matimo.init(get_tools_path(), on_hitl=ask_user)
|
|
78
77
|
|
|
79
|
-
# This will prompt before executing
|
|
80
|
-
await matimo.execute('execute-sql', {
|
|
81
|
-
'
|
|
78
|
+
# This will prompt before executing, if quarantined by your policy
|
|
79
|
+
await matimo.execute('postgres-execute-sql', {
|
|
80
|
+
'sql': 'DELETE FROM sessions WHERE expired_at < NOW()',
|
|
82
81
|
})
|
|
83
82
|
```
|
|
84
83
|
|
|
@@ -87,21 +86,21 @@ await matimo.execute('execute-sql', {
|
|
|
87
86
|
## Authentication
|
|
88
87
|
|
|
89
88
|
```bash
|
|
90
|
-
export
|
|
89
|
+
export MATIMO_POSTGRES_URL="postgresql://user:password@localhost:5432/mydb"
|
|
91
90
|
# or individual params
|
|
92
|
-
export
|
|
93
|
-
export
|
|
94
|
-
export
|
|
95
|
-
export
|
|
96
|
-
export
|
|
91
|
+
export MATIMO_POSTGRES_HOST="localhost"
|
|
92
|
+
export MATIMO_POSTGRES_PORT="5432"
|
|
93
|
+
export MATIMO_POSTGRES_DB="mydb"
|
|
94
|
+
export MATIMO_POSTGRES_USER="myuser"
|
|
95
|
+
export MATIMO_POSTGRES_PASSWORD="mypassword"
|
|
97
96
|
```
|
|
98
97
|
|
|
99
98
|
---
|
|
100
99
|
|
|
101
100
|
## Security Notes
|
|
102
101
|
|
|
103
|
-
- All SQL queries go through Matimo's **content validator**
|
|
104
|
-
- The tool
|
|
102
|
+
- All SQL queries go through Matimo's **content validator** - SSRF and injection patterns are detected
|
|
103
|
+
- The tool itself does not require approval - use a policy file if you want writes gated
|
|
105
104
|
- Use a **read-only database user** for agent workloads when possible
|
|
106
105
|
- Consider a [policy file](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE) to restrict allowed SQL patterns
|
|
107
106
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# matimo-postgres
|
|
2
|
+
|
|
3
|
+
> PostgreSQL tools for [Matimo](https://matimo.dev) - execute SQL queries safely with policy-gated approval.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/matimo-postgres/)
|
|
6
|
+
[](https://matimo.dev/docs)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install matimo matimo-postgres
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Available Tools (1 Tool)
|
|
19
|
+
|
|
20
|
+
| Tool | Description |
|
|
21
|
+
|------|-------------|
|
|
22
|
+
| `postgres-execute-sql` | Execute a SQL query against a PostgreSQL database |
|
|
23
|
+
|
|
24
|
+
The tool does not set `requires_approval` itself - if you want destructive operations
|
|
25
|
+
(INSERT, UPDATE, DELETE, DROP) to require human approval, gate them yourself via a
|
|
26
|
+
[policy file](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE) or a custom
|
|
27
|
+
`PolicyEngine`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import asyncio
|
|
35
|
+
from matimo import Matimo
|
|
36
|
+
from matimo_postgres import get_tools_path
|
|
37
|
+
|
|
38
|
+
async def main():
|
|
39
|
+
matimo = await Matimo.init(get_tools_path())
|
|
40
|
+
|
|
41
|
+
# Run a SELECT query
|
|
42
|
+
result = await matimo.execute('postgres-execute-sql', {
|
|
43
|
+
'sql': 'SELECT id, name FROM users LIMIT 10',
|
|
44
|
+
})
|
|
45
|
+
print(result)
|
|
46
|
+
|
|
47
|
+
asyncio.run(main())
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### With Interactive Approval (Recommended for Writes)
|
|
51
|
+
|
|
52
|
+
If you've configured a policy that quarantines this tool for HITL review, provide an
|
|
53
|
+
`on_hitl` callback:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
async def ask_user(request) -> dict:
|
|
57
|
+
print(f"\nSQL requires approval:\n{request.params.get('sql')}")
|
|
58
|
+
answer = input("Run this query? [y/n]: ").strip()
|
|
59
|
+
return {'approved': answer == 'y', 'reason': 'user reviewed'}
|
|
60
|
+
|
|
61
|
+
matimo = await Matimo.init(get_tools_path(), on_hitl=ask_user)
|
|
62
|
+
|
|
63
|
+
# This will prompt before executing, if quarantined by your policy
|
|
64
|
+
await matimo.execute('postgres-execute-sql', {
|
|
65
|
+
'sql': 'DELETE FROM sessions WHERE expired_at < NOW()',
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Authentication
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export MATIMO_POSTGRES_URL="postgresql://user:password@localhost:5432/mydb"
|
|
75
|
+
# or individual params
|
|
76
|
+
export MATIMO_POSTGRES_HOST="localhost"
|
|
77
|
+
export MATIMO_POSTGRES_PORT="5432"
|
|
78
|
+
export MATIMO_POSTGRES_DB="mydb"
|
|
79
|
+
export MATIMO_POSTGRES_USER="myuser"
|
|
80
|
+
export MATIMO_POSTGRES_PASSWORD="mypassword"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Security Notes
|
|
86
|
+
|
|
87
|
+
- All SQL queries go through Matimo's **content validator** - SSRF and injection patterns are detected
|
|
88
|
+
- The tool itself does not require approval - use a policy file if you want writes gated
|
|
89
|
+
- Use a **read-only database user** for agent workloads when possible
|
|
90
|
+
- Consider a [policy file](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE) to restrict allowed SQL patterns
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
- [Approval System](https://matimo.dev/docs/api-reference/APPROVAL-SYSTEM)
|
|
97
|
+
- [Policy & Lifecycle](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE)
|
|
98
|
+
- [Python Examples](https://github.com/tallclub/matimo/tree/main/python/examples/langchain/postgres)
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Links
|
|
103
|
+
|
|
104
|
+
- **PyPI:** https://pypi.org/project/matimo-postgres/
|
|
105
|
+
- **GitHub:** https://github.com/tallclub/matimo
|
|
106
|
+
|
matimo_postgres-0.1.2/README.md
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# matimo-postgres
|
|
2
|
-
|
|
3
|
-
> PostgreSQL tools for [Matimo](https://matimo.dev) — execute SQL queries safely with policy-gated approval.
|
|
4
|
-
|
|
5
|
-
[](https://pypi.org/project/matimo-postgres/)
|
|
6
|
-
[](https://matimo.dev/docs)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
pip install matimo matimo-postgres
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Available Tools (1 Tool)
|
|
19
|
-
|
|
20
|
-
| Tool | Description |
|
|
21
|
-
|------|-------------|
|
|
22
|
-
| `execute-sql` | Execute a SQL query against a PostgreSQL database |
|
|
23
|
-
|
|
24
|
-
The `execute-sql` tool is marked `requires_approval: true` — destructive operations (INSERT, UPDATE, DELETE, DROP) trigger HITL approval by default.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Quick Start
|
|
29
|
-
|
|
30
|
-
```python
|
|
31
|
-
import asyncio
|
|
32
|
-
from matimo import Matimo, InitOptions
|
|
33
|
-
from matimo_postgres import get_tools_path
|
|
34
|
-
|
|
35
|
-
async def main():
|
|
36
|
-
# Auto-approve for read-only usage (CI/CD)
|
|
37
|
-
matimo = await Matimo.init(
|
|
38
|
-
get_tools_path(),
|
|
39
|
-
InitOptions(on_hitl=lambda req: {'approved': True, 'reason': 'auto'}),
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
# Run a SELECT query
|
|
43
|
-
result = await matimo.execute('execute-sql', {
|
|
44
|
-
'query': 'SELECT id, name FROM users LIMIT 10',
|
|
45
|
-
})
|
|
46
|
-
print(result)
|
|
47
|
-
|
|
48
|
-
asyncio.run(main())
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### With Interactive Approval (Recommended for Writes)
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
async def ask_user(request) -> dict:
|
|
55
|
-
print(f"\nSQL requires approval:\n{request.params.get('query')}")
|
|
56
|
-
answer = input("Run this query? [y/n]: ").strip()
|
|
57
|
-
return {'approved': answer == 'y', 'reason': 'user reviewed'}
|
|
58
|
-
|
|
59
|
-
matimo = await Matimo.init(
|
|
60
|
-
get_tools_path(),
|
|
61
|
-
InitOptions(on_hitl=ask_user),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
# This will prompt before executing
|
|
65
|
-
await matimo.execute('execute-sql', {
|
|
66
|
-
'query': 'DELETE FROM sessions WHERE expired_at < NOW()',
|
|
67
|
-
})
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Authentication
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
export DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
|
|
76
|
-
# or individual params
|
|
77
|
-
export POSTGRES_HOST="localhost"
|
|
78
|
-
export POSTGRES_PORT="5432"
|
|
79
|
-
export POSTGRES_DB="mydb"
|
|
80
|
-
export POSTGRES_USER="myuser"
|
|
81
|
-
export POSTGRES_PASSWORD="mypassword"
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Security Notes
|
|
87
|
-
|
|
88
|
-
- All SQL queries go through Matimo's **content validator** — SSRF and injection patterns are detected
|
|
89
|
-
- The tool has `requires_approval: true` — writes trigger approval by default
|
|
90
|
-
- Use a **read-only database user** for agent workloads when possible
|
|
91
|
-
- Consider a [policy file](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE) to restrict allowed SQL patterns
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Documentation
|
|
96
|
-
|
|
97
|
-
- [Approval System](https://matimo.dev/docs/api-reference/APPROVAL-SYSTEM)
|
|
98
|
-
- [Policy & Lifecycle](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE)
|
|
99
|
-
- [Python Examples](https://github.com/tallclub/matimo/tree/main/python/examples/langchain/postgres)
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Links
|
|
104
|
-
|
|
105
|
-
- **PyPI:** https://pypi.org/project/matimo-postgres/
|
|
106
|
-
- **GitHub:** https://github.com/tallclub/matimo
|
|
107
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{matimo_postgres-0.1.2 → matimo_postgres-0.1.3}/src/matimo_postgres/tools/execute-sql/execute-sql.py
RENAMED
|
File without changes
|