Quickstart - Create a Hedera Agent
See the npm package: https://www.npmjs.com/package/hedera-agent-kit1. Create your project directory
2. Install the agent kit and init the project
Init and install with npm:package.json and add "type": "module" to enable ES modules.
Note: The Hedera Agent Kit supports both LangChain v1 (recommended) and LangChain classic (v0.3, legacy). The examples below use LangChain v1.
3. Install ONE of these AI provider packages
4. Add Environment Variables
Create a.env file in your directory:
.env file:
5. Create your agent
Once you have your project set up, create anindex.js file:
index.js
Using a different AI provider? You can substituteChatOpenAIwith other LangChain chat models likeChatAnthropic,ChatGroq, orChatOllama. Install the corresponding package (e.g.,@langchain/anthropic) and update the import accordingly.
6. Run Your “Hello Hedera Agent Kit” Example
From the root directory, run your example agent: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:- Option A - Tool Calling Agent: Simple tasks with Hedera tools in autonomous mode
- Option B - Structured Chat Agent: Complex multistep tasks (LangChain v0.3 only)
- Option C - Human in the Loop Agent: Controlled workflow with RETURN_BYTES mode
- Option D - MCP Server: Interact with Hedera via Claude Desktop or IDEs like Cursor
- Option E - ElizaOS Agent: Build autonomous AI agents with ElizaOS framework
Agent Execution Modes
This tool has two execution modes with AI agents:| Mode | Description |
|---|---|
AgentMode.AUTONOMOUS | The transaction is executed autonomously using the operator account |
AgentMode.RETURN_BYTES | The transaction bytes are returned for the user to sign and execute |
Resources
- GitHub: https://github.com/hashgraph/hedera-agent-kit-js
- npm: hedera-agent-kit
- Issues: https://github.com/hashgraph/hedera-agent-kit-js/issues
- Developer Examples: DEVEXAMPLES.md