agentstr 0.1.10__py3-none-any.whl → 0.1.11__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.
- {agentstr-0.1.10.dist-info → agentstr-0.1.11.dist-info}/METADATA +41 -28
- agentstr-0.1.11.dist-info/RECORD +8 -0
- agentstr/examples/basic_cli/.env.example +0 -2
- agentstr/examples/basic_cli/README.md +0 -11
- agentstr/examples/basic_cli/main.py +0 -193
- agentstr-0.1.10.dist-info/RECORD +0 -11
- {agentstr-0.1.10.dist-info → agentstr-0.1.11.dist-info}/LICENSE +0 -0
- {agentstr-0.1.10.dist-info → agentstr-0.1.11.dist-info}/WHEEL +0 -0
- {agentstr-0.1.10.dist-info → agentstr-0.1.11.dist-info}/top_level.txt +0 -0
@@ -1,31 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: agentstr
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11
|
4
4
|
Summary: Nostr extension for Phidata AI agents
|
5
5
|
Author-email: Synvya <info@synvya.com>
|
6
|
-
License: MIT
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
|
-
Project-URL: Homepage, https://github.com/synvya/agentstr
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://www.synvya.com
|
8
|
+
Project-URL: Repository, https://github.com/synvya/agentstr
|
29
9
|
Project-URL: Documentation, https://github.com/synvya/agentstr#readme
|
30
10
|
Project-URL: BugTracker, https://github.com/synvya/agentstr/issues
|
31
11
|
Requires-Python: <3.13,>=3.9
|
@@ -100,15 +80,48 @@ pip install agentstr
|
|
100
80
|
|
101
81
|
## Examples
|
102
82
|
|
103
|
-
|
83
|
+
You can find example code in the [examples](https://github.com/Synvya/agentstr/tree/main/examples/) directory.
|
104
84
|
|
105
|
-
|
85
|
+
### Instaling the examples
|
86
|
+
1. **Clone the repository**
|
87
|
+
```bash
|
88
|
+
git clone https://github.com/Synvya/agentstr.git
|
89
|
+
```
|
90
|
+
|
91
|
+
### Basic CLI Example
|
92
|
+
A simple command-line interface demonstrating agentstr's merchant capabilities:
|
93
|
+
|
94
|
+
|
95
|
+
- [Basic CLI Agent](https://github.com/Synvya/agentstr/tree/main/src/agentstr/examples/basic_cli/main.py) - A complete example showing:
|
106
96
|
- Setting up merchant profiles
|
107
97
|
- Creating stalls with shipping methods
|
108
98
|
- Defining products with shipping costs
|
109
99
|
- Configuring the agent with the merchant toolkit
|
110
100
|
- Running an interactive CLI application
|
111
101
|
|
102
|
+
1. ** Create a virtual environment**
|
103
|
+
```bash
|
104
|
+
cd agentstr/examples/basic_cli
|
105
|
+
python3 -m venv venv
|
106
|
+
source venv/bin/activate
|
107
|
+
```
|
108
|
+
|
109
|
+
2. ** Install dependencies**
|
110
|
+
```bash
|
111
|
+
pip install -r requirements.txt
|
112
|
+
```
|
113
|
+
|
114
|
+
3. ** Configure your environment**
|
115
|
+
```bash
|
116
|
+
cp .env.example .env
|
117
|
+
```
|
118
|
+
**Edit the .env file with your own API keys and Nostr credentials**
|
119
|
+
|
120
|
+
4. ** Run the example**
|
121
|
+
```bash
|
122
|
+
python main.py
|
123
|
+
```
|
124
|
+
|
112
125
|
|
113
126
|
## Documentation
|
114
127
|
|
@@ -116,14 +129,14 @@ For more detailed documentation and examples, see [Docs](https://github.com/Synv
|
|
116
129
|
|
117
130
|
## Development
|
118
131
|
|
119
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
132
|
+
See [CONTRIBUTING.md](https://github.com/Synvya/agentstr/blob/main/CONTRIBUTING.md) for:
|
120
133
|
- Development setup
|
121
134
|
- Testing instructions
|
122
135
|
- Contribution guidelines
|
123
136
|
|
124
137
|
## License
|
125
138
|
|
126
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
139
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Synvya/agentstr/blob/main/LICENSE) file for details.
|
127
140
|
|
128
141
|
## Acknowledgments
|
129
142
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
agentstr/__init__.py,sha256=bPXCN4fDtqII9UtDCwhWhkR6bi1LR4w0rR0vGeKPNoI,567
|
2
|
+
agentstr/marketplace.py,sha256=CavX0WQaCiz1sQhVs-PaHZ4YYUdcabW5V5eXrhtbT5A,40406
|
3
|
+
agentstr/nostr.py,sha256=PId6477VuShPq7nKgansgyJhJNNy9S8ycCf_3niizg4,11242
|
4
|
+
agentstr-0.1.11.dist-info/LICENSE,sha256=20H0yoEDN5XO1xPXyZCyJjvSTP0YiarRMKWPfiaBhQY,1063
|
5
|
+
agentstr-0.1.11.dist-info/METADATA,sha256=Vd8WUSeuBXcLgutM8deaNa4mxb4tESgAKgjD6gFLJ40,4314
|
6
|
+
agentstr-0.1.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
+
agentstr-0.1.11.dist-info/top_level.txt,sha256=KZObFRHppZvKUGYB_m9w5HhLwps7jj7w6Xrw73dH2ss,9
|
8
|
+
agentstr-0.1.11.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Basic CLI Agent Example
|
2
|
-
|
3
|
-
This example demonstrates a complete setup of a merchant agent with:
|
4
|
-
- Multiple stalls (Hardware Store and Trade School)
|
5
|
-
- Multiple products per stall
|
6
|
-
- Different shipping zones and costs
|
7
|
-
- Interactive CLI interface
|
8
|
-
|
9
|
-
## Setup
|
10
|
-
|
11
|
-
1. Copy `.env.example` to `.env` and fill in your keys:
|
@@ -1,193 +0,0 @@
|
|
1
|
-
from os import getenv
|
2
|
-
from pathlib import Path
|
3
|
-
from typing import List, Tuple
|
4
|
-
|
5
|
-
import httpx
|
6
|
-
from dotenv import load_dotenv
|
7
|
-
from phi.agent import Agent # type: ignore
|
8
|
-
from phi.model.openai import OpenAIChat # type: ignore
|
9
|
-
|
10
|
-
from agentstr.marketplace import (
|
11
|
-
Merchant,
|
12
|
-
MerchantProduct,
|
13
|
-
MerchantStall,
|
14
|
-
Profile,
|
15
|
-
ShippingCost,
|
16
|
-
ShippingMethod,
|
17
|
-
)
|
18
|
-
|
19
|
-
load_dotenv()
|
20
|
-
|
21
|
-
RELAY = "wss://relay.damus.io"
|
22
|
-
|
23
|
-
# --*-- Merchant info
|
24
|
-
MERCHANT_NAME = "Merchant 1"
|
25
|
-
MERCHANT_DESCRIPTION = "Selling products peer to peer"
|
26
|
-
MERCHANT_PICTURE = "https://i.nostr.build/ocjZ5GlAKwrvgRhx.png"
|
27
|
-
|
28
|
-
# --*-- Stall info
|
29
|
-
STALL_1_NAME = "The Hardware Store"
|
30
|
-
STALL_1_ID = "212au4Pi" # "212a26qV"
|
31
|
-
STALL_1_DESCRIPTION = "Your neighborhood hardware store, now available online."
|
32
|
-
STALL_1_CURRENCY = "Sats"
|
33
|
-
|
34
|
-
STALL_2_NAME = "The Trade School"
|
35
|
-
STALL_2_ID = "c8762EFD"
|
36
|
-
STALL_2_DESCRIPTION = (
|
37
|
-
"Educational videos to put all your hardware supplies to good use."
|
38
|
-
)
|
39
|
-
STALL_2_CURRENCY = "Sats"
|
40
|
-
|
41
|
-
# --*-- Shipping info
|
42
|
-
SHIPPING_ZONE_1_NAME = "North America"
|
43
|
-
SHIPPING_ZONE_1_ID = "64be11rM"
|
44
|
-
SHIPPING_ZONE_1_REGIONS = ["Canada", "Mexico", "USA"]
|
45
|
-
|
46
|
-
SHIPPING_ZONE_2_NAME = "Rest of the World"
|
47
|
-
SHIPPING_ZONE_2_ID = "d041HK7s"
|
48
|
-
SHIPPING_ZONE_2_REGIONS = ["All other countries"]
|
49
|
-
|
50
|
-
SHIPPING_ZONE_3_NAME = "Worldwide"
|
51
|
-
SHIPPING_ZONE_3_ID = "R8Gzz96K"
|
52
|
-
SHIPPING_ZONE_3_REGIONS = ["Worldwide"]
|
53
|
-
|
54
|
-
# --*-- Product info
|
55
|
-
PRODUCT_1_NAME = "Wrench"
|
56
|
-
PRODUCT_1_ID = "bcf00Rx7"
|
57
|
-
PRODUCT_1_DESCRIPTION = "The perfect tool for a $5 wrench attack."
|
58
|
-
PRODUCT_1_IMAGES = ["https://i.nostr.build/BddyYILz0rjv1wEY.png"]
|
59
|
-
PRODUCT_1_CURRENCY = STALL_1_CURRENCY
|
60
|
-
PRODUCT_1_PRICE = 5000
|
61
|
-
PRODUCT_1_QUANTITY = 100
|
62
|
-
|
63
|
-
PRODUCT_2_NAME = "Shovel"
|
64
|
-
PRODUCT_2_ID = "bcf00Rx8"
|
65
|
-
PRODUCT_2_DESCRIPTION = "Dig holes like never before"
|
66
|
-
PRODUCT_2_IMAGES = ["https://i.nostr.build/psL0ZtN4FZcmeiIh.png"]
|
67
|
-
PRODUCT_2_CURRENCY = STALL_1_CURRENCY
|
68
|
-
PRODUCT_2_PRICE = 10000
|
69
|
-
PRODUCT_2_QUANTITY = 10
|
70
|
-
|
71
|
-
PRODUCT_3_NAME = "Shovel 101"
|
72
|
-
PRODUCT_3_ID = "ccf00Rx1"
|
73
|
-
PRODUCT_3_DESCRIPTION = "How to dig your own grave"
|
74
|
-
PRODUCT_3_IMAGES = ["https://i.nostr.build/psL0ZtN4FZcmeiIh.png"]
|
75
|
-
PRODUCT_3_CURRENCY = STALL_2_CURRENCY
|
76
|
-
PRODUCT_3_PRICE = 1000
|
77
|
-
PRODUCT_3_QUANTITY = 1000
|
78
|
-
|
79
|
-
# --*-- Define Shipping methods for stalls (nostr SDK type)
|
80
|
-
shipping_method_1 = (
|
81
|
-
ShippingMethod(id=SHIPPING_ZONE_1_ID, cost=5000)
|
82
|
-
.name(SHIPPING_ZONE_1_NAME)
|
83
|
-
.regions(SHIPPING_ZONE_1_REGIONS)
|
84
|
-
)
|
85
|
-
|
86
|
-
shipping_method_2 = (
|
87
|
-
ShippingMethod(id=SHIPPING_ZONE_2_ID, cost=5000)
|
88
|
-
.name(SHIPPING_ZONE_2_NAME)
|
89
|
-
.regions(SHIPPING_ZONE_2_REGIONS)
|
90
|
-
)
|
91
|
-
|
92
|
-
shipping_method_3 = (
|
93
|
-
ShippingMethod(id=SHIPPING_ZONE_3_ID, cost=0)
|
94
|
-
.name(SHIPPING_ZONE_3_NAME)
|
95
|
-
.regions(SHIPPING_ZONE_3_REGIONS)
|
96
|
-
)
|
97
|
-
|
98
|
-
# --*-- Define Shipping costs for products (nostr SDK type)
|
99
|
-
shipping_cost_1 = ShippingCost(id=SHIPPING_ZONE_1_ID, cost=1000)
|
100
|
-
shipping_cost_2 = ShippingCost(id=SHIPPING_ZONE_2_ID, cost=2000)
|
101
|
-
shipping_cost_3 = ShippingCost(id=SHIPPING_ZONE_3_ID, cost=3000)
|
102
|
-
|
103
|
-
# --*-- define stalls (using ShippingMethod)
|
104
|
-
test_stall_1 = MerchantStall(
|
105
|
-
id=STALL_1_ID,
|
106
|
-
name=STALL_1_NAME,
|
107
|
-
description=STALL_1_DESCRIPTION,
|
108
|
-
currency=STALL_1_CURRENCY,
|
109
|
-
shipping=[shipping_method_1, shipping_method_2],
|
110
|
-
)
|
111
|
-
|
112
|
-
test_stall_2 = MerchantStall(
|
113
|
-
id=STALL_2_ID,
|
114
|
-
name=STALL_2_NAME,
|
115
|
-
description=STALL_2_DESCRIPTION,
|
116
|
-
currency=STALL_2_CURRENCY,
|
117
|
-
shipping=[shipping_method_3], # Uses ShippingMethod
|
118
|
-
)
|
119
|
-
|
120
|
-
# --*-- define products (using ShippingZone)
|
121
|
-
test_product_1 = MerchantProduct(
|
122
|
-
id=PRODUCT_1_ID,
|
123
|
-
stall_id=STALL_1_ID,
|
124
|
-
name=PRODUCT_1_NAME,
|
125
|
-
description=PRODUCT_1_DESCRIPTION,
|
126
|
-
images=PRODUCT_1_IMAGES,
|
127
|
-
currency=PRODUCT_1_CURRENCY,
|
128
|
-
price=PRODUCT_1_PRICE,
|
129
|
-
quantity=PRODUCT_1_QUANTITY,
|
130
|
-
shipping=[shipping_cost_1, shipping_cost_2],
|
131
|
-
categories=None,
|
132
|
-
specs=[], # List of lists of strings, e.g. [["Color", "Red"], ["Size", "Large"]]
|
133
|
-
)
|
134
|
-
|
135
|
-
test_product_2 = MerchantProduct(
|
136
|
-
id=PRODUCT_2_ID,
|
137
|
-
stall_id=STALL_1_ID,
|
138
|
-
name=PRODUCT_2_NAME,
|
139
|
-
description=PRODUCT_2_DESCRIPTION,
|
140
|
-
images=PRODUCT_2_IMAGES,
|
141
|
-
currency=PRODUCT_2_CURRENCY,
|
142
|
-
price=PRODUCT_2_PRICE,
|
143
|
-
quantity=PRODUCT_2_QUANTITY,
|
144
|
-
shipping=[shipping_cost_1, shipping_cost_2],
|
145
|
-
categories=None,
|
146
|
-
specs=[], # List of lists of strings
|
147
|
-
)
|
148
|
-
|
149
|
-
test_product_3 = MerchantProduct(
|
150
|
-
id=PRODUCT_3_ID,
|
151
|
-
stall_id=STALL_2_ID,
|
152
|
-
name=PRODUCT_3_NAME,
|
153
|
-
description=PRODUCT_3_DESCRIPTION,
|
154
|
-
images=PRODUCT_3_IMAGES,
|
155
|
-
currency=PRODUCT_3_CURRENCY,
|
156
|
-
price=PRODUCT_3_PRICE,
|
157
|
-
quantity=PRODUCT_3_QUANTITY,
|
158
|
-
shipping=[shipping_cost_3],
|
159
|
-
categories=None,
|
160
|
-
specs=[], # List of lists of strings
|
161
|
-
)
|
162
|
-
|
163
|
-
nsec = getenv("NSEC_BASIC_CLI_KEY")
|
164
|
-
if nsec:
|
165
|
-
print(f"nsec: {nsec}")
|
166
|
-
else:
|
167
|
-
print(f"No NSEC found")
|
168
|
-
|
169
|
-
|
170
|
-
test_merchant = Profile(MERCHANT_NAME, MERCHANT_DESCRIPTION, MERCHANT_PICTURE, nsec)
|
171
|
-
|
172
|
-
|
173
|
-
agent = Agent( # type: ignore[call-arg]
|
174
|
-
name="Merchant Assistant",
|
175
|
-
model=OpenAIChat(id="gpt-4o"),
|
176
|
-
tools=[
|
177
|
-
Merchant(
|
178
|
-
merchant_profile=test_merchant,
|
179
|
-
relay=RELAY,
|
180
|
-
stalls=[test_stall_1, test_stall_2],
|
181
|
-
products=[test_product_1, test_product_2, test_product_3],
|
182
|
-
)
|
183
|
-
],
|
184
|
-
show_tool_calls=True,
|
185
|
-
debug_mode=True,
|
186
|
-
async_mode=True,
|
187
|
-
instructions=[
|
188
|
-
"The Merchant Toolkit functions return JSON arrays. Provide these JSON arrays back to the console as output."
|
189
|
-
],
|
190
|
-
)
|
191
|
-
|
192
|
-
# agent.print_response("List the products of the merchant")
|
193
|
-
agent.cli_app(stream=False)
|
agentstr-0.1.10.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
agentstr/__init__.py,sha256=bPXCN4fDtqII9UtDCwhWhkR6bi1LR4w0rR0vGeKPNoI,567
|
2
|
-
agentstr/marketplace.py,sha256=CavX0WQaCiz1sQhVs-PaHZ4YYUdcabW5V5eXrhtbT5A,40406
|
3
|
-
agentstr/nostr.py,sha256=PId6477VuShPq7nKgansgyJhJNNy9S8ycCf_3niizg4,11242
|
4
|
-
agentstr/examples/basic_cli/.env.example,sha256=yt6kWhUgnV2wlDlilpiOIZDdJtYL_QVhtbCGl7EG58c,76
|
5
|
-
agentstr/examples/basic_cli/README.md,sha256=ibZ1LMOZj1BGjtDxxhTLvHwbG-H6NqfobP_zPCJoYZM,310
|
6
|
-
agentstr/examples/basic_cli/main.py,sha256=Jgzvk0ep1zFHbDns5SQzJQvDMTQqBuRdsFSkfqEc5S8,5418
|
7
|
-
agentstr-0.1.10.dist-info/LICENSE,sha256=20H0yoEDN5XO1xPXyZCyJjvSTP0YiarRMKWPfiaBhQY,1063
|
8
|
-
agentstr-0.1.10.dist-info/METADATA,sha256=3XSiQurtRGtTWnXvrYqdZQpXu0ry7yF0_Rot6SdfWg0,4792
|
9
|
-
agentstr-0.1.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
10
|
-
agentstr-0.1.10.dist-info/top_level.txt,sha256=KZObFRHppZvKUGYB_m9w5HhLwps7jj7w6Xrw73dH2ss,9
|
11
|
-
agentstr-0.1.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|