hashgraph / hashgraph/hedera-agent-kit-js

PolicyMesh — DePIN procurement agent (Filecoin/Akash) with policies on REST + LangChain

Open
#950 0 comments 0 reactions 1 assignee Claimed by @walkerlj0 View on GitHub
bounty-feeback feedback
Dominant language
TypeScript
Stars
67
Forks
78
PR merge metrics
No merged PRs in 30d

Description

### Contact Info

@avi-3012

### Describe your feedback, bug, or feature request

## What I built

PolicyMesh - an autonomous procurement agent that buys Filecoin storage and Akash compute with HBAR/USDC, with spending rules enforced by Hedera Agent Kit v4.

- Repo: https://github.com/avi-3012/Policymesh
- Live demo: https://policymesh-blond.vercel.app
- API:https://policymesh.onrender.com

This is a DePIN / infrastructure procurement use case - not HBAR transfers or x402 payments.

## How I used Agent Kit

5 custom policies:budget (HBAR + USDC), service type, provider allowlist, reputation, delivery verification.

3 custom hooks: audit, CoinGecko price oracle, notifications.

5 custom BaseTools: `procure_filecoin_storage`, `procure_akash_compute`, and swap quote tools - registered via a custom plugin + `HederaLangchainToolkit`.

Important for this project: the same policies run on two paths:
1. REST API (`POST /api/procure/storage`, `/compute`) - used by the web dashboard
2. LangChain agent (`POST /api/agent/chat`) - natural language procurement

Both paths hit the same policy engine. That dual-path pattern isn’t shown in the docs.

Human approval: purchases over 100 HBAR go to `awaiting_confirmation` and need `POST /api/confirmations/:id/approve`. I built this in my Express API, not via kit HITL - worked fine for a dashboard demo.

HCS: real testnet audit messages on every procurement decision (`HcsAuditTrailHook` + custom audit hook).

## What worked well

- `AbstractPolicy` / `AbstractHook` fit “budget cap + allowlist + audit everything” really naturally for buying infra.
- `HederaLangchainToolkit` + custom plugin - my procurement tools showed up in the agent without much glue code.
- Policies enforced consistently whether the user clicks “Procure” in the UI or chats with the agent.
- Shipped live on Render + Vercel with testnet HCS.

## What was specific to this project (not covered elsewhere)

- Docs/examples are transfer-focused. I needed procurement-shaped tools (sizeGB, durationDays, provider selection) - figured it out from `BaseTool` + plugin source, no end-to-end “custom tool for a non-transfer workflow” tutorial.
- No doc for one policy set, two entry points (REST + LangChain). Other bounty projects seem to pick one; I needed both for judges (UI + agent chat).
- Human confirmation in a web app - I used my own REST confirmation flow. A small “approval queue + resume” recipe for dashboard apps would help.

## Ask

A short example: custom procurement tool + plugin + same policies on REST and LangChain + HCS audit - would help the next DePIN/agent builder a lot.

### What type of feedback is this?

- [x] General Feedback
- [ ] Bug or Suggestion
- [ ] Feature Request
- [ ] Other

### What does this feedback apply to?

- [x] Hedera Agent Kit JS
- [ ] Hedera Agent Kit Python
- [ ] Feature Request
- [ ] Other

### What you expected vs what you experienced

Expected: Build an agent that buys decentralized storage/compute with policy limits and a live dashboard + chat interface.

Actual: Policies and LangChain integration worked well. The gap was examples for infrastructure procurement (not transfers) and for running the same policies on REST and the agent. Human approval I handled outside the kit via `/api/confirmations` — fine for my app, not documented as a pattern.

### Relevant links or resources

https://github.com/avi-3012/Policymesh
https://policymesh-blond.vercel.app/
https://policymesh.onrender.com/api/policies
Custom tools: packages/agent/src/tools/ProcurementTools.js
LangChain wiring: packages/agent/src/agent/LangChainProcurementService.js

### Score (1-10): How confident did you feel after reading the docs that you could build successfully?

8

### Score (1-10): How easy was it to get help when you were blocked?

7

### Score (1-10): How intuitive were the APIs / SDKs to use?

8

### Score (1-10): How easy was it to debug issues?

7

### Score (1-10): How likely are you to build again on Hedera again?

8

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.