Skip to main content

No project description provided

Project description

Hedera Agent Kit - CoinCap Plugin Python version

A plugin for Hedera Agent Kit PY that provides integration with the CoinCap API

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.

Overview

This plugin enables AI agents to interact with the CoinCap API

Installation in the example index.js agent

1.- Install the plugin

pip install coincap-hedera-agent-kit-plugin

2.- Add your CoinCap API Bearer token in the .env file ( You get it in the CoinCap website )

# Coincap API needed by coincap-hedera-plugin
COINCAP_BEARER_TOKEN=******************************

3.- Import the plugin code in your index.js (Hedera Agent)

from coincap_hedera_plugin import conincap_h_plugin

4.- Add the plugin in the plugins secion of the agent

const hederaAgentToolkit = new HederaLangchainToolkit({
client,
configuration: {
    tools: [],
    plugins: [coreQueriesPlugin, coreAccountPlugin, CoinCapHederalugin], // <---- Add these

5.- Use a prompt to ask for you current balance and tell the agent to want it in USD currency, for example like this:

response = await agent.ainvoke(
    {"messages": [{"role": "user", "content": "Get my balance in HBAR and also convert it to USD please"}]},

6.- Now you can run the example agent and you should get your current HBAR balance converted to USD currency

python main.py

Tools

# Use the CoinCap API to get the current price in USD of one HBAR
def get_hbar_price_from_coincap():

(Optional, only needed when creating your own python package) How to publish a PyPi package

1.- Read the instructions

1.- Create the distribution package

python setup.py sdist

2.- Install twine

pip install twine

3.- Upload package

twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coincap_hedera_agent_kit_plugin-0.4.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file coincap_hedera_agent_kit_plugin-0.4.tar.gz.

File metadata

File hashes

Hashes for coincap_hedera_agent_kit_plugin-0.4.tar.gz
Algorithm Hash digest
SHA256 30961ad33b0c868264cdbe0a4cc07ed2f5a78dbc0f800ac49086ad115bd6a4be
MD5 534a55c36326e5f133b4273559e0ba16
BLAKE2b-256 1b317aaa1c530fe379f8ad3384bcea47c24af306b1fe624261ddea6cdb4830e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page