traia-iatp 0.1.43__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.
- traia_iatp-0.1.43/LICENSE +21 -0
- traia_iatp-0.1.43/PKG-INFO +423 -0
- traia_iatp-0.1.43/README.md +374 -0
- traia_iatp-0.1.43/pyproject.toml +82 -0
- traia_iatp-0.1.43/setup.cfg +4 -0
- traia_iatp-0.1.43/src/traia_iatp/README.md +368 -0
- traia_iatp-0.1.43/src/traia_iatp/__init__.py +52 -0
- traia_iatp-0.1.43/src/traia_iatp/cli/__init__.py +5 -0
- traia_iatp-0.1.43/src/traia_iatp/cli/main.py +483 -0
- traia_iatp-0.1.43/src/traia_iatp/client/__init__.py +10 -0
- traia_iatp-0.1.43/src/traia_iatp/client/a2a_client.py +274 -0
- traia_iatp-0.1.43/src/traia_iatp/client/crewai_a2a_tools.py +355 -0
- traia_iatp-0.1.43/src/traia_iatp/client/d402_a2a_client.py +348 -0
- traia_iatp-0.1.43/src/traia_iatp/client/grpc_a2a_tools.py +349 -0
- traia_iatp-0.1.43/src/traia_iatp/client/root_path_a2a_client.py +1 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/__init__.py +12 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/data/abis/contract-abis-localhost.json +4091 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/data/abis/contract-abis-sepolia.json +4481 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/data/addresses/contract-addresses.json +17 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/data/addresses/contract-proxies.json +12 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/iatp_contracts_config.py +263 -0
- traia_iatp-0.1.43/src/traia_iatp/contracts/wallet_creator.py +255 -0
- traia_iatp-0.1.43/src/traia_iatp/core/__init__.py +43 -0
- traia_iatp-0.1.43/src/traia_iatp/core/models.py +172 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/__init__.py +54 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/asgi_wrapper.py +409 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/chains.py +102 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/client.py +150 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/clients/__init__.py +7 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/clients/base.py +218 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/clients/httpx.py +266 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/common.py +114 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/encoding.py +28 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/examples/client_example.py +197 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/examples/server_example.py +171 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/facilitator.py +481 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/mcp_middleware.py +296 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/models.py +116 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/networks.py +98 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/path.py +43 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/payment_introspection.py +126 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/payment_signing.py +183 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/price_builder.py +164 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/__init__.py +61 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/base.py +139 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/example_general_server.py +140 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/fastapi.py +253 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/mcp.py +304 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/servers/starlette.py +819 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/starlette_middleware.py +470 -0
- traia_iatp-0.1.43/src/traia_iatp/d402/types.py +300 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/__init__.py +18 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/client.py +201 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/d402_mcp_tool_adapter.py +361 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/mcp_agent_template.py +487 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/Dockerfile.j2 +79 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/README.md.j2 +310 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/cursor-rules.md.j2 +520 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/deployment_params.json.j2 +20 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/docker-compose.yml.j2 +33 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/dockerignore.j2 +47 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/env.example.j2 +60 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/gitignore.j2 +77 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/mcp_health_check.py.j2 +150 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/pyproject.toml.j2 +32 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/pyrightconfig.json.j2 +22 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/run_local_docker.sh.j2 +404 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/templates/server.py.j2 +205 -0
- traia_iatp-0.1.43/src/traia_iatp/mcp/traia_mcp_adapter.py +543 -0
- traia_iatp-0.1.43/src/traia_iatp/preview_diagrams.html +181 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/__init__.py +26 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/atlas_search_indexes.json +280 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/embeddings.py +298 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/iatp_search_api.py +906 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/mongodb_registry.py +813 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/ATLAS_SEARCH_INDEXES.md +252 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/ATLAS_SEARCH_SETUP.md +134 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/AUTHENTICATION_UPDATE.md +124 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/EMBEDDINGS_SETUP.md +172 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/IATP_SEARCH_API_GUIDE.md +257 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/MONGODB_X509_AUTH.md +208 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/README.md +251 -0
- traia_iatp-0.1.43/src/traia_iatp/registry/readmes/REFACTORING_SUMMARY.md +191 -0
- traia_iatp-0.1.43/src/traia_iatp/scripts/__init__.py +2 -0
- traia_iatp-0.1.43/src/traia_iatp/scripts/create_wallet.py +244 -0
- traia_iatp-0.1.43/src/traia_iatp/server/__init__.py +15 -0
- traia_iatp-0.1.43/src/traia_iatp/server/a2a_server.py +219 -0
- traia_iatp-0.1.43/src/traia_iatp/server/example_template_usage.py +72 -0
- traia_iatp-0.1.43/src/traia_iatp/server/iatp_server_agent_generator.py +237 -0
- traia_iatp-0.1.43/src/traia_iatp/server/iatp_server_template_generator.py +258 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/.dockerignore.j2 +48 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/Dockerfile.j2 +71 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/README.md +137 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/README.md.j2 +425 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/__init__.py +1 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/__main__.py.j2 +782 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/agent.py.j2 +94 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/agent_config.json.j2 +22 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/agent_executor.py.j2 +298 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/docker-compose.yml.j2 +23 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/env.example.j2 +98 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/gitignore.j2 +85 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/grpc_server.py.j2 +218 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/pyproject.toml.j2 +78 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/run_local_docker.sh.j2 +235 -0
- traia_iatp-0.1.43/src/traia_iatp/server/templates/server.py.j2 +377 -0
- traia_iatp-0.1.43/src/traia_iatp/special_agencies/__init__.py +4 -0
- traia_iatp-0.1.43/src/traia_iatp/special_agencies/registry_search_agency.py +392 -0
- traia_iatp-0.1.43/src/traia_iatp/utils/__init__.py +10 -0
- traia_iatp-0.1.43/src/traia_iatp/utils/docker_utils.py +251 -0
- traia_iatp-0.1.43/src/traia_iatp/utils/general.py +64 -0
- traia_iatp-0.1.43/src/traia_iatp/utils/iatp_utils.py +126 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/PKG-INFO +423 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/SOURCES.txt +117 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/dependency_links.txt +1 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/entry_points.txt +2 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/requires.txt +37 -0
- traia_iatp-0.1.43/src/traia_iatp.egg-info/top_level.txt +1 -0
- traia_iatp-0.1.43/tests/test_configuration.py +129 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Traia.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: traia-iatp
|
|
3
|
+
Version: 0.1.43
|
|
4
|
+
Summary: Inter-Agent Transfer Protocol (IATP) - Enable AI Agents to utilize other AI Agents as tools
|
|
5
|
+
Project-URL: Documentation, https://pypi.org/project/traia-iatp
|
|
6
|
+
Project-URL: Source, https://github.com/Traia-IO/IATP
|
|
7
|
+
Keywords: crewai,iatp,agent-to-agent,a2a,mcp,web3,cryptocurrency,tools
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: a2a-sdk>=0.3.19
|
|
14
|
+
Requires-Dist: aiohttp>=3.12.13
|
|
15
|
+
Requires-Dist: anyio>=4.0.0
|
|
16
|
+
Requires-Dist: crewai>=0.203.1
|
|
17
|
+
Requires-Dist: crewai-tools[mcp]>=0.76.0
|
|
18
|
+
Requires-Dist: docker>=7.1.0
|
|
19
|
+
Requires-Dist: fastapi>=0.119.0
|
|
20
|
+
Requires-Dist: httpx[http2]>=0.28.1
|
|
21
|
+
Requires-Dist: jinja2>=3.1.6
|
|
22
|
+
Requires-Dist: mcp>=1.1.2
|
|
23
|
+
Requires-Dist: openai>=1.109.1
|
|
24
|
+
Requires-Dist: pydantic>=2.12.2
|
|
25
|
+
Requires-Dist: pymongo[aws]>=4.13.0
|
|
26
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
27
|
+
Requires-Dist: pytz>=2025.2
|
|
28
|
+
Requires-Dist: requests>=2.32.5
|
|
29
|
+
Requires-Dist: rich>=14.2.0
|
|
30
|
+
Requires-Dist: starlette>=0.45.0
|
|
31
|
+
Requires-Dist: typer>=0.19.2
|
|
32
|
+
Requires-Dist: uvicorn>=0.37.0
|
|
33
|
+
Requires-Dist: agentops>=0.4.21
|
|
34
|
+
Requires-Dist: dnspython==2.6.1
|
|
35
|
+
Requires-Dist: eth-account>=0.11.0
|
|
36
|
+
Requires-Dist: web3>=6.15.0
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
44
|
+
Provides-Extra: publish
|
|
45
|
+
Requires-Dist: wheel; extra == "publish"
|
|
46
|
+
Requires-Dist: twine; extra == "publish"
|
|
47
|
+
Requires-Dist: build; extra == "publish"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# Traia IATP
|
|
51
|
+
|
|
52
|
+
[](https://badge.fury.io/py/traia-iatp)
|
|
53
|
+
[](https://www.python.org/downloads/)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
|
|
56
|
+
**Traia IATP** is an Inter-Agent Transfer Protocol (IATP) package that enables AI agents to utilize other AI agents as tools via the A2A (Agent-to-Agent) protocol. This implementation allows CrewAI agents to act as both IATP servers (utility agents) and clients.
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- 🤖 **Utility Agent Creation**: Convert MCP servers into IATP-compatible utility agents
|
|
61
|
+
- 🔌 **IATP Client Tools**: Enable CrewAI crews to use utility agents as tools via IATP protocol
|
|
62
|
+
- 🌐 **Protocol Support**: HTTP/2 with SSE streaming and optional gRPC for high-performance scenarios
|
|
63
|
+
- 📊 **Registry Management**: MongoDB-based registry for discovering utility agents
|
|
64
|
+
- 🐳 **Docker Support**: Complete containerization for deployment
|
|
65
|
+
- 🐳 **Local Docker Deployment**: Complete containerization for local deployment
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
### From PyPI (Recommended)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install traia-iatp
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### From Source
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/Traia-IO/IATP.git
|
|
79
|
+
cd IATP
|
|
80
|
+
pip install -e .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Development Installation
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Install with all dependencies for development
|
|
87
|
+
pip install -e ".[dev]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Quick Start
|
|
91
|
+
|
|
92
|
+
### 1. Creating a Utility Agency (IATP Server)
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import asyncio
|
|
96
|
+
from traia_iatp import MCPServer, MCPServerType, IATPServerAgentGenerator
|
|
97
|
+
|
|
98
|
+
async def create_utility_agency():
|
|
99
|
+
# Define an MCP server
|
|
100
|
+
mcp_server = MCPServer(
|
|
101
|
+
name="example-mcp-server",
|
|
102
|
+
url="http://example-mcp-server:8080",
|
|
103
|
+
server_type=MCPServerType.STREAMABLE_HTTP,
|
|
104
|
+
description="Example MCP server that provides utility functions"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Generate and deploy utility agency
|
|
108
|
+
generator = IATPServerAgentGenerator()
|
|
109
|
+
agency = await generator.create_from_mcp(mcp_server)
|
|
110
|
+
|
|
111
|
+
# Deploy locally with Docker
|
|
112
|
+
await generator.deploy_local(agency)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. Using Utility Agencies in CrewAI (IATP Client)
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from crewai import Agent, Task, Crew
|
|
119
|
+
from traia_iatp import find_utility_agent
|
|
120
|
+
from traia_iatp.client import A2AToolkit
|
|
121
|
+
|
|
122
|
+
# Find available utility agents by agent_id
|
|
123
|
+
agent = find_utility_agent(agent_id="finbert-mcp-traia-utility-agent")
|
|
124
|
+
|
|
125
|
+
if agent:
|
|
126
|
+
# Get the IATP endpoint
|
|
127
|
+
endpoint = agent.base_url
|
|
128
|
+
if agent.endpoints and 'iatp_endpoint' in agent.endpoints:
|
|
129
|
+
endpoint = agent.endpoints['iatp_endpoint']
|
|
130
|
+
|
|
131
|
+
# Create tool from agent endpoint
|
|
132
|
+
finbert_tool = A2AToolkit.create_tool_from_endpoint(
|
|
133
|
+
endpoint=endpoint,
|
|
134
|
+
name=agent.name,
|
|
135
|
+
description=agent.description,
|
|
136
|
+
timeout=300,
|
|
137
|
+
retry_attempts=1,
|
|
138
|
+
supports_streaming=False,
|
|
139
|
+
iatp_endpoint=endpoint
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# Use in CrewAI agent
|
|
143
|
+
sentiment_analyst = Agent(
|
|
144
|
+
role="Financial Sentiment Analyst",
|
|
145
|
+
goal="Analyze sentiment of financial texts using FinBERT models",
|
|
146
|
+
backstory="Expert financial sentiment analyst with deep knowledge of market psychology",
|
|
147
|
+
tools=[finbert_tool],
|
|
148
|
+
verbose=True,
|
|
149
|
+
allow_delegation=False
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
# Create task
|
|
153
|
+
task = Task(
|
|
154
|
+
description="Analyze the sentiment of: 'Apple Inc. reported record quarterly earnings'",
|
|
155
|
+
expected_output="Sentiment classification with confidence score and investment implications",
|
|
156
|
+
agent=sentiment_analyst
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
# Run crew
|
|
160
|
+
crew = Crew(agents=[sentiment_analyst], tasks=[task])
|
|
161
|
+
result = crew.kickoff()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Alternative: Batch Tool Creation
|
|
165
|
+
|
|
166
|
+
For creating multiple tools at once, you can use the convenience function:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from traia_iatp.client import create_utility_agency_tools
|
|
170
|
+
|
|
171
|
+
# Search and create tools in batch
|
|
172
|
+
tools = create_utility_agency_tools(
|
|
173
|
+
query="sentiment analysis",
|
|
174
|
+
tags=["finbert", "nlp"],
|
|
175
|
+
capabilities=["sentiment_analysis"]
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Use all found tools in an agent
|
|
179
|
+
agent = Agent(
|
|
180
|
+
role="Multi-Tool Analyst",
|
|
181
|
+
tools=tools,
|
|
182
|
+
goal="Analyze using multiple available utility agents"
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 3. CLI Usage
|
|
187
|
+
|
|
188
|
+
The package includes a powerful CLI for managing utility agencies:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# First, register an MCP server in the registry
|
|
192
|
+
traia-iatp register-mcp \
|
|
193
|
+
--name "Trading MCP" \
|
|
194
|
+
--url "http://localhost:8000/mcp" \
|
|
195
|
+
--description "Trading MCP server" \
|
|
196
|
+
--capability "trading" \
|
|
197
|
+
--capability "crypto"
|
|
198
|
+
|
|
199
|
+
# Create a utility agency from registered MCP server
|
|
200
|
+
traia-iatp create-agency \
|
|
201
|
+
--name "My Trading Agent" \
|
|
202
|
+
--description "Advanced trading utility agent" \
|
|
203
|
+
--mcp-name "Trading MCP" \
|
|
204
|
+
--deploy
|
|
205
|
+
|
|
206
|
+
# List available utility agencies
|
|
207
|
+
traia-iatp list-agencies
|
|
208
|
+
|
|
209
|
+
# Search for agencies by capability
|
|
210
|
+
traia-iatp search-agencies --query "trading crypto"
|
|
211
|
+
|
|
212
|
+
# Deploy from a generated agency directory
|
|
213
|
+
traia-iatp deploy ./utility_agencies/my-trading-agent --port 8001
|
|
214
|
+
|
|
215
|
+
# Find available tools for CrewAI
|
|
216
|
+
traia-iatp find-tools --tag "trading" --capability "crypto"
|
|
217
|
+
|
|
218
|
+
# List registered MCP servers
|
|
219
|
+
traia-iatp list-mcp-servers
|
|
220
|
+
|
|
221
|
+
# Show example CrewAI integration code
|
|
222
|
+
traia-iatp example-crew
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Architecture
|
|
226
|
+
|
|
227
|
+
### IATP Operation Modes
|
|
228
|
+
|
|
229
|
+
The IATP protocol supports two distinct operation modes:
|
|
230
|
+
|
|
231
|
+
#### 1. Synchronous JSON-RPC Mode
|
|
232
|
+
For simple request-response patterns:
|
|
233
|
+
- Client sends: `message/send` request via JSON-RPC
|
|
234
|
+
- Server processes the request using CrewAI agents
|
|
235
|
+
- Server returns: A single `Message` result
|
|
236
|
+
|
|
237
|
+
#### 2. Streaming SSE Mode
|
|
238
|
+
For real-time data and long-running operations:
|
|
239
|
+
- Client sends: `message/send` request via JSON-RPC
|
|
240
|
+
- Server returns: Stream of events via Server-Sent Events (SSE)
|
|
241
|
+
- Supports progress updates, partial results, and completion notifications
|
|
242
|
+
|
|
243
|
+
### Component Overview
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
|
|
247
|
+
│ CrewAI Agent │───▶│ IATP Client │───▶│ Utility Agency │
|
|
248
|
+
│ (A2A Client) │ │ (HTTP/2 + gRPC) │ │ (A2A Server) │
|
|
249
|
+
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
|
|
250
|
+
│
|
|
251
|
+
▼
|
|
252
|
+
┌─────────────────────┐
|
|
253
|
+
│ MCP Server │
|
|
254
|
+
│ (Tools Provider) │
|
|
255
|
+
└─────────────────────┘
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Key Components
|
|
259
|
+
|
|
260
|
+
### Server Components (`traia_iatp.server`)
|
|
261
|
+
- **Template Generation**: Jinja2 templates for creating utility agents
|
|
262
|
+
- **HTTP/2 + SSE Support**: Modern protocol support with streaming
|
|
263
|
+
- **gRPC Integration**: Optional high-performance protocol support
|
|
264
|
+
- **Docker Containerization**: Complete deployment packaging
|
|
265
|
+
|
|
266
|
+
### Client Components (`traia_iatp.client`)
|
|
267
|
+
- **CrewAI Integration**: Native tools for CrewAI agents
|
|
268
|
+
- **HTTP/2 Client**: Persistent connections with multiplexing
|
|
269
|
+
- **SSE Streaming**: Real-time data consumption
|
|
270
|
+
- **Connection Management**: Pooling and retry logic
|
|
271
|
+
|
|
272
|
+
### Registry Components (`traia_iatp.registry`)
|
|
273
|
+
- **MongoDB Integration**: Persistent storage and search
|
|
274
|
+
- **Vector Search**: Embedding-based capability discovery
|
|
275
|
+
- **Atlas Search**: Full-text search capabilities
|
|
276
|
+
- **Agent Discovery**: Find agents by capability, tags, or description
|
|
277
|
+
|
|
278
|
+
## Environment Variables
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# MongoDB Configuration (choose one method)
|
|
282
|
+
MONGODB_CONNECTION_STRING="mongodb+srv://..."
|
|
283
|
+
# OR
|
|
284
|
+
MONGODB_USER="username"
|
|
285
|
+
MONGODB_PASSWORD="password"
|
|
286
|
+
# OR X.509 Certificate
|
|
287
|
+
MONGODB_X509_CERT_FILE="/path/to/cert.pem"
|
|
288
|
+
|
|
289
|
+
# Optional: Custom MongoDB cluster
|
|
290
|
+
MONGODB_CLUSTER_URI="custom-cluster.mongodb.net"
|
|
291
|
+
MONGODB_DATABASE_NAME="custom_db"
|
|
292
|
+
|
|
293
|
+
# OpenAI for embeddings (optional)
|
|
294
|
+
OPENAI_API_KEY="your-openai-key"
|
|
295
|
+
|
|
296
|
+
# MCP Server Authentication (as needed)
|
|
297
|
+
MCP_API_KEY="your-mcp-api-key"
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Examples
|
|
301
|
+
|
|
302
|
+
### Advanced IATP Integration
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
from traia_iatp import find_utility_agent
|
|
306
|
+
from traia_iatp.client import A2AToolkit
|
|
307
|
+
|
|
308
|
+
# Find multiple utility agents
|
|
309
|
+
trading_agent = find_utility_agent(agent_id="trading-mcp-agent")
|
|
310
|
+
sentiment_agent = find_utility_agent(agent_id="finbert-mcp-agent")
|
|
311
|
+
|
|
312
|
+
tools = []
|
|
313
|
+
for agent in [trading_agent, sentiment_agent]:
|
|
314
|
+
if agent:
|
|
315
|
+
# Get endpoint and create tool
|
|
316
|
+
endpoint = agent.endpoints.get('iatp_endpoint', agent.base_url)
|
|
317
|
+
tool = A2AToolkit.create_tool_from_endpoint(
|
|
318
|
+
endpoint=endpoint,
|
|
319
|
+
name=agent.name,
|
|
320
|
+
description=agent.description,
|
|
321
|
+
iatp_endpoint=endpoint
|
|
322
|
+
)
|
|
323
|
+
tools.append(tool)
|
|
324
|
+
|
|
325
|
+
# Use multiple IATP tools in one agent
|
|
326
|
+
multi_tool_agent = Agent(
|
|
327
|
+
role="Multi-Domain Analyst",
|
|
328
|
+
goal="Analyze markets using multiple specialized AI agents",
|
|
329
|
+
tools=tools,
|
|
330
|
+
backstory="Expert analyst with access to specialized AI agents for trading and sentiment analysis"
|
|
331
|
+
)
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Local Docker Deployment
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
from traia_iatp.utils.docker_utils import LocalDockerRunner
|
|
338
|
+
from pathlib import Path
|
|
339
|
+
|
|
340
|
+
# Deploy a generated agency locally (not yet configured properly)
|
|
341
|
+
runner = LocalDockerRunner()
|
|
342
|
+
deployment_info = await runner.run_agent_docker(
|
|
343
|
+
agent_path=Path("./utility_agencies/my-trading-agent"),
|
|
344
|
+
port=8000,
|
|
345
|
+
detached=True
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
if deployment_info["success"]:
|
|
349
|
+
print(f"Agency deployed at: {deployment_info['iatp_endpoint']}")
|
|
350
|
+
print(f"Container: {deployment_info['container_name']}")
|
|
351
|
+
print(f"Stop with: {deployment_info['stop_command']}")
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Development
|
|
355
|
+
|
|
356
|
+
### Setting Up Development Environment
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Clone the repository
|
|
360
|
+
git clone https://github.com/Traia-IO/IATP.git
|
|
361
|
+
cd IATP
|
|
362
|
+
|
|
363
|
+
# Create virtual environment
|
|
364
|
+
python -m venv venv
|
|
365
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
366
|
+
|
|
367
|
+
# Install in development mode with dev dependencies
|
|
368
|
+
pip install -e ".[dev]"
|
|
369
|
+
|
|
370
|
+
# Run tests
|
|
371
|
+
pytest
|
|
372
|
+
|
|
373
|
+
# Run linting
|
|
374
|
+
black .
|
|
375
|
+
flake8 .
|
|
376
|
+
mypy .
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Running Tests
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
# Run all tests
|
|
383
|
+
pytest
|
|
384
|
+
|
|
385
|
+
# Run specific test file
|
|
386
|
+
pytest tests/test_client.py
|
|
387
|
+
|
|
388
|
+
# Run with coverage
|
|
389
|
+
pytest --cov=traia_iatp --cov-report=html
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## Contributing
|
|
393
|
+
|
|
394
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
395
|
+
|
|
396
|
+
This is a private code base hence only members of Dcentralab can contribute
|
|
397
|
+
|
|
398
|
+
1. Fork the repository
|
|
399
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
400
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
401
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
402
|
+
5. Open a Pull Request
|
|
403
|
+
|
|
404
|
+
## License
|
|
405
|
+
|
|
406
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
407
|
+
|
|
408
|
+
## Support
|
|
409
|
+
|
|
410
|
+
- 📖 **Documentation**: [https://pypi.org/project/traia-iatp](https://pypi.org/project/traia-iatp)
|
|
411
|
+
- 🐛 **Bug Reports**: [GitHub Issues](https://github.com/Traia-IO/IATP/issues)
|
|
412
|
+
- 💬 **Community**: [Visit our website](https://traia.io)
|
|
413
|
+
- 📧 **Email**: support@traia.io
|
|
414
|
+
|
|
415
|
+
## Related Projects
|
|
416
|
+
|
|
417
|
+
- [A2A Protocol](https://github.com/google-a2a/A2A) - Agent-to-Agent communication protocol
|
|
418
|
+
- [CrewAI](https://github.com/joaomdmoura/crewAI) - Framework for orchestrating role-playing AI agents
|
|
419
|
+
- [FastMCP](https://github.com/modelcontextprotocol/fastmcp) - Fast implementation of Model Context Protocol
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
**Made with ❤️ by the Traia Team**
|