coincap-hedera-agent-kit-plugin 0.8__tar.gz → 0.9__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 (16) hide show
  1. coincap_hedera_agent_kit_plugin-0.9/MANIFEST.in +1 -0
  2. {coincap_hedera_agent_kit_plugin-0.8/src/coincap_hedera_agent_kit_plugin.egg-info → coincap_hedera_agent_kit_plugin-0.9}/PKG-INFO +1 -1
  3. coincap_hedera_agent_kit_plugin-0.9/README.md +123 -0
  4. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/setup.py +2 -1
  5. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9/src/coincap_hedera_agent_kit_plugin.egg-info}/PKG-INFO +1 -1
  6. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_agent_kit_plugin.egg-info/SOURCES.txt +2 -0
  7. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/LICENSE +0 -0
  8. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/README.rst +0 -0
  9. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/setup.cfg +0 -0
  10. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_agent_kit_plugin.egg-info/dependency_links.txt +0 -0
  11. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_agent_kit_plugin.egg-info/requires.txt +0 -0
  12. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_agent_kit_plugin.egg-info/top_level.txt +0 -0
  13. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_plugin/__init__.py +0 -0
  14. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_plugin/coincap_plugin/__init__.py +0 -0
  15. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_plugin/coincap_plugin/plugin.py +0 -0
  16. {coincap_hedera_agent_kit_plugin-0.8 → coincap_hedera_agent_kit_plugin-0.9}/src/coincap_hedera_plugin/coincap_plugin/tool.py +0 -0
@@ -0,0 +1 @@
1
+ include README.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coincap-hedera-agent-kit-plugin
3
- Version: 0.8
3
+ Version: 0.9
4
4
  Home-page: https://github.com/henrytongv/coincap-hedera-plugin-py
5
5
  Author: Henry Tong
6
6
  Author-email: taksantong@gmail.com
@@ -0,0 +1,123 @@
1
+ # Hedera Agent Kit - CoinCap Plugin Python version
2
+
3
+ A plugin for [Hedera Agent Kit PY](https://github.com/hashgraph/hedera-agent-kit-py) that provides integration with the CoinCap API
4
+
5
+ In this plugin we use CoinCap to get the current price in USD of one HBAR and combine it with the power of the Hedera Agent Kit to get your current balance of HBA in USD currency.
6
+
7
+ ## Overview
8
+
9
+ This plugin enables `AI agents` to interact with the CoinCap API
10
+
11
+ ## Installation in the example index.js agent
12
+
13
+ 1.- Install the plugin
14
+
15
+ ```bash
16
+ pip install coincap-hedera-agent-kit-plugin
17
+ ```
18
+
19
+ 2.- Add your CoinCap API Bearer token in the .env file ( You get it in the CoinCap website )
20
+
21
+ ```
22
+ # Coincap API needed by coincap-hedera-plugin
23
+ COINCAP_BEARER_TOKEN=******************************
24
+ ```
25
+
26
+ 3.- Import the plugin code in your index.js (Hedera Agent)
27
+
28
+ ```py
29
+ from coincap_hedera_plugin import conincap_h_plugin
30
+ ```
31
+
32
+ 4.- Import the core_account_query_plugin plugin code
33
+
34
+ This core plugin is already provided by the Hedera, it is needed to query the account (read its balance)
35
+ ```py
36
+ from hedera_agent_kit.plugins import core_account_query_plugin
37
+ ```
38
+
39
+ 5.- Add the plugin in the plugins secion of the agent
40
+
41
+ ```py
42
+ async def main():
43
+ ...
44
+ configuration=Configuration(
45
+ tools=[],
46
+ plugins=[
47
+ core_account_query_plugin,
48
+ conincap_h_plugin # <---- add the plugin here
49
+ ```
50
+
51
+ 6.- Use a prompt to ask for you current balance and tell the agent to want it in USD currency, for example like this:
52
+
53
+ ```py
54
+ response = await agent.ainvoke(
55
+ {"messages": [{"role": "user", "content": "Get my balance in HBAR and also convert it to USD please"}]},
56
+ ```
57
+
58
+ > [!NOTE]
59
+ > The previous prompt results in a multi-step tool invocation:
60
+ >
61
+ > - Fetch the HBAR balance.
62
+ > - Fetch the current HBAR price.
63
+ > - Convert the balance to USD.
64
+ >
65
+ > It is important for developers to be aware of, as configurations that limit the agent to only one tool call per request will cause this prompt to fail or behave incorrectly.
66
+
67
+ 7.- Now you can run the example agent and you should get your current HBAR balance converted to USD currency
68
+
69
+ ```bash
70
+ python main.py
71
+ ```
72
+
73
+ ## Tools
74
+
75
+ ### Get HBAR price in USD
76
+ Invoke the CoinCap API to get the current price in USD of one HBAR
77
+
78
+ #### Python Function
79
+ ```py
80
+ def get_hbar_price_from_coincap():
81
+ ```
82
+
83
+ #### Input Parameters
84
+
85
+ None
86
+
87
+ #### Output Values
88
+
89
+ | Value | Type | Description |
90
+ |---------|----------|-------------|
91
+ | Result | `float` | Value in USD currency of 1 HBAR according to CoinCap |
92
+
93
+ #### Example Prompt
94
+
95
+ ```
96
+ Get my balance in HBAR and also convert it to USD please
97
+ ```
98
+
99
+ ## Optional - Code building, only needed when working on the source code
100
+
101
+ Use a code formatter, for example `black`
102
+ ```bash
103
+ pip install black
104
+ black .
105
+ ```
106
+
107
+ ## Optional - Distribution, only needed when creating your own python package) How to publish a PyPi package
108
+ 1.- Read the [instructions](https://towardsdatascience.com/how-to-upload-your-python-package-to-pypi-de1b363a1b3/)
109
+
110
+ 1.- Create the distribution package
111
+ ```bash
112
+ python setup.py sdist
113
+ ```
114
+
115
+ 2.- Install twine
116
+ ```bash
117
+ pip install twine
118
+ ```
119
+
120
+ 3.- Upload package
121
+ ```bash
122
+ twine upload dist/*
123
+ ```
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="coincap-hedera-agent-kit-plugin",
5
- version="0.8",
5
+ version="0.9",
6
6
  license="MIT",
7
7
  author="Henry Tong",
8
8
  author_email="taksantong@gmail.com",
@@ -16,4 +16,5 @@ setup(
16
16
  "hedera-agent-kit",
17
17
  "requests",
18
18
  ],
19
+ include_package_data=True
19
20
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coincap-hedera-agent-kit-plugin
3
- Version: 0.8
3
+ Version: 0.9
4
4
  Home-page: https://github.com/henrytongv/coincap-hedera-plugin-py
5
5
  Author: Henry Tong
6
6
  Author-email: taksantong@gmail.com