mech-client 0.12.1__tar.gz → 0.14.1__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.
Files changed (101) hide show
  1. {mech_client-0.12.1 → mech_client-0.14.1}/PKG-INFO +10 -10
  2. {mech_client-0.12.1 → mech_client-0.14.1}/README.md +9 -9
  3. mech_client-0.14.1/mech_client/__init__.py +3 -0
  4. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/cli.py +0 -5
  5. mech_client-0.14.1/mech_client/delivery.py +156 -0
  6. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/interact.py +8 -5
  7. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/marketplace_interact.py +130 -121
  8. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/wss.py +25 -74
  9. {mech_client-0.12.1 → mech_client-0.14.1}/pyproject.toml +1 -1
  10. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/whitelist.py +5 -1
  11. mech_client-0.12.1/mech_client/__init__.py +0 -3
  12. {mech_client-0.12.1 → mech_client-0.14.1}/LICENSE +0 -0
  13. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/AgentMech.json +0 -0
  14. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/AgentRegistry.json +0 -0
  15. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/AgreementStoreManager.base.json +0 -0
  16. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/AgreementStoreManager.gnosis.json +0 -0
  17. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/BalanceTrackerFixedPriceNative.json +0 -0
  18. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/BalanceTrackerFixedPriceToken.json +0 -0
  19. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +0 -0
  20. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +0 -0
  21. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/ComplementaryServiceMetadata.json +0 -0
  22. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/DIDRegistry.base.json +0 -0
  23. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/DIDRegistry.gnosis.json +0 -0
  24. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/EscrowPaymentCondition.base.json +0 -0
  25. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/EscrowPaymentCondition.gnosis.json +0 -0
  26. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/IERC1155.json +0 -0
  27. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/IMech.json +0 -0
  28. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/IToken.json +0 -0
  29. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/LockPaymentCondition.base.json +0 -0
  30. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/LockPaymentCondition.gnosis.json +0 -0
  31. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/MechMarketplace.json +0 -0
  32. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/NFTSalesTemplate.base.json +0 -0
  33. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/NFTSalesTemplate.gnosis.json +0 -0
  34. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/NeverminedConfig.base.json +0 -0
  35. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/NeverminedConfig.gnosis.json +0 -0
  36. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/SubscriptionNFT.base.json +0 -0
  37. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/SubscriptionNFT.gnosis.json +0 -0
  38. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/SubscriptionProvider.base.json +0 -0
  39. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/SubscriptionProvider.gnosis.json +0 -0
  40. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/SubscriptionToken.base.json +0 -0
  41. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/TransferNFTCondition.base.json +0 -0
  42. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/abis/TransferNFTCondition.gnosis.json +0 -0
  43. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/acn.py +0 -0
  44. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/configs/mechs.json +0 -0
  45. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/fetch_ipfs_hash.py +0 -0
  46. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/__init__.py +0 -0
  47. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/README.md +0 -0
  48. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/__init__.py +0 -0
  49. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/acn.proto +0 -0
  50. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/acn_pb2.py +0 -0
  51. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/custom_types.py +0 -0
  52. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/dialogues.py +0 -0
  53. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/message.py +0 -0
  54. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/protocol.yaml +0 -0
  55. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/serialization.py +0 -0
  56. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/tests/__init__.py +0 -0
  57. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  58. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  59. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  60. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/README.md +0 -0
  61. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  62. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  63. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  64. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  65. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/message.py +0 -0
  66. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  67. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  68. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  69. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  70. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  71. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  72. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
  73. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
  74. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/mech_marketplace_subgraph.py +0 -0
  75. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/mech_marketplace_tool_management.py +0 -0
  76. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/mech_tool_management.py +0 -0
  77. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/prompt_to_ipfs.py +0 -0
  78. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/push_to_ipfs.py +0 -0
  79. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/subgraph.py +0 -0
  80. {mech_client-0.12.1 → mech_client-0.14.1}/mech_client/to_png.py +0 -0
  81. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/__init__.py +0 -0
  82. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/benchmark.sh +0 -0
  83. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/bump.py +0 -0
  84. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/deposit_native.py +0 -0
  85. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/deposit_token.py +0 -0
  86. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscribe.py +0 -0
  87. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/agreement_manager.py +0 -0
  88. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/base_contract.py +0 -0
  89. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/did_registry.py +0 -0
  90. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/escrow_payment.py +0 -0
  91. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/lock_payment.py +0 -0
  92. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/nft.py +0 -0
  93. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/nft_sales.py +0 -0
  94. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/subscription_provider.py +0 -0
  95. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/token.py +0 -0
  96. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/contracts/transfer_nft.py +0 -0
  97. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/envs/base.env +0 -0
  98. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/envs/gnosis.env +0 -0
  99. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/manager.py +0 -0
  100. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/nvm_subscription/resources/networks.json +0 -0
  101. {mech_client-0.12.1 → mech_client-0.14.1}/scripts/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.12.1
3
+ Version: 0.14.1
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -34,7 +34,7 @@ A basic client to interact with an AI Mech. [AI Mechs](https://github.com/valory
34
34
 
35
35
  ## Developing, running and deploying Mechs and Mech tools
36
36
 
37
- The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://open-autonomy.docs.autonolas.tech/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
37
+ The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://stack.olas.network/open-autonomy/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
38
38
 
39
39
  Only continue reading this README if you know what you are doing and you are specifically interested in this repo.
40
40
 
@@ -152,7 +152,7 @@ The basic usage of the Mech Client is as follows:
152
152
  mechx interact --prompts <prompt> --tools <tool> --agent_id <agent_id>
153
153
  ```
154
154
 
155
- where agent with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
155
+ where agent blueprint with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent blueprint IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
156
156
 
157
157
  ⚠️ Batch requests and tools are not supported for legacy mechs
158
158
 
@@ -249,7 +249,7 @@ export MECHX_MECH_OFFCHAIN_URL="http://localhost:8000/"
249
249
  ```
250
250
  If you want to use a Valory mech for offchain requests, below is the list of mechs and their address and offchain urls.
251
251
 
252
- | Service ID | Priority Mech Address | Offchain URL |
252
+ | AI agent ID | Priority Mech Address | Offchain URL |
253
253
  | :---: | :---: | :---: |
254
254
  | 2182 | 0xB3C6319962484602b00d5587e965946890b82101 | https://d19715222af5b940.agent.propel.autonolas.tech/ |
255
255
 
@@ -274,7 +274,7 @@ mechx fetch-mm-mechs-info --chain-config gnosis
274
274
  ```
275
275
  ```bash
276
276
  +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
277
- | Service Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
277
+ | AI agent Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
278
278
  +==============+====================+============================================+====================+===============================================================================================================+
279
279
  | 2182 | Fixed Price Native | 0xc05e7412439bd7e91730a6880e18d5d5873f632c | 41246 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
280
280
  +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
@@ -291,7 +291,7 @@ mechx fetch-mm-mechs-info --chain-config gnosis
291
291
  ### List tools available for legacy mechs and marketplace mechs
292
292
 
293
293
  #### For legacy mechs
294
- To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent ID to get tools for a specific agent, or omit it to list tools for all agents.
294
+ To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent blueprint ID to get tools for a specific agent, or omit it to list tools for all agents.
295
295
 
296
296
  ```bash
297
297
  mechx tools-for-agents
@@ -332,7 +332,7 @@ You will see an output like this:
332
332
  ```
333
333
 
334
334
  #### For marketplace mechs
335
- To list the tools available for a specific marketplace mech, use the `tools-for-marketplace-mech` command. You can specify a service ID to get tools for a specific mech.
335
+ To list the tools available for a specific marketplace mech, use the `tools-for-marketplace-mech` command. You can specify an AI agent ID to get tools for a specific mech.
336
336
 
337
337
  ```bash
338
338
  mechx tools-for-marketplace-mech 1722 --chain-config gnosis
@@ -547,7 +547,7 @@ You can also use the Mech Client to programmatically fetch tools for agents in y
547
547
  from mech_client.mech_tool_management import get_tools_for_agents, get_tool_description, get_tool_io_schema
548
548
 
549
549
  # Fetching tools for a specific agent or all agents
550
- agent_id = 6 # Specify the agent ID or set to None to fetch tools for all agents
550
+ agent_id = 6 # Specify the agent blueprint ID or set to None to fetch tools for all agents
551
551
  chain_config = "gnosis" # Specify the chain configuration
552
552
  tools = get_tools_for_agents(agent_id=agent_id, chain_config=chain_config)
553
553
  print(f"Tools for agent {agent_id}:", tools)
@@ -613,9 +613,9 @@ No. AI Mechs are currently deployed only on mainnets.
613
613
 
614
614
  <details>
615
615
 
616
- <summary><b>Where can I find the agent ID?</b></summary>
616
+ <summary><b>Where can I find the agent blueprint ID?</b></summary>
617
617
 
618
- You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
618
+ You can find the agent blueprint IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
619
619
 
620
620
  </details>
621
621
 
@@ -11,7 +11,7 @@ A basic client to interact with an AI Mech. [AI Mechs](https://github.com/valory
11
11
 
12
12
  ## Developing, running and deploying Mechs and Mech tools
13
13
 
14
- The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://open-autonomy.docs.autonolas.tech/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
14
+ The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://stack.olas.network/open-autonomy/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
15
15
 
16
16
  Only continue reading this README if you know what you are doing and you are specifically interested in this repo.
17
17
 
@@ -129,7 +129,7 @@ The basic usage of the Mech Client is as follows:
129
129
  mechx interact --prompts <prompt> --tools <tool> --agent_id <agent_id>
130
130
  ```
131
131
 
132
- where agent with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
132
+ where agent blueprint with `<agent_id>` will process `<prompt>` with the `<tool>` and default options. Each chain has its own set of Mech agents. You can find the agent blueprint IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
133
133
 
134
134
  ⚠️ Batch requests and tools are not supported for legacy mechs
135
135
 
@@ -226,7 +226,7 @@ export MECHX_MECH_OFFCHAIN_URL="http://localhost:8000/"
226
226
  ```
227
227
  If you want to use a Valory mech for offchain requests, below is the list of mechs and their address and offchain urls.
228
228
 
229
- | Service ID | Priority Mech Address | Offchain URL |
229
+ | AI agent ID | Priority Mech Address | Offchain URL |
230
230
  | :---: | :---: | :---: |
231
231
  | 2182 | 0xB3C6319962484602b00d5587e965946890b82101 | https://d19715222af5b940.agent.propel.autonolas.tech/ |
232
232
 
@@ -251,7 +251,7 @@ mechx fetch-mm-mechs-info --chain-config gnosis
251
251
  ```
252
252
  ```bash
253
253
  +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
254
- | Service Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
254
+ | AI agent Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
255
255
  +==============+====================+============================================+====================+===============================================================================================================+
256
256
  | 2182 | Fixed Price Native | 0xc05e7412439bd7e91730a6880e18d5d5873f632c | 41246 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
257
257
  +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
@@ -268,7 +268,7 @@ mechx fetch-mm-mechs-info --chain-config gnosis
268
268
  ### List tools available for legacy mechs and marketplace mechs
269
269
 
270
270
  #### For legacy mechs
271
- To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent ID to get tools for a specific agent, or omit it to list tools for all agents.
271
+ To list the tools available for a specific agent or for all agents, use the `tools-for-agents` command. You can specify an agent blueprint ID to get tools for a specific agent, or omit it to list tools for all agents.
272
272
 
273
273
  ```bash
274
274
  mechx tools-for-agents
@@ -309,7 +309,7 @@ You will see an output like this:
309
309
  ```
310
310
 
311
311
  #### For marketplace mechs
312
- To list the tools available for a specific marketplace mech, use the `tools-for-marketplace-mech` command. You can specify a service ID to get tools for a specific mech.
312
+ To list the tools available for a specific marketplace mech, use the `tools-for-marketplace-mech` command. You can specify an AI agent ID to get tools for a specific mech.
313
313
 
314
314
  ```bash
315
315
  mechx tools-for-marketplace-mech 1722 --chain-config gnosis
@@ -524,7 +524,7 @@ You can also use the Mech Client to programmatically fetch tools for agents in y
524
524
  from mech_client.mech_tool_management import get_tools_for_agents, get_tool_description, get_tool_io_schema
525
525
 
526
526
  # Fetching tools for a specific agent or all agents
527
- agent_id = 6 # Specify the agent ID or set to None to fetch tools for all agents
527
+ agent_id = 6 # Specify the agent blueprint ID or set to None to fetch tools for all agents
528
528
  chain_config = "gnosis" # Specify the chain configuration
529
529
  tools = get_tools_for_agents(agent_id=agent_id, chain_config=chain_config)
530
530
  print(f"Tools for agent {agent_id}:", tools)
@@ -590,9 +590,9 @@ No. AI Mechs are currently deployed only on mainnets.
590
590
 
591
591
  <details>
592
592
 
593
- <summary><b>Where can I find the agent ID?</b></summary>
593
+ <summary><b>Where can I find the agent blueprint ID?</b></summary>
594
594
 
595
- You can find the agent IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
595
+ You can find the agent blueprint IDs for each chain on the [Mech Hub](https://aimechs.autonolas.network/registry) or on the [Mech repository](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs).
596
596
 
597
597
  </details>
598
598
 
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.14.1"
@@ -180,11 +180,6 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
180
180
  private_key_path=key,
181
181
  tools=tools,
182
182
  extra_attributes=extra_attributes_dict,
183
- confirmation_type=(
184
- ConfirmationType(confirm)
185
- if confirm is not None
186
- else ConfirmationType.WAIT_FOR_BOTH
187
- ),
188
183
  retries=retries,
189
184
  timeout=timeout,
190
185
  sleep=sleep,
@@ -0,0 +1,156 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ------------------------------------------------------------------------------
3
+ #
4
+ # Copyright 2025 Valory AG
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # ------------------------------------------------------------------------------
19
+
20
+ """Onchain delivery helpers."""
21
+
22
+ import time
23
+ from typing import Any, Dict, List, Optional, Tuple
24
+
25
+ from aea_ledger_ethereum import EthereumApi
26
+ from eth_abi import decode
27
+ from web3.constants import ADDRESS_ZERO
28
+ from web3.contract import Contract as Web3Contract
29
+
30
+
31
+ WAIT_SLEEP = 3.0
32
+ DELIVERY_MECH_INDEX = 1
33
+ DEFAULT_TIMEOUT = 900.0 # 15mins
34
+ IPFS_URL_TEMPLATE = "https://gateway.autonolas.tech/ipfs/f01701220{}"
35
+
36
+
37
+ async def watch_for_marketplace_data( # pylint: disable=too-many-arguments, unused-argument, too-many-locals
38
+ request_ids: List[str],
39
+ marketplace_contract: Web3Contract,
40
+ timeout: Optional[float] = None,
41
+ ) -> Any:
42
+ """
43
+ Watches for data on-chain.
44
+
45
+ :param request_ids: The IDs of the request.
46
+ :type request_ids: List[str]
47
+ :param marketplace_contract: The marketplace contract instance.
48
+ :type marketplace_contract: Web3Contract
49
+ :param timeout: Timeout to wait for the onchain data
50
+ :type timeout: float
51
+ :return: The data received from on-chain.
52
+ :rtype: Any
53
+ """
54
+ request_ids_data: Dict = {}
55
+ start_time = time.time()
56
+ # either use the timeout supplied by user or the default timeout of 15mins
57
+ timeout = timeout or DEFAULT_TIMEOUT
58
+ while True:
59
+ for request_id in request_ids:
60
+ request_id_info = marketplace_contract.functions.mapRequestIdInfos(
61
+ bytes.fromhex(request_id)
62
+ ).call()
63
+
64
+ # return empty data which is handled in the main method
65
+ if len(request_id_info) <= DELIVERY_MECH_INDEX:
66
+ return request_ids_data
67
+
68
+ delivery_mech = request_id_info[DELIVERY_MECH_INDEX]
69
+ if not isinstance(delivery_mech, str) or not delivery_mech.startswith("0x"):
70
+ return request_id_info
71
+
72
+ if delivery_mech != ADDRESS_ZERO:
73
+ request_ids_data.update({request_id: delivery_mech})
74
+
75
+ time.sleep(WAIT_SLEEP)
76
+
77
+ elapsed_time = time.time() - start_time
78
+ if elapsed_time >= timeout:
79
+ print("Timeout reached. Breaking the loop and returning empty data.")
80
+ return request_ids_data
81
+
82
+ if len(request_ids_data) == len(request_ids):
83
+ return request_ids_data
84
+
85
+
86
+ async def watch_for_mech_data_url( # pylint: disable=too-many-arguments, unused-argument, too-many-locals
87
+ request_ids: List[str],
88
+ from_block: int,
89
+ mech_contract_address: str,
90
+ mech_deliver_signature: str,
91
+ ledger_api: EthereumApi,
92
+ timeout: Optional[float] = None,
93
+ ) -> Any:
94
+ """
95
+ Watches for data on-chain.
96
+
97
+ :param request_ids: The IDs of the request.
98
+ :type request_ids: List[str]
99
+ :param from_block: The from block to start searching logs.
100
+ :type from_block: int
101
+ :param mech_contract_address: The mech contract instance.
102
+ :type mech_contract_address: str
103
+ :param mech_deliver_signature: Topic signature for Deliver event
104
+ :type mech_deliver_signature: str
105
+ :param ledger_api: The Ethereum API used for interacting with the ledger.
106
+ :type ledger_api: EthereumApi
107
+ :param timeout: Timeout to wait for the onchain data
108
+ :type timeout: float
109
+ :return: The data received from on-chain.
110
+ :rtype: Any
111
+ """
112
+
113
+ results = {}
114
+ start_time = time.time()
115
+ # either use the timeout supplied by user or the default timeout of 15mins
116
+ timeout = timeout or DEFAULT_TIMEOUT
117
+
118
+ def get_logs(from_block_: int) -> List:
119
+ logs = ledger_api.api.eth.get_logs(
120
+ {
121
+ "fromBlock": from_block_,
122
+ "toBlock": "latest",
123
+ "address": mech_contract_address,
124
+ "topics": ["0x" + mech_deliver_signature],
125
+ }
126
+ )
127
+ return logs
128
+
129
+ def get_event_data(log: Dict) -> Tuple:
130
+ data_types = ["bytes32", "uint256", "bytes"]
131
+ data_bytes = bytes(log["data"])
132
+ request_id_bytes, _, delivery_data_bytes = decode(data_types, data_bytes)
133
+ return request_id_bytes, delivery_data_bytes
134
+
135
+ while True:
136
+ logs = get_logs(from_block)
137
+ latest_block = from_block
138
+ for log in logs:
139
+ latest_block = max(latest_block, log["blockNumber"])
140
+ event_data = get_event_data(log)
141
+ request_id, delivery_data = (data.hex() for data in event_data)
142
+ if request_id in results:
143
+ continue
144
+
145
+ if request_id in request_ids:
146
+ results[request_id] = IPFS_URL_TEMPLATE.format(delivery_data)
147
+
148
+ if len(results) == len(request_ids):
149
+ return results
150
+
151
+ from_block = latest_block + 1
152
+ time.sleep(WAIT_SLEEP)
153
+ elapsed_time = time.time() - start_time
154
+ if elapsed_time >= timeout:
155
+ print("Timeout reached. Breaking the loop and returning empty data.")
156
+ return results
@@ -200,7 +200,7 @@ def calculate_topic_id(event: Dict) -> str:
200
200
  return Web3.keccak(text=text).hex()
201
201
 
202
202
 
203
- def get_event_signatures(abi: List) -> Tuple[str, str]:
203
+ def get_mech_event_signatures(abi: List) -> Tuple[str, str]:
204
204
  """Calculate `Request` and `Deliver` event topics"""
205
205
  request, deliver = "", ""
206
206
  for obj in abi:
@@ -576,13 +576,16 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
576
576
  mech_contract = get_contract(
577
577
  contract_address=contract_address, abi=abi, ledger_api=ledger_api
578
578
  )
579
- request_event_signature, deliver_event_signature = get_event_signatures(abi=abi)
579
+ request_event_signature, deliver_event_signature = get_mech_event_signatures(
580
+ abi=abi
581
+ )
580
582
  register_event_handlers(
581
583
  wss=wss,
582
- contract_address=contract_address,
584
+ mech_contract_address=contract_address,
585
+ marketplace_contract_address=contract_address,
583
586
  crypto=crypto,
584
- request_signature=request_event_signature,
585
- deliver_signature=deliver_event_signature,
587
+ mech_request_signature=request_event_signature,
588
+ marketplace_deliver_signature=deliver_event_signature,
586
589
  )
587
590
  print("Sending Mech request...")
588
591
  price = mech_config.price or 10_000_000_000_000_000