sirenic-agents 0.1.0__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.
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: sirenic-agents
3
+ Version: 0.1.0
4
+ Summary: LangChain and CrewAI tools for Sirenic - official French & European company data, paid per call via x402 (USDC/EURC on Base). No account, no API key.
5
+ License: MIT
6
+ Project-URL: Homepage, https://api.sirenic.eu
7
+ Project-URL: Repository, https://github.com/sirenic-eu/sirenic-examples
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: requests>=2.31
11
+ Provides-Extra: pay
12
+ Requires-Dist: x402[evm,requests]<3,>=2.16; extra == "pay"
13
+ Provides-Extra: langchain
14
+ Requires-Dist: langchain-core<2,>=1; extra == "langchain"
15
+ Provides-Extra: crewai
16
+ Requires-Dist: crewai>=1.15; extra == "crewai"
17
+
18
+ # sirenic-agents (Python) — LangChain & CrewAI tools for Sirenic
19
+
20
+ Official French & European company data in your agent, paid per call via
21
+ [x402](https://x402.org) (USDC or EURC on Base). **No account, no API key** —
22
+ bring a wallet key and a price cap. Without a wallet, every tool still works
23
+ and returns the payment quote.
24
+
25
+ ```bash
26
+ pip install "sirenic-agents[pay,langchain] @ git+https://github.com/sirenic-eu/sirenic-examples#subdirectory=sdk/python"
27
+ # (PyPI publication coming — same package name)
28
+ ```
29
+
30
+ ## LangChain
31
+
32
+ ```python
33
+ from sirenic_agents import SirenicClient, build_langchain_tools
34
+
35
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
36
+ tools = build_langchain_tools(client) # search, profile, KYB, sanctions, intelligence, watchlists…
37
+ ```
38
+
39
+ ## CrewAI
40
+
41
+ ```python
42
+ from sirenic_agents import SirenicClient, build_crewai_tools
43
+
44
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
45
+ agent = Agent(role="KYB analyst", tools=build_crewai_tools(client), ...)
46
+ ```
47
+
48
+ CrewAI also speaks MCP natively — all 38 Sirenic tools in one line, no SDK:
49
+
50
+ ```python
51
+ agent = Agent(role="KYB analyst", mcps=["https://api.sirenic.eu/mcp"], ...)
52
+ ```
53
+
54
+ (The curated tools above add automatic x402 payment with a hard price cap;
55
+ via MCP, tools return quotes that your agent settles itself.)
56
+
57
+ Safety model: payments are EIP-3009 authorizations signed locally by the
58
+ official [`x402`](https://pypi.org/project/x402/) package (x402 Foundation);
59
+ the `max_amount` policy filters every quote before signing; errors are never
60
+ charged. Paid responses are Ed25519-signed by the server
61
+ ([verify](https://api.sirenic.eu/.well-known/sirenic-signing-key)).
@@ -0,0 +1,44 @@
1
+ # sirenic-agents (Python) — LangChain & CrewAI tools for Sirenic
2
+
3
+ Official French & European company data in your agent, paid per call via
4
+ [x402](https://x402.org) (USDC or EURC on Base). **No account, no API key** —
5
+ bring a wallet key and a price cap. Without a wallet, every tool still works
6
+ and returns the payment quote.
7
+
8
+ ```bash
9
+ pip install "sirenic-agents[pay,langchain] @ git+https://github.com/sirenic-eu/sirenic-examples#subdirectory=sdk/python"
10
+ # (PyPI publication coming — same package name)
11
+ ```
12
+
13
+ ## LangChain
14
+
15
+ ```python
16
+ from sirenic_agents import SirenicClient, build_langchain_tools
17
+
18
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
19
+ tools = build_langchain_tools(client) # search, profile, KYB, sanctions, intelligence, watchlists…
20
+ ```
21
+
22
+ ## CrewAI
23
+
24
+ ```python
25
+ from sirenic_agents import SirenicClient, build_crewai_tools
26
+
27
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
28
+ agent = Agent(role="KYB analyst", tools=build_crewai_tools(client), ...)
29
+ ```
30
+
31
+ CrewAI also speaks MCP natively — all 38 Sirenic tools in one line, no SDK:
32
+
33
+ ```python
34
+ agent = Agent(role="KYB analyst", mcps=["https://api.sirenic.eu/mcp"], ...)
35
+ ```
36
+
37
+ (The curated tools above add automatic x402 payment with a hard price cap;
38
+ via MCP, tools return quotes that your agent settles itself.)
39
+
40
+ Safety model: payments are EIP-3009 authorizations signed locally by the
41
+ official [`x402`](https://pypi.org/project/x402/) package (x402 Foundation);
42
+ the `max_amount` policy filters every quote before signing; errors are never
43
+ charged. Paid responses are Ed25519-signed by the server
44
+ ([verify](https://api.sirenic.eu/.well-known/sirenic-signing-key)).
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sirenic-agents"
7
+ version = "0.1.0"
8
+ description = "LangChain and CrewAI tools for Sirenic - official French & European company data, paid per call via x402 (USDC/EURC on Base). No account, no API key."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ dependencies = [
13
+ "requests>=2.31",
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ # Payment support (quote-only mode works without it).
18
+ pay = ["x402[requests,evm]>=2.16,<3"]
19
+ langchain = ["langchain-core>=1,<2"]
20
+ crewai = ["crewai>=1.15"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://api.sirenic.eu"
24
+ Repository = "https://github.com/sirenic-eu/sirenic-examples"
25
+
26
+ [tool.setuptools]
27
+ packages = ["sirenic_agents"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,227 @@
1
+ """Sirenic for Python agents (LangChain, CrewAI).
2
+
3
+ Official French & European company data, paid per call via x402 (USDC or
4
+ EURC on Base). No account, no API key: bring a wallet key and a price cap.
5
+ Without a wallet the client still works and returns the x402 quote (handy
6
+ for discovery and dry runs). The server never sees your key: payments are
7
+ EIP-3009 authorizations signed locally (official ``x402`` package).
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import re
14
+ from typing import Any, Optional
15
+
16
+ import requests
17
+ from urllib.parse import urlencode
18
+
19
+ __all__ = ["SirenicClient", "build_langchain_tools", "build_crewai_tools"]
20
+
21
+ _USDC_DECIMALS = 6
22
+ _CHEMIN_AUTORISE = re.compile(r"^/(v1|preview)/")
23
+
24
+
25
+ class SirenicClient:
26
+ """Paying HTTP client for api.sirenic.eu.
27
+
28
+ :param wallet_key: EVM private key (``0x...``) of YOUR paying wallet.
29
+ Omit for quote-only mode (every call returns the x402 quote).
30
+ :param max_price_usd: hard per-call cap (default 1.0 — the most
31
+ expensive Sirenic call). Quotes above the cap are never signed.
32
+ :param base_url: default ``https://api.sirenic.eu``.
33
+ """
34
+
35
+ def __init__(
36
+ self,
37
+ wallet_key: Optional[str] = None,
38
+ max_price_usd: float = 1.0,
39
+ base_url: str = "https://api.sirenic.eu",
40
+ ) -> None:
41
+ self.base_url = base_url.rstrip("/")
42
+ if wallet_key:
43
+ # Official x402 Foundation client: 402 -> select <= cap -> sign
44
+ # EIP-3009 -> retry, all automatic. Import here so quote-only
45
+ # users do not need the payment extras.
46
+ from eth_account import Account
47
+ from x402 import max_amount, x402ClientSync
48
+ from x402.http.clients.requests import x402_requests
49
+ from x402.mechanisms.evm import EthAccountSigner
50
+ from x402.mechanisms.evm.exact import ExactEvmScheme
51
+
52
+ client = x402ClientSync()
53
+ client.register("eip155:*", ExactEvmScheme(signer=EthAccountSigner(Account.from_key(wallet_key))))
54
+ client.register_policy(max_amount(int(round(max_price_usd * 10**_USDC_DECIMALS))))
55
+ self._session: requests.Session = x402_requests(client)
56
+ else:
57
+ self._session = requests.Session()
58
+
59
+ def get(self, path: str) -> str:
60
+ """GET a Sirenic path (e.g. ``/v1/recherche?q=danone``), paying if
61
+ needed. Always returns a JSON string (data, quote, or error)."""
62
+ if not _CHEMIN_AUTORISE.match(path):
63
+ return json.dumps({"error": "invalid_path", "message": "Only /v1/... and /preview/... paths are served."})
64
+ try:
65
+ reponse = self._session.get(
66
+ f"{self.base_url}{path}", headers={"Accept": "application/json"}, timeout=120
67
+ )
68
+ except Exception as erreur: # panne réseau OU refus de plafond
69
+ return json.dumps(
70
+ {
71
+ "error": "payment_refused_or_network",
72
+ "message": str(erreur)[:300],
73
+ "hint": "If this is a price-cap refusal, raise max_price_usd or call a cheaper endpoint.",
74
+ }
75
+ )
76
+ try:
77
+ corps: Any = reponse.json()
78
+ except ValueError:
79
+ corps = {}
80
+ if reponse.status_code == 402:
81
+ return json.dumps(
82
+ {
83
+ "payment_required": True,
84
+ "hint": "No wallet configured (or quote above your price cap). Provide wallet_key to pay automatically.",
85
+ "quote": corps,
86
+ }
87
+ )
88
+ if not reponse.ok:
89
+ return json.dumps({"error": "http_error", "status": reponse.status_code, "body": corps})
90
+ return json.dumps(corps)
91
+
92
+
93
+ def build_langchain_tools(client: SirenicClient) -> list:
94
+ """LangChain tools (langchain-core >= 1). ``pip install sirenic-agents[langchain]``."""
95
+ from langchain_core.tools import StructuredTool
96
+ from pydantic import BaseModel, Field
97
+
98
+ class Recherche(BaseModel):
99
+ q: str = Field(description="Company name or 9-digit SIREN")
100
+
101
+ class Siren(BaseModel):
102
+ siren: str = Field(description="9-digit SIREN of the French company", pattern=r"^\d{9}$")
103
+
104
+ class Criblage(BaseModel):
105
+ name: str = Field(description="Person or company name to screen")
106
+ birth_year: Optional[str] = Field(default=None, description="Optional birth year (YYYY)")
107
+
108
+ class Chemin(BaseModel):
109
+ path: str = Field(description="Sirenic path with query string, e.g. /v1/entreprise/552032534/lobbying")
110
+
111
+ class Watch(BaseModel):
112
+ cibles: str = Field(description="Comma-separated targets: SIRENs and/or dirigeant:Name (1-100)")
113
+ webhook: Optional[str] = Field(default=None, description="Public https URL for signed event batches")
114
+ email: Optional[str] = Field(default=None, description="E-mail for digests")
115
+
116
+ def _watch(cibles: str, webhook: Optional[str] = None, email: Optional[str] = None) -> str:
117
+ params = [("cibles", cibles)]
118
+ if webhook:
119
+ params.append(("webhook", webhook))
120
+ if email:
121
+ params.append(("email", email))
122
+ return client.get("/v1/surveillance/creer?" + urlencode(params))
123
+
124
+ def _criblage(name: str, birth_year: Optional[str] = None) -> str:
125
+ params = [("name", name)] + ([("birth_year", birth_year)] if birth_year else [])
126
+ return client.get("/v1/sanctions/check?" + urlencode(params))
127
+
128
+ return [
129
+ StructuredTool.from_function(
130
+ func=lambda q: client.get("/v1/recherche?" + urlencode([("q", q)])),
131
+ name="sirenic_search_companies",
132
+ description="Search 30M French companies by name or SIREN (official INSEE/INPI data), top 10 with confidence scores. Price: $0.001.",
133
+ args_schema=Recherche,
134
+ ),
135
+ StructuredTool.from_function(
136
+ func=lambda siren: client.get(f"/v1/entreprise/{siren}"),
137
+ name="sirenic_company_profile",
138
+ description="Full official profile of a French company (legal form, head office, officers, VAT...). Price: $0.005.",
139
+ args_schema=Siren,
140
+ ),
141
+ StructuredTool.from_function(
142
+ func=lambda siren: client.get(f"/v1/kyb/{siren}"),
143
+ name="sirenic_kyb_file",
144
+ description="Complete KYB file: identity, officers, legal alerts, financials, sanctions screening (6 lists). Price: $0.15.",
145
+ args_schema=Siren,
146
+ ),
147
+ StructuredTool.from_function(
148
+ func=_criblage,
149
+ name="sirenic_screen_sanctions",
150
+ description="Screen a name against 6 official sanctions lists (UN, EU, OFAC, UK, FR, SECO), scored matches. Price: $0.02.",
151
+ args_schema=Criblage,
152
+ ),
153
+ StructuredTool.from_function(
154
+ func=lambda siren: client.get(f"/v1/intelligence/{siren}"),
155
+ name="sirenic_company_intelligence",
156
+ description="Flagship due-diligence report: every block cross-referenced, closed-list signals, deterministic verdict, Ed25519-signed. Price: $1.00.",
157
+ args_schema=Siren,
158
+ ),
159
+ StructuredTool.from_function(
160
+ func=_watch,
161
+ name="sirenic_create_watch",
162
+ description="Create a 30-day watchlist (daily checks, signed webhooks/e-mail). Targets: SIRENs and/or dirigeant:Name. Price: $0.05 per target per 30 days.",
163
+ args_schema=Watch,
164
+ ),
165
+ StructuredTool.from_function(
166
+ func=lambda path: client.get(path),
167
+ name="sirenic_get",
168
+ description="Call ANY other Sirenic endpoint by path — catalog and prices: https://api.sirenic.eu/llms.txt. Free sample: /preview/entreprise/55203253400646.",
169
+ args_schema=Chemin,
170
+ ),
171
+ ]
172
+
173
+
174
+ def build_crewai_tools(client: SirenicClient) -> list:
175
+ """CrewAI tools (crewai >= 1.15). ``pip install sirenic-agents[crewai]``.
176
+
177
+ Tip: CrewAI also speaks MCP natively — ``Agent(..., mcps=["https://api.sirenic.eu/mcp"])``
178
+ exposes all 38 Sirenic tools in one line; these curated tools add the
179
+ automatic x402 payment with a price cap.
180
+ """
181
+ from typing import Type
182
+
183
+ from crewai.tools import BaseTool
184
+ from pydantic import BaseModel, Field
185
+
186
+ class Recherche(BaseModel):
187
+ q: str = Field(description="Company name or 9-digit SIREN")
188
+
189
+ class Siren(BaseModel):
190
+ siren: str = Field(description="9-digit SIREN", pattern=r"^\d{9}$")
191
+
192
+ class Chemin(BaseModel):
193
+ path: str = Field(description="Sirenic path with query string")
194
+
195
+ class OutilRecherche(BaseTool):
196
+ name: str = "Sirenic company search"
197
+ description: str = "Search 30M French companies by name or SIREN (official data), scored matches. Price: $0.001."
198
+ args_schema: Type[BaseModel] = Recherche
199
+
200
+ def _run(self, q: str) -> str:
201
+ return client.get("/v1/recherche?" + urlencode([("q", q)]))
202
+
203
+ class OutilKyb(BaseTool):
204
+ name: str = "Sirenic KYB file"
205
+ description: str = "Complete KYB file: identity, officers, legal alerts, financials, sanctions screening. Price: $0.15."
206
+ args_schema: Type[BaseModel] = Siren
207
+
208
+ def _run(self, siren: str) -> str:
209
+ return client.get(f"/v1/kyb/{siren}")
210
+
211
+ class OutilIntelligence(BaseTool):
212
+ name: str = "Sirenic intelligence report"
213
+ description: str = "Flagship due-diligence report with deterministic verdict, Ed25519-signed. Price: $1.00."
214
+ args_schema: Type[BaseModel] = Siren
215
+
216
+ def _run(self, siren: str) -> str:
217
+ return client.get(f"/v1/intelligence/{siren}")
218
+
219
+ class OutilGenerique(BaseTool):
220
+ name: str = "Sirenic API call"
221
+ description: str = "Call ANY Sirenic endpoint by path — catalog and prices: https://api.sirenic.eu/llms.txt."
222
+ args_schema: Type[BaseModel] = Chemin
223
+
224
+ def _run(self, path: str) -> str:
225
+ return client.get(path)
226
+
227
+ return [OutilRecherche(), OutilKyb(), OutilIntelligence(), OutilGenerique()]
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: sirenic-agents
3
+ Version: 0.1.0
4
+ Summary: LangChain and CrewAI tools for Sirenic - official French & European company data, paid per call via x402 (USDC/EURC on Base). No account, no API key.
5
+ License: MIT
6
+ Project-URL: Homepage, https://api.sirenic.eu
7
+ Project-URL: Repository, https://github.com/sirenic-eu/sirenic-examples
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: requests>=2.31
11
+ Provides-Extra: pay
12
+ Requires-Dist: x402[evm,requests]<3,>=2.16; extra == "pay"
13
+ Provides-Extra: langchain
14
+ Requires-Dist: langchain-core<2,>=1; extra == "langchain"
15
+ Provides-Extra: crewai
16
+ Requires-Dist: crewai>=1.15; extra == "crewai"
17
+
18
+ # sirenic-agents (Python) — LangChain & CrewAI tools for Sirenic
19
+
20
+ Official French & European company data in your agent, paid per call via
21
+ [x402](https://x402.org) (USDC or EURC on Base). **No account, no API key** —
22
+ bring a wallet key and a price cap. Without a wallet, every tool still works
23
+ and returns the payment quote.
24
+
25
+ ```bash
26
+ pip install "sirenic-agents[pay,langchain] @ git+https://github.com/sirenic-eu/sirenic-examples#subdirectory=sdk/python"
27
+ # (PyPI publication coming — same package name)
28
+ ```
29
+
30
+ ## LangChain
31
+
32
+ ```python
33
+ from sirenic_agents import SirenicClient, build_langchain_tools
34
+
35
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
36
+ tools = build_langchain_tools(client) # search, profile, KYB, sanctions, intelligence, watchlists…
37
+ ```
38
+
39
+ ## CrewAI
40
+
41
+ ```python
42
+ from sirenic_agents import SirenicClient, build_crewai_tools
43
+
44
+ client = SirenicClient(wallet_key=os.environ["WALLET_KEY"], max_price_usd=0.25)
45
+ agent = Agent(role="KYB analyst", tools=build_crewai_tools(client), ...)
46
+ ```
47
+
48
+ CrewAI also speaks MCP natively — all 38 Sirenic tools in one line, no SDK:
49
+
50
+ ```python
51
+ agent = Agent(role="KYB analyst", mcps=["https://api.sirenic.eu/mcp"], ...)
52
+ ```
53
+
54
+ (The curated tools above add automatic x402 payment with a hard price cap;
55
+ via MCP, tools return quotes that your agent settles itself.)
56
+
57
+ Safety model: payments are EIP-3009 authorizations signed locally by the
58
+ official [`x402`](https://pypi.org/project/x402/) package (x402 Foundation);
59
+ the `max_amount` policy filters every quote before signing; errors are never
60
+ charged. Paid responses are Ed25519-signed by the server
61
+ ([verify](https://api.sirenic.eu/.well-known/sirenic-signing-key)).
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ sirenic_agents/__init__.py
4
+ sirenic_agents.egg-info/PKG-INFO
5
+ sirenic_agents.egg-info/SOURCES.txt
6
+ sirenic_agents.egg-info/dependency_links.txt
7
+ sirenic_agents.egg-info/requires.txt
8
+ sirenic_agents.egg-info/top_level.txt
@@ -0,0 +1,10 @@
1
+ requests>=2.31
2
+
3
+ [crewai]
4
+ crewai>=1.15
5
+
6
+ [langchain]
7
+ langchain-core<2,>=1
8
+
9
+ [pay]
10
+ x402[evm,requests]<3,>=2.16
@@ -0,0 +1 @@
1
+ sirenic_agents