traia-iatp 0.1.29__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.

Potentially problematic release.


This version of traia-iatp might be problematic. Click here for more details.

Files changed (107) hide show
  1. traia_iatp/README.md +368 -0
  2. traia_iatp/__init__.py +54 -0
  3. traia_iatp/cli/__init__.py +5 -0
  4. traia_iatp/cli/main.py +483 -0
  5. traia_iatp/client/__init__.py +10 -0
  6. traia_iatp/client/a2a_client.py +274 -0
  7. traia_iatp/client/crewai_a2a_tools.py +335 -0
  8. traia_iatp/client/d402_a2a_client.py +293 -0
  9. traia_iatp/client/grpc_a2a_tools.py +349 -0
  10. traia_iatp/client/root_path_a2a_client.py +1 -0
  11. traia_iatp/contracts/__init__.py +12 -0
  12. traia_iatp/contracts/iatp_contracts_config.py +263 -0
  13. traia_iatp/contracts/wallet_creator.py +255 -0
  14. traia_iatp/core/__init__.py +43 -0
  15. traia_iatp/core/models.py +172 -0
  16. traia_iatp/d402/__init__.py +55 -0
  17. traia_iatp/d402/chains.py +102 -0
  18. traia_iatp/d402/client.py +150 -0
  19. traia_iatp/d402/clients/__init__.py +7 -0
  20. traia_iatp/d402/clients/base.py +218 -0
  21. traia_iatp/d402/clients/httpx.py +219 -0
  22. traia_iatp/d402/common.py +114 -0
  23. traia_iatp/d402/encoding.py +28 -0
  24. traia_iatp/d402/examples/client_example.py +197 -0
  25. traia_iatp/d402/examples/server_example.py +171 -0
  26. traia_iatp/d402/facilitator.py +453 -0
  27. traia_iatp/d402/fastapi_middleware/__init__.py +6 -0
  28. traia_iatp/d402/fastapi_middleware/middleware.py +225 -0
  29. traia_iatp/d402/fastmcp_middleware.py +147 -0
  30. traia_iatp/d402/mcp_middleware.py +434 -0
  31. traia_iatp/d402/middleware.py +193 -0
  32. traia_iatp/d402/models.py +116 -0
  33. traia_iatp/d402/networks.py +98 -0
  34. traia_iatp/d402/path.py +43 -0
  35. traia_iatp/d402/payment_introspection.py +104 -0
  36. traia_iatp/d402/payment_signing.py +178 -0
  37. traia_iatp/d402/paywall.py +119 -0
  38. traia_iatp/d402/starlette_middleware.py +326 -0
  39. traia_iatp/d402/template.py +1 -0
  40. traia_iatp/d402/types.py +300 -0
  41. traia_iatp/mcp/__init__.py +18 -0
  42. traia_iatp/mcp/client.py +201 -0
  43. traia_iatp/mcp/d402_mcp_tool_adapter.py +361 -0
  44. traia_iatp/mcp/mcp_agent_template.py +481 -0
  45. traia_iatp/mcp/templates/Dockerfile.j2 +80 -0
  46. traia_iatp/mcp/templates/README.md.j2 +310 -0
  47. traia_iatp/mcp/templates/cursor-rules.md.j2 +520 -0
  48. traia_iatp/mcp/templates/deployment_params.json.j2 +20 -0
  49. traia_iatp/mcp/templates/docker-compose.yml.j2 +32 -0
  50. traia_iatp/mcp/templates/dockerignore.j2 +47 -0
  51. traia_iatp/mcp/templates/env.example.j2 +57 -0
  52. traia_iatp/mcp/templates/gitignore.j2 +77 -0
  53. traia_iatp/mcp/templates/mcp_health_check.py.j2 +150 -0
  54. traia_iatp/mcp/templates/pyproject.toml.j2 +32 -0
  55. traia_iatp/mcp/templates/pyrightconfig.json.j2 +22 -0
  56. traia_iatp/mcp/templates/run_local_docker.sh.j2 +390 -0
  57. traia_iatp/mcp/templates/server.py.j2 +175 -0
  58. traia_iatp/mcp/traia_mcp_adapter.py +543 -0
  59. traia_iatp/preview_diagrams.html +181 -0
  60. traia_iatp/registry/__init__.py +26 -0
  61. traia_iatp/registry/atlas_search_indexes.json +280 -0
  62. traia_iatp/registry/embeddings.py +298 -0
  63. traia_iatp/registry/iatp_search_api.py +846 -0
  64. traia_iatp/registry/mongodb_registry.py +771 -0
  65. traia_iatp/registry/readmes/ATLAS_SEARCH_INDEXES.md +252 -0
  66. traia_iatp/registry/readmes/ATLAS_SEARCH_SETUP.md +134 -0
  67. traia_iatp/registry/readmes/AUTHENTICATION_UPDATE.md +124 -0
  68. traia_iatp/registry/readmes/EMBEDDINGS_SETUP.md +172 -0
  69. traia_iatp/registry/readmes/IATP_SEARCH_API_GUIDE.md +257 -0
  70. traia_iatp/registry/readmes/MONGODB_X509_AUTH.md +208 -0
  71. traia_iatp/registry/readmes/README.md +251 -0
  72. traia_iatp/registry/readmes/REFACTORING_SUMMARY.md +191 -0
  73. traia_iatp/scripts/__init__.py +2 -0
  74. traia_iatp/scripts/create_wallet.py +244 -0
  75. traia_iatp/server/__init__.py +15 -0
  76. traia_iatp/server/a2a_server.py +219 -0
  77. traia_iatp/server/example_template_usage.py +72 -0
  78. traia_iatp/server/iatp_server_agent_generator.py +237 -0
  79. traia_iatp/server/iatp_server_template_generator.py +235 -0
  80. traia_iatp/server/templates/.dockerignore.j2 +48 -0
  81. traia_iatp/server/templates/Dockerfile.j2 +49 -0
  82. traia_iatp/server/templates/README.md +137 -0
  83. traia_iatp/server/templates/README.md.j2 +425 -0
  84. traia_iatp/server/templates/__init__.py +1 -0
  85. traia_iatp/server/templates/__main__.py.j2 +565 -0
  86. traia_iatp/server/templates/agent.py.j2 +94 -0
  87. traia_iatp/server/templates/agent_config.json.j2 +22 -0
  88. traia_iatp/server/templates/agent_executor.py.j2 +279 -0
  89. traia_iatp/server/templates/docker-compose.yml.j2 +23 -0
  90. traia_iatp/server/templates/env.example.j2 +84 -0
  91. traia_iatp/server/templates/gitignore.j2 +78 -0
  92. traia_iatp/server/templates/grpc_server.py.j2 +218 -0
  93. traia_iatp/server/templates/pyproject.toml.j2 +78 -0
  94. traia_iatp/server/templates/run_local_docker.sh.j2 +103 -0
  95. traia_iatp/server/templates/server.py.j2 +243 -0
  96. traia_iatp/special_agencies/__init__.py +4 -0
  97. traia_iatp/special_agencies/registry_search_agency.py +392 -0
  98. traia_iatp/utils/__init__.py +10 -0
  99. traia_iatp/utils/docker_utils.py +251 -0
  100. traia_iatp/utils/general.py +64 -0
  101. traia_iatp/utils/iatp_utils.py +126 -0
  102. traia_iatp-0.1.29.dist-info/METADATA +423 -0
  103. traia_iatp-0.1.29.dist-info/RECORD +107 -0
  104. traia_iatp-0.1.29.dist-info/WHEEL +5 -0
  105. traia_iatp-0.1.29.dist-info/entry_points.txt +2 -0
  106. traia_iatp-0.1.29.dist-info/licenses/LICENSE +21 -0
  107. traia_iatp-0.1.29.dist-info/top_level.txt +1 -0
@@ -0,0 +1,181 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>IATP Mermaid Diagrams Preview</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
8
+ <style>
9
+ body {
10
+ font-family: Arial, sans-serif;
11
+ max-width: 1200px;
12
+ margin: 0 auto;
13
+ padding: 20px;
14
+ background-color: #f5f5f5;
15
+ }
16
+ h1, h2 {
17
+ color: #333;
18
+ }
19
+ .diagram-container {
20
+ background-color: white;
21
+ border: 1px solid #ddd;
22
+ border-radius: 8px;
23
+ padding: 20px;
24
+ margin-bottom: 30px;
25
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
26
+ }
27
+ .mermaid {
28
+ text-align: center;
29
+ }
30
+ </style>
31
+ </head>
32
+ <body>
33
+ <h1>IATP (Inter-Agent Transfer Protocol) Diagrams</h1>
34
+
35
+ <div class="diagram-container">
36
+ <h2>Standard Request-Response Flow</h2>
37
+ <div class="mermaid">
38
+ sequenceDiagram
39
+ participant CrewAI as CrewAI Agent
40
+ participant Client as A2A Client
41
+ participant Server as A2A Server
42
+ participant MCP as MCP Server
43
+
44
+ CrewAI->>Client: Execute request
45
+ Client->>Client: Ensure HTTP/2 connection
46
+ Client->>Server: Send message (JSON-RPC)
47
+ Server->>Server: Process request
48
+ Server->>MCP: Execute MCP tools
49
+ MCP-->>Server: Return results
50
+ Server-->>Client: Send response/task
51
+
52
+ alt Task-based response
53
+ loop Poll for completion
54
+ Client->>Server: Get task status
55
+ Server-->>Client: Task state
56
+ end
57
+ Client->>Server: Get final result
58
+ Server-->>Client: Task messages/artifacts
59
+ else Direct response
60
+ Note over Client: Extract message content
61
+ end
62
+
63
+ Client-->>CrewAI: Return formatted result
64
+ </div>
65
+ </div>
66
+
67
+ <div class="diagram-container">
68
+ <h2>SSE Streaming Flow</h2>
69
+ <div class="mermaid">
70
+ sequenceDiagram
71
+ participant CrewAI as CrewAI Agent
72
+ participant Client as A2A Client
73
+ participant Server as A2A Server (HTTP/2)
74
+ participant MCP as MCP Server
75
+
76
+ CrewAI->>Client: Stream request
77
+ Client->>Client: Check streaming support
78
+ Client->>Server: POST /a2a/stream (SSE)
79
+ Server->>Server: Initialize SSE stream
80
+ Server->>Client: stream_start event
81
+
82
+ loop Streaming chunks
83
+ Server->>MCP: Get data chunk
84
+ MCP-->>Server: Data
85
+ Server->>Client: stream_chunk event
86
+ Client->>CrewAI: Yield chunk
87
+ end
88
+
89
+ Server->>Client: stream_complete event
90
+ Client->>Client: Close stream
91
+ Client-->>CrewAI: Complete
92
+ </div>
93
+ </div>
94
+
95
+ <div class="diagram-container">
96
+ <h2>Client Decision Flow</h2>
97
+ <div class="mermaid">
98
+ graph TD
99
+ subgraph "CrewAI Agent Request"
100
+ A[Agent calls tool._run<br/>with request]
101
+ end
102
+
103
+ subgraph "A2ATool Decision Logic"
104
+ B{Check context}
105
+ C[_execute_with_retry]
106
+ D{streaming=True<br/>AND<br/>supports_streaming?}
107
+ end
108
+
109
+ subgraph "Standard Mode"
110
+ E[_execute_standard]
111
+ F[Send JSON-RPC message]
112
+ G{Response type?}
113
+ H[Direct Message<br/>Extract text parts]
114
+ I[Task Response<br/>Poll with _wait_for_task_completion]
115
+ J[_get_task_status<br/>Loop until complete]
116
+ end
117
+
118
+ subgraph "Streaming Mode"
119
+ K[_execute_streaming]
120
+ L[Open SSE connection<br/>via _stream_sse]
121
+ M[Collect all chunks]
122
+ N[Return combined result]
123
+ end
124
+
125
+ subgraph "Async Iterator Mode"
126
+ O[stream method called]
127
+ P[Force streaming=True]
128
+ Q[_stream_sse context manager]
129
+ R[Yield chunks individually]
130
+ end
131
+
132
+ A --> B
133
+ B --> C
134
+ C --> D
135
+ D -->|No| E
136
+ D -->|Yes| K
137
+
138
+ E --> F
139
+ F --> G
140
+ G -->|Message| H
141
+ G -->|Task| I
142
+ I --> J
143
+ J -->|Loop| I
144
+
145
+ K --> L
146
+ L --> M
147
+ M --> N
148
+
149
+ O --> P
150
+ P --> Q
151
+ Q --> R
152
+
153
+ H --> S[Return result]
154
+ J --> S
155
+ N --> S
156
+ R --> T[Async iteration]
157
+
158
+ style A fill:#e1f5fe
159
+ style S fill:#c8e6c9
160
+ style T fill:#c8e6c9
161
+ style D fill:#fff3cd
162
+ style G fill:#fff3cd
163
+ </div>
164
+ </div>
165
+
166
+ <script>
167
+ mermaid.initialize({
168
+ startOnLoad: true,
169
+ theme: 'default',
170
+ themeVariables: {
171
+ primaryColor: '#f5f5f5',
172
+ primaryTextColor: '#333',
173
+ primaryBorderColor: '#7C0000',
174
+ lineColor: '#5D5D5D',
175
+ secondaryColor: '#006100',
176
+ tertiaryColor: '#fff'
177
+ }
178
+ });
179
+ </script>
180
+ </body>
181
+ </html>
@@ -0,0 +1,26 @@
1
+ """IATP registry module for managing utility agents and MCP servers."""
2
+
3
+ from .mongodb_registry import UtilityAgentRegistry, MCPServerRegistry
4
+ from .iatp_search_api import (
5
+ find_utility_agent,
6
+ list_utility_agents,
7
+ search_utility_agents,
8
+ find_mcp_server,
9
+ list_mcp_servers,
10
+ search_mcp_servers,
11
+ get_mcp_server
12
+ )
13
+ from .embeddings import get_embedding_service
14
+
15
+ __all__ = [
16
+ "UtilityAgentRegistry",
17
+ "MCPServerRegistry",
18
+ "find_utility_agent",
19
+ "list_utility_agents",
20
+ "search_utility_agents",
21
+ "find_mcp_server",
22
+ "list_mcp_servers",
23
+ "search_mcp_servers",
24
+ "get_mcp_server",
25
+ "get_embedding_service",
26
+ ]
@@ -0,0 +1,280 @@
1
+ [
2
+ {
3
+ "name": "utility_agent_atlas_search_test",
4
+ "collection": "iatp-utility-agent-registry-test",
5
+ "definition": {
6
+ "mappings": {
7
+ "dynamic": false,
8
+ "fields": {
9
+ "name": {
10
+ "type": "string",
11
+ "analyzer": "lucene.standard"
12
+ },
13
+ "description": {
14
+ "type": "string",
15
+ "analyzer": "lucene.standard"
16
+ },
17
+ "tags": {
18
+ "type": "string",
19
+ "analyzer": "lucene.standard"
20
+ },
21
+ "capabilities": {
22
+ "type": "string",
23
+ "analyzer": "lucene.standard"
24
+ },
25
+ "search_text": {
26
+ "type": "string",
27
+ "analyzer": "lucene.standard"
28
+ },
29
+ "skills": {
30
+ "type": "document",
31
+ "fields": {
32
+ "name": {
33
+ "type": "string",
34
+ "analyzer": "lucene.standard"
35
+ },
36
+ "description": {
37
+ "type": "string",
38
+ "analyzer": "lucene.standard"
39
+ },
40
+ "tags": {
41
+ "type": "string",
42
+ "analyzer": "lucene.standard"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ },
50
+ {
51
+ "name": "utility_agent_atlas_search_prod",
52
+ "collection": "iatp-utility-agent-registry-prod",
53
+ "definition": {
54
+ "mappings": {
55
+ "dynamic": false,
56
+ "fields": {
57
+ "name": {
58
+ "type": "string",
59
+ "analyzer": "lucene.standard"
60
+ },
61
+ "description": {
62
+ "type": "string",
63
+ "analyzer": "lucene.standard"
64
+ },
65
+ "tags": {
66
+ "type": "string",
67
+ "analyzer": "lucene.standard"
68
+ },
69
+ "capabilities": {
70
+ "type": "string",
71
+ "analyzer": "lucene.standard"
72
+ },
73
+ "search_text": {
74
+ "type": "string",
75
+ "analyzer": "lucene.standard"
76
+ },
77
+ "skills": {
78
+ "type": "document",
79
+ "fields": {
80
+ "name": {
81
+ "type": "string",
82
+ "analyzer": "lucene.standard"
83
+ },
84
+ "description": {
85
+ "type": "string",
86
+ "analyzer": "lucene.standard"
87
+ },
88
+ "tags": {
89
+ "type": "string",
90
+ "analyzer": "lucene.standard"
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ },
98
+ {
99
+ "name": "utility_agent_vector_search_test",
100
+ "collection": "iatp-utility-agent-registry-test",
101
+ "type": "vectorSearch",
102
+ "definition": {
103
+ "fields": [
104
+ {
105
+ "type": "vector",
106
+ "path": "embeddings.description",
107
+ "numDimensions": 1536,
108
+ "similarity": "cosine"
109
+ },
110
+ {
111
+ "type": "vector",
112
+ "path": "embeddings.tags",
113
+ "numDimensions": 1536,
114
+ "similarity": "cosine"
115
+ },
116
+ {
117
+ "type": "vector",
118
+ "path": "embeddings.capabilities",
119
+ "numDimensions": 1536,
120
+ "similarity": "cosine"
121
+ },
122
+ {
123
+ "type": "vector",
124
+ "path": "embeddings.agent_card",
125
+ "numDimensions": 1536,
126
+ "similarity": "cosine"
127
+ },
128
+ {
129
+ "type": "vector",
130
+ "path": "embeddings.search_text",
131
+ "numDimensions": 1536,
132
+ "similarity": "cosine"
133
+ },
134
+ {
135
+ "type": "filter",
136
+ "path": "is_active"
137
+ }
138
+ ]
139
+ }
140
+ },
141
+ {
142
+ "name": "utility_agent_vector_search_prod",
143
+ "collection": "iatp-utility-agent-registry-prod",
144
+ "type": "vectorSearch",
145
+ "definition": {
146
+ "fields": [
147
+ {
148
+ "type": "vector",
149
+ "path": "embeddings.description",
150
+ "numDimensions": 1536,
151
+ "similarity": "cosine"
152
+ },
153
+ {
154
+ "type": "vector",
155
+ "path": "embeddings.tags",
156
+ "numDimensions": 1536,
157
+ "similarity": "cosine"
158
+ },
159
+ {
160
+ "type": "vector",
161
+ "path": "embeddings.capabilities",
162
+ "numDimensions": 1536,
163
+ "similarity": "cosine"
164
+ },
165
+ {
166
+ "type": "vector",
167
+ "path": "embeddings.agent_card",
168
+ "numDimensions": 1536,
169
+ "similarity": "cosine"
170
+ },
171
+ {
172
+ "type": "vector",
173
+ "path": "embeddings.search_text",
174
+ "numDimensions": 1536,
175
+ "similarity": "cosine"
176
+ },
177
+ {
178
+ "type": "filter",
179
+ "path": "is_active"
180
+ }
181
+ ]
182
+ }
183
+ },
184
+ {
185
+ "name": "mcp_server_atlas_search_test",
186
+ "collection": "iatp-mcp-server-registry-test",
187
+ "definition": {
188
+ "mappings": {
189
+ "dynamic": false,
190
+ "fields": {
191
+ "name": {
192
+ "type": "string",
193
+ "analyzer": "lucene.standard"
194
+ },
195
+ "description": {
196
+ "type": "string",
197
+ "analyzer": "lucene.standard"
198
+ },
199
+ "capabilities": {
200
+ "type": "string",
201
+ "analyzer": "lucene.standard"
202
+ }
203
+ }
204
+ }
205
+ }
206
+ },
207
+ {
208
+ "name": "mcp_server_atlas_search_prod",
209
+ "collection": "iatp-mcp-server-registry-prod",
210
+ "definition": {
211
+ "mappings": {
212
+ "dynamic": false,
213
+ "fields": {
214
+ "name": {
215
+ "type": "string",
216
+ "analyzer": "lucene.standard"
217
+ },
218
+ "description": {
219
+ "type": "string",
220
+ "analyzer": "lucene.standard"
221
+ },
222
+ "capabilities": {
223
+ "type": "string",
224
+ "analyzer": "lucene.standard"
225
+ }
226
+ }
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "name": "mcp_server_vector_search_test",
232
+ "collection": "iatp-mcp-server-registry-test",
233
+ "type": "vectorSearch",
234
+ "definition": {
235
+ "fields": [
236
+ {
237
+ "type": "vector",
238
+ "path": "description_embedding",
239
+ "numDimensions": 1536,
240
+ "similarity": "cosine"
241
+ },
242
+ {
243
+ "type": "vector",
244
+ "path": "capabilities_embedding",
245
+ "numDimensions": 1536,
246
+ "similarity": "cosine"
247
+ },
248
+ {
249
+ "type": "filter",
250
+ "path": "is_active"
251
+ }
252
+ ]
253
+ }
254
+ },
255
+ {
256
+ "name": "mcp_server_vector_search_prod",
257
+ "collection": "iatp-mcp-server-registry-prod",
258
+ "type": "vectorSearch",
259
+ "definition": {
260
+ "fields": [
261
+ {
262
+ "type": "vector",
263
+ "path": "description_embedding",
264
+ "numDimensions": 1536,
265
+ "similarity": "cosine"
266
+ },
267
+ {
268
+ "type": "vector",
269
+ "path": "capabilities_embedding",
270
+ "numDimensions": 1536,
271
+ "similarity": "cosine"
272
+ },
273
+ {
274
+ "type": "filter",
275
+ "path": "is_active"
276
+ }
277
+ ]
278
+ }
279
+ }
280
+ ]