provision-stack-composio 0.1.0__py3-none-any.whl
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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Provision Stack integration for Composio.
|
|
3
|
+
|
|
4
|
+
Composio connects AI agents to 200+ apps and services.
|
|
5
|
+
This integration registers Provision Stack as a Composio tool,
|
|
6
|
+
making it available to LangChain, CrewAI, AutoGen, and other
|
|
7
|
+
frameworks through Composio's tool marketplace.
|
|
8
|
+
|
|
9
|
+
Usage::
|
|
10
|
+
|
|
11
|
+
from composio import ComposioToolSet
|
|
12
|
+
from provision_stack_composio import register_provision_stack_tools
|
|
13
|
+
|
|
14
|
+
toolset = ComposioToolSet()
|
|
15
|
+
register_provision_stack_tools(toolset, api_key="your-token")
|
|
16
|
+
tools = toolset.get_tools()
|
|
17
|
+
|
|
18
|
+
# Now use with any Composio-supported framework
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from provision_stack_composio.tools import register_provision_stack_tools
|
|
22
|
+
|
|
23
|
+
__all__ = ["register_provision_stack_tools"]
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Composio tool registration for Provision Stack.
|
|
3
|
+
|
|
4
|
+
Registers Provision Stack actions with the Composio toolset,
|
|
5
|
+
making them available to any framework that uses Composio
|
|
6
|
+
(LangChain, CrewAI, AutoGen, LlamaIndex, etc.).
|
|
7
|
+
|
|
8
|
+
Composio actions follow a specific pattern:
|
|
9
|
+
- Each action has a name, description, and input schema
|
|
10
|
+
- Actions are registered with the ComposioToolSet
|
|
11
|
+
- The toolset handles framework-specific wrapping
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
from typing import Any, Callable
|
|
18
|
+
|
|
19
|
+
from provision_stack.client import ProvisionStackClient
|
|
20
|
+
from provision_stack.config import PRODUCT_NAME
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _register_action(
|
|
24
|
+
toolset: Any,
|
|
25
|
+
name: str,
|
|
26
|
+
description: str,
|
|
27
|
+
schema: dict[str, Any],
|
|
28
|
+
handler: Callable[..., Any],
|
|
29
|
+
) -> None:
|
|
30
|
+
"""
|
|
31
|
+
Register a single action with the Composio toolset.
|
|
32
|
+
|
|
33
|
+
Composio supports custom actions via toolset.set_actions() or
|
|
34
|
+
by defining action classes. This helper handles both patterns.
|
|
35
|
+
"""
|
|
36
|
+
try:
|
|
37
|
+
# Composio >=0.6: use set_actions with a dict
|
|
38
|
+
toolset.set_actions(
|
|
39
|
+
{
|
|
40
|
+
name: {
|
|
41
|
+
"description": description,
|
|
42
|
+
"schema": schema,
|
|
43
|
+
"handler": handler,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
except AttributeError:
|
|
48
|
+
# Older Composio: try the action class pattern
|
|
49
|
+
try:
|
|
50
|
+
from composio import Action
|
|
51
|
+
|
|
52
|
+
action_cls = type(
|
|
53
|
+
f"Action{name}",
|
|
54
|
+
(Action,),
|
|
55
|
+
{
|
|
56
|
+
"name": name,
|
|
57
|
+
"description": description,
|
|
58
|
+
"schema": schema,
|
|
59
|
+
"execute": staticmethod(handler),
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
toolset.register_action(action_cls)
|
|
63
|
+
except ImportError:
|
|
64
|
+
raise RuntimeError(
|
|
65
|
+
"Composio is not installed. "
|
|
66
|
+
"Install with: pip install composio-core"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def register_provision_stack_tools(
|
|
71
|
+
toolset: Any,
|
|
72
|
+
api_key: str | None = None,
|
|
73
|
+
base_url: str | None = None,
|
|
74
|
+
sandbox: bool = False,
|
|
75
|
+
actions: list[str] | None = None,
|
|
76
|
+
) -> None:
|
|
77
|
+
"""
|
|
78
|
+
Register Provision Stack tools with a Composio toolset.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
----------
|
|
82
|
+
toolset : ComposioToolSet
|
|
83
|
+
The Composio toolset to register actions with.
|
|
84
|
+
api_key : str, optional
|
|
85
|
+
API token. Falls back to PROVISION_STACK_API_KEY env var.
|
|
86
|
+
base_url : str, optional
|
|
87
|
+
API base URL. Falls back to env var or default.
|
|
88
|
+
sandbox : bool
|
|
89
|
+
If True, use sandbox (mock Terraform, no real deploys).
|
|
90
|
+
actions : list[str], optional
|
|
91
|
+
Subset of actions to register. None = all actions.
|
|
92
|
+
Options: "SUGGEST", "DEPLOY", "STATUS", "DESTROY",
|
|
93
|
+
"BALANCE", "TOPUP".
|
|
94
|
+
|
|
95
|
+
Examples
|
|
96
|
+
--------
|
|
97
|
+
::
|
|
98
|
+
|
|
99
|
+
from composio import ComposioToolSet
|
|
100
|
+
from provision_stack_composio import register_provision_stack_tools
|
|
101
|
+
|
|
102
|
+
toolset = ComposioToolSet()
|
|
103
|
+
register_provision_stack_tools(toolset)
|
|
104
|
+
tools = toolset.get_tools()
|
|
105
|
+
|
|
106
|
+
# Register only specific actions
|
|
107
|
+
register_provision_stack_tools(toolset, actions=["SUGGEST", "DEPLOY"])
|
|
108
|
+
"""
|
|
109
|
+
client = ProvisionStackClient(
|
|
110
|
+
api_key=api_key, base_url=base_url, sandbox=sandbox
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
all_actions = {
|
|
114
|
+
"SUGGEST": {
|
|
115
|
+
"name": "PROVISION_STACK_SUGGEST",
|
|
116
|
+
"description": (
|
|
117
|
+
f"Get deployment suggestions from {PRODUCT_NAME}. "
|
|
118
|
+
"Returns tier options (Starter/MVP/Startup/Enterprise) "
|
|
119
|
+
"with monthly cost estimates across cloud providers."
|
|
120
|
+
),
|
|
121
|
+
"schema": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"outcome": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "Natural language description of desired infrastructure",
|
|
127
|
+
},
|
|
128
|
+
"region": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"description": "Cloud region (e.g. 'us-east-1')",
|
|
131
|
+
},
|
|
132
|
+
"provider": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"enum": ["aws", "gcp", "azure", "oracle"],
|
|
135
|
+
"description": "Restrict to one provider",
|
|
136
|
+
},
|
|
137
|
+
"max_monthly_cost_usd": {
|
|
138
|
+
"type": "number",
|
|
139
|
+
"description": "Monthly cost cap in USD",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
"required": ["outcome"],
|
|
143
|
+
},
|
|
144
|
+
"handler": lambda outcome, region=None, provider=None,
|
|
145
|
+
max_monthly_cost_usd=None, **kw: client.suggest(
|
|
146
|
+
outcome=outcome,
|
|
147
|
+
region=region,
|
|
148
|
+
provider=provider,
|
|
149
|
+
max_monthly_cost_usd=max_monthly_cost_usd,
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
"DEPLOY": {
|
|
153
|
+
"name": "PROVISION_STACK_DEPLOY",
|
|
154
|
+
"description": (
|
|
155
|
+
f"Deploy infrastructure via {PRODUCT_NAME}. "
|
|
156
|
+
"Fee held from balance, captured after verification."
|
|
157
|
+
),
|
|
158
|
+
"schema": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"properties": {
|
|
161
|
+
"outcome": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "What to deploy",
|
|
164
|
+
},
|
|
165
|
+
"tier": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"enum": ["Starter", "MVP", "Startup", "Enterprise"],
|
|
168
|
+
"description": "Deployment tier",
|
|
169
|
+
},
|
|
170
|
+
"region": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"description": "Target region",
|
|
173
|
+
},
|
|
174
|
+
"max_monthly_cost_usd": {
|
|
175
|
+
"type": "number",
|
|
176
|
+
"description": "Monthly cost cap",
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
"required": ["outcome"],
|
|
180
|
+
},
|
|
181
|
+
"handler": lambda outcome, tier=None, region=None,
|
|
182
|
+
max_monthly_cost_usd=None, **kw: client.deploy(
|
|
183
|
+
outcome=outcome,
|
|
184
|
+
tier=tier,
|
|
185
|
+
region=region,
|
|
186
|
+
max_monthly_cost_usd=max_monthly_cost_usd,
|
|
187
|
+
),
|
|
188
|
+
},
|
|
189
|
+
"STATUS": {
|
|
190
|
+
"name": "PROVISION_STACK_STATUS",
|
|
191
|
+
"description": f"Check status of a {PRODUCT_NAME} deployment.",
|
|
192
|
+
"schema": {
|
|
193
|
+
"type": "object",
|
|
194
|
+
"properties": {
|
|
195
|
+
"deployment_id": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"description": "Deployment ID to check",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
"required": ["deployment_id"],
|
|
201
|
+
},
|
|
202
|
+
"handler": lambda deployment_id, **kw: client.status(deployment_id),
|
|
203
|
+
},
|
|
204
|
+
"DESTROY": {
|
|
205
|
+
"name": "PROVISION_STACK_DESTROY",
|
|
206
|
+
"description": f"Destroy all resources in a {PRODUCT_NAME} deployment.",
|
|
207
|
+
"schema": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"properties": {
|
|
210
|
+
"deployment_id": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"description": "Deployment ID to destroy",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
"required": ["deployment_id"],
|
|
216
|
+
},
|
|
217
|
+
"handler": lambda deployment_id, **kw: client.destroy(deployment_id),
|
|
218
|
+
},
|
|
219
|
+
"BALANCE": {
|
|
220
|
+
"name": "PROVISION_STACK_BALANCE",
|
|
221
|
+
"description": f"Check {PRODUCT_NAME} account credit balance.",
|
|
222
|
+
"schema": {
|
|
223
|
+
"type": "object",
|
|
224
|
+
"properties": {},
|
|
225
|
+
},
|
|
226
|
+
"handler": lambda **kw: client.balance(),
|
|
227
|
+
},
|
|
228
|
+
"TOPUP": {
|
|
229
|
+
"name": "PROVISION_STACK_TOPUP",
|
|
230
|
+
"description": f"Add credits to {PRODUCT_NAME} account.",
|
|
231
|
+
"schema": {
|
|
232
|
+
"type": "object",
|
|
233
|
+
"properties": {
|
|
234
|
+
"amount_usd": {
|
|
235
|
+
"type": "number",
|
|
236
|
+
"description": "Amount in USD",
|
|
237
|
+
},
|
|
238
|
+
"rail": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"enum": ["stripe", "xrp"],
|
|
241
|
+
"description": "Payment method",
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
"required": ["amount_usd"],
|
|
245
|
+
},
|
|
246
|
+
"handler": lambda amount_usd, rail="stripe", **kw: (
|
|
247
|
+
client.topup_xrp(amount_usd) if rail == "xrp"
|
|
248
|
+
else client.topup_stripe(amount_usd)
|
|
249
|
+
),
|
|
250
|
+
},
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
# Register requested actions
|
|
254
|
+
to_register = actions or list(all_actions.keys())
|
|
255
|
+
|
|
256
|
+
for action_key in to_register:
|
|
257
|
+
action = all_actions.get(action_key)
|
|
258
|
+
if action is None:
|
|
259
|
+
raise ValueError(
|
|
260
|
+
f"Unknown action: {action_key}. "
|
|
261
|
+
f"Available: {list(all_actions.keys())}"
|
|
262
|
+
)
|
|
263
|
+
_register_action(
|
|
264
|
+
toolset,
|
|
265
|
+
name=action["name"],
|
|
266
|
+
description=action["description"],
|
|
267
|
+
schema=action["schema"],
|
|
268
|
+
handler=action["handler"],
|
|
269
|
+
)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: provision-stack-composio
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Composio integration for Provision Stack — deploy cloud infrastructure via AI agents.
|
|
5
|
+
Project-URL: Homepage, https://provision-stack.com
|
|
6
|
+
Project-URL: Documentation, https://docs.provision-stack.com
|
|
7
|
+
Project-URL: Repository, https://github.com/TravisLinkey/provision-stack
|
|
8
|
+
Author: Provision Stack
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: ai-agents,autogen,aws,composio,crewai,gcp,infrastructure,langchain,mcp
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: composio-core>=0.6.0
|
|
22
|
+
Requires-Dist: provision-stack>=0.1.0
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: pytest-mock>=3.12; extra == 'test'
|
|
25
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# provision-stack-composio
|
|
29
|
+
|
|
30
|
+
> Composio integration for Provision Stack — deploy cloud infrastructure via AI agents.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install provision-stack-composio
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from composio import ComposioToolSet
|
|
42
|
+
from provision_stack_composio import register_provision_stack_tools
|
|
43
|
+
|
|
44
|
+
toolset = ComposioToolSet()
|
|
45
|
+
register_provision_stack_tools(toolset, api_key="your-token", sandbox=True)
|
|
46
|
+
tools = toolset.get_tools()
|
|
47
|
+
|
|
48
|
+
# Now use with any Composio-supported framework:
|
|
49
|
+
# LangChain, CrewAI, AutoGen, LlamaIndex, etc.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## What This Does
|
|
53
|
+
|
|
54
|
+
Registers Provision Stack as a Composio integration, making it available
|
|
55
|
+
to any framework that uses Composio. One integration → all frameworks.
|
|
56
|
+
|
|
57
|
+
## Available Actions
|
|
58
|
+
|
|
59
|
+
| Action | Description |
|
|
60
|
+
|--------|-------------|
|
|
61
|
+
| `PROVISION_STACK_SUGGEST` | Get deployment suggestions with tier options and costs |
|
|
62
|
+
| `PROVISION_STACK_DEPLOY` | Deploy infrastructure (fee held, captured after verification) |
|
|
63
|
+
| `PROVISION_STACK_STATUS` | Check deployment status and verification results |
|
|
64
|
+
| `PROVISION_STACK_DESTROY` | Destroy all resources owned by a deployment |
|
|
65
|
+
| `PROVISION_STACK_BALANCE` | Check account credit balance |
|
|
66
|
+
| `PROVISION_STACK_TOPUP` | Add credits via Stripe or XRP |
|
|
67
|
+
|
|
68
|
+
## Selective Registration
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# Register only specific actions
|
|
72
|
+
register_provision_stack_tools(
|
|
73
|
+
toolset,
|
|
74
|
+
api_key="your-token",
|
|
75
|
+
actions=["SUGGEST", "DEPLOY"], # only these two
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Configuration
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
register_provision_stack_tools(
|
|
83
|
+
toolset,
|
|
84
|
+
api_key="your-token", # or PROVISION_STACK_API_KEY env var
|
|
85
|
+
base_url="https://...", # or PROVISION_STACK_API_URL env var
|
|
86
|
+
sandbox=True, # use sandbox (mock Terraform)
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
provision_stack_composio/__init__.py,sha256=JY0fbeEx3zcVs_0M8rOngjJrf8yRsRKrm800oMePO4E,706
|
|
2
|
+
provision_stack_composio/tools.py,sha256=AP0ezwuYZg46Y6-wXiIF7Q3U3Mm3PrgQou8VU7UcntY,9207
|
|
3
|
+
provision_stack_composio-0.1.0.dist-info/METADATA,sha256=20I4s30G4uTQR-Qocq6XUSmmJsi5sT2EaLAXKIqswgc,2943
|
|
4
|
+
provision_stack_composio-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
5
|
+
provision_stack_composio-0.1.0.dist-info/RECORD,,
|