This guide will help you set up your development environment and run your first payment-enabled AI agent.
- Python 3.10+
- Poetry for dependency management
- Git for cloning the repository
- Open https://nevermined.app/ and sign in with your account
- Navigate to API Keys > Global NVM API Keys
- Click + New API Key
- Give your key a descriptive name, select the permissions you need, and click Generate API Key
- Click Copy Key to copy it to your clipboard and store it securely
Note: API keys are environment-specific. Sandbox keys begin with
sandbox:and live keys start withlive:. Keep your API key secure — don't commit it to version control or share it publicly.
A payment plan controls how users pay to access your agent.
- In the Nevermined App, click "Create Agent" or "My Pricing Plans"
- Fill in your agent metadata (name, description)
- Register API Endpoints: Add the endpoints you want to protect
- For HTTP agents:
POST /ask,GET /data, etc. - For MCP: Use logical URLs like
mcp://my-agent/tools/my-tool
- For HTTP agents:
- Create a payment plan:
- Credit-based: Pay per request (recommended for getting started)
- Time-based: Pay for access period
- Trial: Free trial for testing
- Copy your Plan ID from the plan details
# Clone the repository
git clone https://github.com/nevermined-io/hackathons.git
cd hackathonsEach agent is in the agents/ directory with its own dependencies and .env.example:
| Agent | What it does | Run command |
|---|---|---|
| Buyer Agent | Discovers sellers, purchases data, tracks spending | poetry run python -m src.agent |
| Seller Agent | Sells data/services with tiered pricing | poetry run python -m src.agent |
| MCP Server | Payment-protected MCP tools | poetry run python -m src.server |
| Strands Agent | Strands SDK with payment tools | poetry run python agent.py |
Example — running the seller agent:
cd agents/seller-simple-agent
poetry install
cp .env.example .env
# Edit .env with your credentials
poetry run python -m src.agentNote: All agents use
package-mode = false, so usepoetry run python -m src.<module>(notpoetry run agent).
In a new terminal, run the client:
poetry run python -m src.clientYou should see:
- 402 Payment Required — First request without token
- Token generation — Client gets x402 access token
- 200 OK — Second request with token succeeds
┌─────────┐ ┌─────────┐
│ Client │ │ Agent │
└────┬────┘ └────┬────┘
│ │
│ 1. POST /ask (no token) │
│───────────────────────────────────────>│
│ │
│ 2. 402 Payment Required │
│ Header: payment-required │
│<───────────────────────────────────────│
│ │
│ 3. Generate x402 token via SDK │
│ │
│ 4. POST /ask │
│ Header: payment-signature │
│───────────────────────────────────────>│
│ │
│ 5. 200 OK + response │
│ Header: payment-response │
│<───────────────────────────────────────│
- Customize your agent — Modify the business logic
- Add more endpoints — Protect additional routes
- Deploy to AWS — See AWS Integration and Deploy to AgentCore
- Run the multi-agent demo — See the Buyer Agent README for a full buyer-seller marketplace walkthrough
Make sure your .env file exists and contains valid credentials.
- Verify your
NVM_PLAN_IDis correct - Check that you have credits in your plan
- Ensure the endpoint URL matches your plan configuration
- Tokens expire — generate a new one
- Check that you're using the correct plan ID