Skip to main content

Overview

Build LLM-powered applications that interact with the Hedera Network using Python. Create conversational agents that can understand user requests in natural language and execute Hedera transactions, or build backend systems that leverage AI for on-chain operations. This is the Python edition of the Hedera Agent Kit, providing a flexible and extensible framework for building AI-powered Hedera agents.
Note: See also the JavaScript SDK documentation for the JS/TypeScript version.
The Hedera Agent Kit (Python) provides:
  • Plugin Architecture: Extensible design for easy customization
  • LangChain Integration: Support for LangChain v1 and LangChain Classic
  • ADK Integration: Support for Google’s AI Development Kit (ADK)
  • Comprehensive Hedera Tools: Token creation (HTS), smart contracts (EVM), account operations, topics (HCS), and more
  • Autonomous Execution: Direct transaction execution on the Hedera network
  • Return Bytes Mode: Option to return raw transaction bytes for manual signing and execution (human-in-the-loop)
  • Hooks and policies: Customize agent behavior with pre- and post-tool call hooks, and execution policies
  • Extensive Examples: Ready-to-run examples demonstrating various agent configurations and use cases, including MCP server integration

Quickstart — Create a Hedera Agent

See the PyPI package at: https://pypi.org/project/hedera-agent-kit/

1. Create your project directory

2. Set up virtual environment and install dependencies

Create and activate a virtual environment:
Install dependencies:

3. Install ONE of these AI provider packages

The example below uses OpenAI and is written for LangChain V1 (Python). It does not use the older LangChain “classic” API. If you want to use a different model provider (Anthropic, Groq, Ollama, etc.), check the LangChain Python integrations docs here.For the LangChain classic example code, refer to the example in the Hedera Agent Kit (Python) repo.

4. Add Environment Variables

Create a .env file in your directory:
If you don’t already have a Hedera account, create a testnet account at portal.hedera.com. Add the following to the .env file:

5. Create your agent

Create a main.py file:
main.py
Using a different AI provider? You can substitute ChatOpenAI with other LangChain chat models like ChatAnthropic, ChatGroq, or ChatOllama. Install the corresponding package and update the import accordingly.

6. Run Your “Hello Hedera Agent Kit” Example

From the root directory, run your example agent:

About the Agent Kit

Agent Execution Modes

The Python SDK currently supports one execution mode:
ModeStatusDescription
AgentMode.AUTONOMOUS✅ SupportedTransactions are executed directly using the operator account
AgentMode.RETURN_BYTES✅ SupportedTransaction bytes returned for user signing (human-in-the-loop)

Agent Kit Plugins

The Hedera Agent Kit provides tools organized into plugins by the type of Hedera service they interact with. Available Plugins
PluginDescription
core_account_pluginTools for Hedera Account Service operations (transfer HBAR, create/update/delete accounts, manage allowances)
core_account_query_pluginTools for querying account data (balances, account info, token balances)
core_consensus_pluginTools for Hedera Consensus Service (HCS) operations (create/update/delete topics, submit messages)
core_consensus_query_pluginTools for querying HCS data (topic messages, topic info)
core_token_pluginTools for Hedera Token Service (HTS) operations (create/mint/transfer tokens, manage allowances)
core_token_query_pluginTools for querying HTS data (token info, pending airdrops)
core_evm_pluginTools for interacting with EVM smart contracts (ERC-20, ERC-721 tokens)
core_misc_query_pluginTools for miscellaneous queries (exchange rates)
core_transaction_query_pluginTools for transaction-related queries (get transaction records)
See the full plugin documentation: HEDERAPLUGINS.md

Requests and Contributions

To request additional functionality, please open an issue. To contribute to the Hedera Agent Kit (Python), see the repository’s contributing guidelines.

Resources

Examples Clone the repository and try out different example agents. Both LangChain v1 (recommended) and LangChain Classic (v0.3) examples are available. See the full Developer Examples documentation for detailed setup instructions. Available Examples: