Skip to content

feat(nodejs-langgraph-agent): LangGraph ReAct agent with Dynamic server-side MPC wallet - #65

Open
avneesh0612 wants to merge 2 commits into
mainfrom
feat/nodejs-langgraph-agent
Open

feat(nodejs-langgraph-agent): LangGraph ReAct agent with Dynamic server-side MPC wallet#65
avneesh0612 wants to merge 2 commits into
mainfrom
feat/nodejs-langgraph-agent

Conversation

@avneesh0612

@avneesh0612 avneesh0612 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What

A minimal LangGraph ReAct agent (Claude Haiku 4.5) that acts through its own Dynamic server-side MPC wallet. The agent creates and owns its wallet entirely server-side — no user JWT, no delegation, no client-side approval flow required. On first run, a new MPC wallet is created and persisted to `.wallet-state.json`; subsequent runs reuse it.

Tools

Tool What it does
list_wallets Returns the agent's server wallet address.
get_token_balances Native-token balances across EVM chains via on-chain RPC (viem).
send_transaction Native transfer signed via Dynamic server-side MPC. Always gated behind a y/N confirm prompt.

Layout

src/wallet.ts   — DynamicEvmWalletClient init, .wallet-state.json persistence, sign + broadcast
src/tools.ts    — the three LangChain tools
src/agent.ts    — createReactAgent loop + system prompt
src/index.ts    — interactive terminal REPL
src/confirm.ts  — confirmation prompt for sensitive actions

Notes

  • Matches the repo's nodejs-* conventions: pnpm + tsx, dotenv, exact-pinned dependencies, .example.env.
  • Only .example.env (placeholders) is tracked; real .env and .wallet-state.json are gitignored.
  • pnpm typecheck passes; runtime startup verified (creates/loads the server wallet, then runs the REPL).

Security considerations

  • No secrets committed — .env* and .wallet-state.json are gitignored, only placeholder .example.env is tracked.
  • The agent never holds raw private keys; all signing goes through Dynamic's server-side MPC.
  • .wallet-state.json contains the server key share (written with 0o600 permissions) — treated like a private key.
  • send_transaction requires explicit y/N user confirmation before broadcasting.

🤖 Generated with Claude Code

… delegated MPC wallet

A minimal LangGraph ReAct agent (Claude Haiku 4.5) that acts on a user's
wallet through a Dynamic delegated MPC wallet — no private keys held by the
agent. Trimmed down from the full langgraph-dynamic-agent (drops Polymarket,
LI.FI, voice).

Tools:
- list_wallets — returns the delegated wallet address
- get_token_balances — Dynamic multi-chain balances API (optional USD prices)
- send_transaction — native transfer signed via Dynamic MPC, gated behind a
  y/N confirm prompt

Matches the repo's nodejs-* conventions (pnpm + tsx, dotenv, exact-pinned
deps, .example.env). Only .example.env (placeholders) is tracked; real .env is
gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kamino Error Error Jun 11, 2026 1:58am
nextjs-agentic-payments-x402 Error Error Jun 11, 2026 1:58am
nextjs-iron-ramp Ready Ready Preview, Comment Jun 11, 2026 1:58am
predictions-market-demo Ready Ready Preview, Comment Jun 11, 2026 1:58am

Request Review

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

There is no GitHub account connected to this Vercel account.

…op delegation + user JWT

- Replace delegated MPC wallet with DynamicEvmWalletClient server wallet; agent
  creates and owns its wallet on first run, persisted to .wallet-state.json (0o600,
  gitignored) — no user JWT or delegation credentials required
- get_token_balances now queries native balances on-chain via viem instead of the
  Dynamic balances API (which needed a user JWT)
- Migrate from deprecated createReactAgent (@langchain/langgraph/prebuilt) to
  createAgent from langchain@1.4.1 (llm→model, checkpointSaver→checkpointer,
  stateModifier→systemPrompt)
- Trim .example.env to just ANTHROPIC_API_KEY + DYNAMIC_ENVIRONMENT_ID + DYNAMIC_API_KEY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@avneesh0612 avneesh0612 changed the title feat(nodejs-langgraph-agent): bare-bones LangGraph agent on a Dynamic delegated MPC wallet feat(nodejs-langgraph-agent): LangGraph ReAct agent with Dynamic server-side MPC wallet Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant