agentstr 0.1.11__py3-none-any.whl → 0.1.13__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- agentstr/__init__.py +36 -17
- agentstr/buyer.py +305 -0
- agentstr/buyer.pyi +32 -0
- agentstr/{marketplace.py → merchant.py} +167 -355
- agentstr/merchant.pyi +37 -0
- agentstr/models.py +380 -0
- agentstr/models.pyi +103 -0
- agentstr/nostr.py +412 -79
- agentstr/nostr.pyi +96 -0
- agentstr/py.typed +0 -0
- {agentstr-0.1.11.dist-info → agentstr-0.1.13.dist-info}/METADATA +42 -56
- agentstr-0.1.13.dist-info/RECORD +15 -0
- agentstr-0.1.11.dist-info/RECORD +0 -8
- {agentstr-0.1.11.dist-info → agentstr-0.1.13.dist-info}/LICENSE +0 -0
- {agentstr-0.1.11.dist-info → agentstr-0.1.13.dist-info}/WHEEL +0 -0
- {agentstr-0.1.11.dist-info → agentstr-0.1.13.dist-info}/top_level.txt +0 -0
agentstr/nostr.pyi
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
"""
|
2
|
+
Type stubs for the Nostr module.
|
3
|
+
|
4
|
+
This file provides type annotations for the Nostr module, enabling better
|
5
|
+
type checking and autocompletion in IDEs. It defines the expected types
|
6
|
+
for classes, functions, and variables used within the Nostr module.
|
7
|
+
|
8
|
+
Note: This is a type stub file and does not contain any executable code.
|
9
|
+
"""
|
10
|
+
|
11
|
+
from logging import Logger
|
12
|
+
from pathlib import Path
|
13
|
+
from typing import ClassVar, List, Optional
|
14
|
+
|
15
|
+
from nostr_sdk import ( # type: ignore
|
16
|
+
Client,
|
17
|
+
Event,
|
18
|
+
EventBuilder,
|
19
|
+
EventId,
|
20
|
+
Events,
|
21
|
+
Keys,
|
22
|
+
Kind,
|
23
|
+
Metadata,
|
24
|
+
NostrSigner,
|
25
|
+
ProductData,
|
26
|
+
PublicKey,
|
27
|
+
ShippingCost,
|
28
|
+
ShippingMethod,
|
29
|
+
StallData,
|
30
|
+
Timestamp,
|
31
|
+
)
|
32
|
+
|
33
|
+
from agentstr.models import MerchantProduct, MerchantStall, NostrProfile
|
34
|
+
|
35
|
+
# Re-export all needed types
|
36
|
+
__all__ = [
|
37
|
+
"Event",
|
38
|
+
"EventBuilder",
|
39
|
+
"Events",
|
40
|
+
"EventId",
|
41
|
+
"Keys",
|
42
|
+
"Kind",
|
43
|
+
"Metadata",
|
44
|
+
"ProductData",
|
45
|
+
"PublicKey",
|
46
|
+
"ShippingCost",
|
47
|
+
"ShippingMethod",
|
48
|
+
"StallData",
|
49
|
+
"Timestamp",
|
50
|
+
]
|
51
|
+
|
52
|
+
class NostrClient:
|
53
|
+
"""
|
54
|
+
NostrClient implements the set of Nostr utilities required for higher level functions
|
55
|
+
implementations like the Marketplace.
|
56
|
+
"""
|
57
|
+
|
58
|
+
logger: ClassVar[Logger]
|
59
|
+
relay: str
|
60
|
+
keys: Keys
|
61
|
+
nostr_signer: NostrSigner
|
62
|
+
client: Client
|
63
|
+
|
64
|
+
def __init__(self, relay: str, nsec: str) -> None: ...
|
65
|
+
def delete_event(
|
66
|
+
self, event_id: EventId, reason: Optional[str] = None
|
67
|
+
) -> EventId: ...
|
68
|
+
def publish_event(self, event_builder: EventBuilder) -> EventId: ...
|
69
|
+
def publish_note(self, text: str) -> EventId: ...
|
70
|
+
def publish_product(self, product: MerchantProduct) -> EventId: ...
|
71
|
+
def publish_profile(self, name: str, about: str, picture: str) -> EventId: ...
|
72
|
+
def publish_stall(self, stall: MerchantStall) -> EventId: ...
|
73
|
+
def retrieve_products_from_seller(
|
74
|
+
self, seller: PublicKey
|
75
|
+
) -> List[MerchantProduct]: ...
|
76
|
+
def retrieve_profile(self, public_key: PublicKey) -> NostrProfile: ...
|
77
|
+
def retrieve_stalls_from_seller(self, seller: PublicKey) -> List[StallData]: ...
|
78
|
+
def retrieve_sellers(self) -> set[NostrProfile]: ...
|
79
|
+
@classmethod
|
80
|
+
def set_logging_level(cls, logging_level: int) -> None: ...
|
81
|
+
async def _async_connect(self) -> None: ...
|
82
|
+
async def _async_publish_event(self, event_builder: EventBuilder) -> EventId: ...
|
83
|
+
async def _async_publish_note(self, text: str) -> EventId: ...
|
84
|
+
async def _async_publish_product(self, product: MerchantProduct) -> EventId: ...
|
85
|
+
async def _async_publish_profile(
|
86
|
+
self, name: str, about: str, picture: str
|
87
|
+
) -> EventId: ...
|
88
|
+
async def _async_publish_stall(self, stall: MerchantStall) -> EventId: ...
|
89
|
+
async def _async_retrieve_all_stalls(self) -> Events: ...
|
90
|
+
async def _async_retrieve_products_from_seller(
|
91
|
+
self, seller: PublicKey
|
92
|
+
) -> Events: ...
|
93
|
+
async def _async_retrieve_profile(self, author: PublicKey) -> NostrProfile: ...
|
94
|
+
async def _async_retrieve_stalls_from_seller(self, seller: PublicKey) -> Events: ...
|
95
|
+
|
96
|
+
def generate_and_save_keys(env_var: str, env_path: Optional[Path] = None) -> Keys: ...
|
agentstr/py.typed
ADDED
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: agentstr
|
3
|
-
Version: 0.1.
|
4
|
-
Summary:
|
5
|
-
Author-email: Synvya <
|
3
|
+
Version: 0.1.13
|
4
|
+
Summary: Tools for a Nostr agentic ecosystem
|
5
|
+
Author-email: Synvya <synvya@synvya.com>
|
6
6
|
License: MIT
|
7
7
|
Project-URL: Homepage, https://www.synvya.com
|
8
8
|
Project-URL: Repository, https://github.com/synvya/agentstr
|
@@ -11,21 +11,27 @@ Project-URL: BugTracker, https://github.com/synvya/agentstr/issues
|
|
11
11
|
Requires-Python: <3.13,>=3.9
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
|
-
Requires-Dist:
|
14
|
+
Requires-Dist: agno>=1.1.1
|
15
15
|
Requires-Dist: openai>=1.50.0
|
16
|
-
Requires-Dist:
|
17
|
-
Requires-Dist: nostr-sdk>=0.38.0
|
16
|
+
Requires-Dist: nostr_sdk>=0.39.0
|
18
17
|
Requires-Dist: pydantic>=2.0.0
|
19
18
|
Provides-Extra: dev
|
20
19
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
20
|
+
Requires-Dist: pytest-asyncio>=0.23.5; extra == "dev"
|
21
21
|
Requires-Dist: black>=23.0; extra == "dev"
|
22
22
|
Requires-Dist: isort>=5.0; extra == "dev"
|
23
23
|
Requires-Dist: mypy>=1.0; extra == "dev"
|
24
|
-
Requires-Dist:
|
24
|
+
Requires-Dist: pylint>=3.0; extra == "dev"
|
25
|
+
Provides-Extra: examples
|
26
|
+
Requires-Dist: python-dotenv>=1.0; extra == "examples"
|
27
|
+
Requires-Dist: cassandra-driver>=3.29.2; extra == "examples"
|
28
|
+
Requires-Dist: cassio>=0.1.10; extra == "examples"
|
29
|
+
Requires-Dist: fastapi>=0.110.0; extra == "examples"
|
30
|
+
Requires-Dist: uvicorn>=0.30.0; extra == "examples"
|
25
31
|
|
26
32
|
# AgentStr
|
27
33
|
|
28
|
-
AgentStr is an extension of [
|
34
|
+
AgentStr is an extension of [Agno](https://www.agno.ai) AI agents that enables peer-to-peer agent communication using the Nostr protocol.
|
29
35
|
|
30
36
|
## Overview
|
31
37
|
|
@@ -41,8 +47,15 @@ agentstr/
|
|
41
47
|
├── src/ # Source code
|
42
48
|
│ └── agentstr/
|
43
49
|
│ ├── __init__.py
|
44
|
-
│ ├──
|
45
|
-
│
|
50
|
+
│ ├── buyer.py
|
51
|
+
│ ├── buyer.pyi
|
52
|
+
│ ├── merchant.py
|
53
|
+
│ ├── merchant.pyi
|
54
|
+
│ ├── models.py
|
55
|
+
│ ├── models.pyi
|
56
|
+
│ ├── nostr.py
|
57
|
+
│ ├── nostr.pyi
|
58
|
+
│ └── py.typed
|
46
59
|
├── tests/ # Test files
|
47
60
|
├── docs/ # Documentation
|
48
61
|
├── examples/ # Example implementations
|
@@ -52,17 +65,19 @@ agentstr/
|
|
52
65
|
## Features
|
53
66
|
|
54
67
|
### Current Features
|
55
|
-
- Create Merchant agents with Nostr identities
|
56
|
-
- Publish and manage merchant products using [NIP-15](https://github.com/nostr-protocol/nips/blob/master/15.md) marketplace protocol
|
57
|
-
- Create merchant stalls to organize products
|
58
|
-
- Handle shipping zones and costs
|
59
|
-
- Secure communication using Nostr keys
|
68
|
+
- Create Merchant agents with Nostr identities:
|
69
|
+
- Publish and manage merchant products using [NIP-15](https://github.com/nostr-protocol/nips/blob/master/15.md) marketplace protocol
|
70
|
+
- Create merchant stalls to organize products
|
71
|
+
- Handle shipping zones and costs
|
72
|
+
- Secure communication using Nostr keys
|
73
|
+
- Create Buyer agents:
|
74
|
+
- Retrieve a list of sellers from the relay using [NIP-15](https://github.com/nostr-protocol/nips/blob/master/15.md) marketplace protocol
|
75
|
+
- Find an specific seller by name or public key
|
76
|
+
- Refresh the list of sellers from the relay
|
60
77
|
|
61
78
|
### Roadmap
|
62
79
|
- [ ] Create marketplace with stalls
|
63
|
-
- [ ]
|
64
|
-
- [ ] Enable merchants to define products
|
65
|
-
- [ ] Add customer toolkit for buyers
|
80
|
+
- [ ] Expand buyer agent to include more features
|
66
81
|
- [ ] Support additional Nostr NIPs
|
67
82
|
- [ ] Add more agent interaction patterns
|
68
83
|
|
@@ -82,46 +97,13 @@ pip install agentstr
|
|
82
97
|
|
83
98
|
You can find example code in the [examples](https://github.com/Synvya/agentstr/tree/main/examples/) directory.
|
84
99
|
|
85
|
-
|
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:
|
96
|
-
- Setting up merchant profiles
|
97
|
-
- Creating stalls with shipping methods
|
98
|
-
- Defining products with shipping costs
|
99
|
-
- Configuring the agent with the merchant toolkit
|
100
|
-
- Running an interactive CLI application
|
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
|
-
```
|
100
|
+
To install the examples clone the repository and navigate to the examples directory:
|
108
101
|
|
109
|
-
2. ** Install dependencies**
|
110
102
|
```bash
|
111
|
-
|
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
|
103
|
+
git clone https://github.com/Synvya/agentstr.git
|
104
|
+
cd agentstr/examples/
|
123
105
|
```
|
124
|
-
|
106
|
+
Each example has its own README with instructions on how to run it.
|
125
107
|
|
126
108
|
## Documentation
|
127
109
|
|
@@ -140,7 +122,11 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
140
122
|
|
141
123
|
## Acknowledgments
|
142
124
|
|
143
|
-
- [
|
125
|
+
- [Agno](https://www.agno.ai) - For their AI agent framework
|
144
126
|
- [Rust-Nostr](https://rust-nostr.org) - For their Python Nostr SDK
|
145
127
|
- [Nostr Protocol](https://github.com/nostr-protocol/nips) - For the protocol specification
|
146
128
|
|
129
|
+
This software includes the following software licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0):
|
130
|
+
- [DataStax Python Driver for Apache Cassandra](https://github.com/datastax/python-driver)
|
131
|
+
- [cassIO](https://github.com/CassioML/cassio). This library is not maintained anymore. We will need to replace it with a new library.
|
132
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
agentstr/__init__.py,sha256=rbFtFOldBSbeDX_8Xva3YHRC9c3nPFA9mJXS3UZhJ4s,1294
|
2
|
+
agentstr/buyer.py,sha256=I1tApMjlq0Bg5Qk7twcAbF2rf_L5I2L9qzQO5sKv2RE,9912
|
3
|
+
agentstr/buyer.pyi,sha256=AqdKa7nQWohxHaoKHjCNpOpDB6rsWGWAlASNhwEw45g,1219
|
4
|
+
agentstr/merchant.py,sha256=3Fz4hrxyb5m7Kk47RodNC-Vyjm9iV7bI4ncPF8EMkhw,35078
|
5
|
+
agentstr/merchant.pyi,sha256=mqak--H7D_b7o8JNQlQRmov2An-defyBGRJNhMNchXQ,1437
|
6
|
+
agentstr/models.py,sha256=lEoopEQYIqI0egVxoXhBLlBh35C0WQmR_oBKm5Sexwk,11423
|
7
|
+
agentstr/models.pyi,sha256=k1_D-afE17gybHhtQMqA6cx7H5lYh7Fg0gbXclxyP4A,2857
|
8
|
+
agentstr/nostr.py,sha256=u2jDwQDmg01UCThDy1WW9lOPvAHyI1WMbtxFFi_2q08,22703
|
9
|
+
agentstr/nostr.pyi,sha256=nlBdOOI6vPboACjBvrQZKHy3BtCjboaClG9ZVD2X8XQ,3118
|
10
|
+
agentstr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
agentstr-0.1.13.dist-info/LICENSE,sha256=20H0yoEDN5XO1xPXyZCyJjvSTP0YiarRMKWPfiaBhQY,1063
|
12
|
+
agentstr-0.1.13.dist-info/METADATA,sha256=JBXZQ5tw7lPrir_3TKkbYYXpLMqHlMofkfdwXKTP6Gk,4667
|
13
|
+
agentstr-0.1.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
14
|
+
agentstr-0.1.13.dist-info/top_level.txt,sha256=KZObFRHppZvKUGYB_m9w5HhLwps7jj7w6Xrw73dH2ss,9
|
15
|
+
agentstr-0.1.13.dist-info/RECORD,,
|
agentstr-0.1.11.dist-info/RECORD
DELETED
@@ -1,8 +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-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,,
|
File without changes
|
File without changes
|
File without changes
|