Skip to content

feat: add MnemoPay action provider for agent economic memory#1089

Open
t49qnsx7qt-kpanks wants to merge 1 commit intocoinbase:mainfrom
t49qnsx7qt-kpanks:feat/mnemopay-action-provider
Open

feat: add MnemoPay action provider for agent economic memory#1089
t49qnsx7qt-kpanks wants to merge 1 commit intocoinbase:mainfrom
t49qnsx7qt-kpanks:feat/mnemopay-action-provider

Conversation

@t49qnsx7qt-kpanks
Copy link
Copy Markdown

@t49qnsx7qt-kpanks t49qnsx7qt-kpanks commented Apr 2, 2026

Summary

  • Adds a new mnemopay action provider that integrates the MnemoPay SDK, giving AI agents economic memory — they remember payment outcomes, learn from settlements/refunds, and build reputation over time.
  • Provides 7 actions: remember_outcome, recall_memories, charge_payment, settle_payment, refund_payment, check_balance, agent_profile
  • Includes full test suite, Zod schemas, and documentation following the existing action-provider pattern

Why economic memory matters for agents

Today's AI agents are economically amnesiac — they make the same payment mistakes repeatedly, can't learn which providers deliver quality work, and have no reputation that persists across sessions. This is a fundamental limitation for any agent that handles money.

MnemoPay solves this by giving agents a memory-payment feedback loop:

  1. Remember: Agent stores memories about interactions (provider quality, payment outcomes, patterns)
  2. Recall: Agent queries memories semantically to inform future decisions
  3. Charge: Agent initiates a payment, creating an escrow
  4. Settle: Good outcome → reinforces the memories that led to the decision (+0.05 reputation)
  5. Refund: Bad outcome → weakens those memories (-0.05 reputation)

Over time, agents develop a reputation score that reflects their economic track record. An agent with high reputation has a history of making good economic decisions — choosing reliable providers, fair prices, and successful transactions.

Example flow

import { mnemoPayActionProvider } from "@coinbase/agentkit";

const agentkit = new AgentKit({
  actionProviders: [
    mnemoPayActionProvider({ agentId: "trading-agent-1", decayRate: 0.05 }),
  ],
});

// Agent remembers: "Provider X delivered high-quality design work on time"
// Agent charges: $50 for the next task with Provider X
// Work delivered well → Agent settles → reputation +0.05, memory reinforced
// Next time: Agent recalls "good design providers" → Provider X ranks high

Implementation details

  • Follows the exact same pattern as twitter, wallet, and other action-providers (decorator-based, Zod schemas, factory function)
  • Network-agnostic (supportsNetwork always returns true) — operates at the application layer
  • Lazy-loads the SDK via dynamic import() to avoid bundling issues
  • Configuration via constructor or environment variables (MNEMOPAY_AGENT_ID, MNEMOPAY_DECAY_RATE)
  • Self-contained — only requires @mnemopay/sdk as a peer dependency

Files changed

  • typescript/agentkit/src/action-providers/mnemopay/mnemopayActionProvider.ts — Main provider (7 actions)
  • typescript/agentkit/src/action-providers/mnemopay/schemas.ts — Zod input schemas
  • typescript/agentkit/src/action-providers/mnemopay/mnemopayActionProvider.test.ts — Full test coverage
  • typescript/agentkit/src/action-providers/mnemopay/index.ts — Exports
  • typescript/agentkit/src/action-providers/mnemopay/README.md — Documentation
  • typescript/agentkit/src/action-providers/index.ts — Added mnemopay export

Test plan

  • Unit tests for all 7 actions (success and error cases)
  • Constructor tests (config, env vars, defaults)
  • supportsNetwork returns true for all networks
  • Integration test with live MnemoPay SDK (requires @mnemopay/sdk installed)

🤖 Generated with Claude Code

Live Demo

Try it now: https://t49qnsx7qt-kpanks.github.io/mnemopay-demo/

The Feedback Loop in 30 Seconds

Round 1: Agent has NO memory. Picks randomly.
  -> Hired Alice $80. Fast but buggy.
  -> Settled. Reputation: 0.51 | Memories: 1

Round 2: Agent tries Bob.
  -> Hired Bob $120. Perfect quality, on time.
  -> Settled. Reputation: 0.52 | Memories: 2

Round 3: Agent tries Carol.
  -> Hired Carol $95. Missed deadline by 3 days.
  -> REFUNDED. Reputation: 0.52 | Memories: 3

=== Agent recalls before Round 4 ===

  1. [score: 0.900] Carol missed deadline — refund (high importance, decaying)
  2. [score: 0.750] Bob: perfect quality, on time (reinforced by settle)
  3. [score: 0.600] Alice: fast but buggy (neutral)

Result: Agent now picks Bob. No LLM needed for this insight.
settle() reinforced the memory. refund() flagged the failure.
This IS the MnemoPay feedback loop.

How it works

Payment succeeds → settle() → memories that led to decision get +0.05 importance
Payment fails    → refund() → agent reputation docked -0.05
                 → high-importance failure memory stored
Over time        → agent consistently picks best value providers

5-line integration

import { MnemoPay } from '@mnemopay/sdk';

const agent = MnemoPay.quick('my-agent');
await agent.remember('Bob delivers perfect code');
const tx = await agent.charge(120, 'landing page');
await agent.settle(tx.id); // memories reinforced, reputation +0.01

Adds a new action provider that integrates the MnemoPay SDK, giving AI agents
economic memory — they can remember payment outcomes, learn from settlements
and refunds, and build reputation over time.

Actions: remember_outcome, recall_memories, charge_payment, settle_payment,
refund_payment, check_balance, agent_profile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cb-heimdall
Copy link
Copy Markdown

cb-heimdall commented Apr 2, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider typescript labels Apr 2, 2026
@t49qnsx7qt-kpanks
Copy link
Copy Markdown
Author

Hey team! Added a live interactive demo to the PR description: try it here. It shows the feedback loop in action — an agent hiring freelancers, learning from settlements and refunds, and consistently picking the best value by round 7-8. The core idea: settle() reinforces the memories that led to good decisions, refund() flags failures. Over time, the agent develops economic intuition without any LLM reasoning needed. Happy to walk through the implementation or answer any questions!

@t49qnsx7qt-kpanks
Copy link
Copy Markdown
Author

Hi team 👋 — just checking in on this. MnemoPay v0.4.0 shipped this week with fraud detection, ML anomaly detection (opt-in), and dispute resolution. The action provider in this PR is fully tested and ready to go.

Happy to address any feedback or questions. Demo available if helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

2 participants