HCS Agent Protocol
Hedera Agent Kit is an open-source toolkit for building AI agents that interact with the Hedera network, enabling on-chain actions like token transfers, account management, and data storage through a conversational interface. It provides a core SDK and adapters for popular AI frameworks, targeting developers who want to integrate Hedera blockchain functionality into agent applications.
✨ Key features
- Core SDK with Hedera plugins for account, token, and consensus operations
- Framework adapters for LangChain, Vercel AI SDK, ElizaOS, MCP, and Google ADK
- Hooks and policies to enforce business logic and security limits
- Extensible with third-party plugins
- CLI scaffold tool for bootstrapping Next.js agent apps
- Supports multiple LLM providers including free options like Ollama and Groq
🎯 Use cases
- Build AI agents that can send tokens and manage accounts on Hedera
- Create agents that store data on Hedera Consensus Service
- Enforce compliance or security rules on agent tool usage
- Develop custom plugins to extend agent capabilities
- Scaffold new agent projects with create-hedera-agent
📦 Installation
🧰 Requirements: Node.js with npm, a Hedera testnet account (ACCOUNT_ID and PRIVATE_KEY), and an API key for your chosen AI provider (OpenAI, Anthropic, Groq, or none for Ollama).
mkdir hello-hedera-agent-kit
cd hello-hedera-agent-kit
npm init -y
Add "type": "module" to package.json.
npm install @hiero-ledger/sdk @hashgraph/hedera-agent-kit @hashgraph/hedera-agent-kit-langchain langchain @langchain/openai dotenv
Create a .env file with your Hedera credentials and AI provider API key.
🚀 Usage
// index.ts
import { Client, PrivateKey } from '@hiero-ledger/sdk';
import { AgentMode } from '@hashgraph/hedera-agent-kit';
import { allCorePlugins } from '@hashgraph/hedera-agent-kit/plugins';
import { HederaLangchainToolkit } from '@hashgraph/hedera-agent-kit-langchain';
import { ChatOpenAI } from '@langchain/openai';
import { createAgent } from 'langchain';
import * as dotenv from 'dotenv';
dotenv.config();
async function main() {
const client = Client.forTestnet().setOperator(
process.env.ACCOUNT_ID!,
PrivateKey.fromStringECDSA(process.env.PRIVATE_KEY!)
);
const toolkit = new HederaLangchainToolkit({
client,
configuration: {
plugins: allCorePlugins,
context: { mode: AgentMode.AUTONOMOUS },
},
});
const agent = createAgent({
model: new ChatOpenAI({ model: 'gpt-4o-mini' }),
tools: toolkit.getTools(),
systemPrompt: 'You are a helpful assistant with access to Hedera blockchain tools',
});
const response = await agent.invoke({
messages: [{ role: 'user', content: 'Send 1 HBAR to 0.0.1234' }],
});
console.log(response);
}
main().catch(console.error);
⚠️ Good to know
The built-in EVM/ERC tools currently require an ECDSA operator key; the Hedera EVM itself supports both key types.
❓ FAQ
What are the free AI options?
Ollama is 100% free and runs locally without an API key. Groq offers a generous free tier with an API key. Claude and OpenAI are paid options for production use.
How do I switch between ECDSA and ED25519 private keys?
Use the typed constructors: PrivateKey.fromStringECDSA() for ECDSA (default) and PrivateKey.fromStringED25519() for ED25519. The untyped fromString() is deprecated.
Can I use the agent kit with frameworks other than LangChain?
Yes, the monorepo includes adapters for Vercel AI SDK, ElizaOS, MCP, and Google ADK. You install the core package plus the adapter for your framework.
How can I enforce limits on agent tool usage?
The kit provides hooks and policies that can be called at various stages of tool execution to enforce security, compliance, and business rules. Examples include an HCS audit trail hook and a max recipients policy.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.