# PeptBase Agent - OpenClaw Skill

## Overview

PeptBase Agent is a research-grade peptide intelligence API available at `https://agent.peptbase.xyz`. It provides structured, citation-backed peptide research data through JSON endpoints. All access is authenticated via Solana wallet signature.

## Base URL

```
https://agent.peptbase.xyz
```

## Authentication

PeptBase uses Solana wallet signature authentication. All protected endpoints require a valid session token obtained through the wallet challenge flow.

### Auth Flow

1. **Request challenge:**
```http
POST https://agent.peptbase.xyz/api/auth/challenge
Content-Type: application/json

{
  "wallet_address": "<your_solana_wallet_address>"
}
```

Response:
```json
{
  "wallet_address": "...",
  "nonce": "...",
  "message": "Sign in to PeptBase\n\nWallet: ...\nNonce: ...\nIssued At: ...\nExpires At: ...",
  "issued_at": "...",
  "expires_at": "..."
}
```

2. **Sign the message** with your Solana wallet private key (ed25519 signature, base58 encoded).

3. **Verify and get session:**
```http
POST https://agent.peptbase.xyz/api/auth/verify-wallet
Content-Type: application/json

{
  "wallet_address": "<your_solana_wallet_address>",
  "message": "<the_challenge_message>",
  "signature": "<base58_encoded_signature>"
}
```

Response:
```json
{
  "verified": true,
  "wallet_address": "...",
  "access_level": "research",
  "session": {
    "token": "<session_token>",
    "wallet_address": "...",
    "access_level": "research",
    "expires_at": "..."
  }
}
```

4. **Use session token** on all subsequent requests:
```http
Authorization: Bearer <session_token>
```

## Available Tools

### peptbase_ask

Ask a peptide research question.

```http
POST https://agent.peptbase.xyz/api/agent
Authorization: Bearer <session_token>
Content-Type: application/json

{
  "question": "What is the mechanism of action of BPC-157?",
  "mode": "research",
  "provider": "copilot"
}
```

**Parameters:**
- `question` (string, required): The research question
- `mode` (string, optional): `quick` | `research` | `deep` (default: `research`)
- `provider` (string, optional): `local` | `copilot` (default: `copilot`)

### peptbase_compare

Compare 2-4 peptides side by side.

```http
POST https://agent.peptbase.xyz/api/compare
Authorization: Bearer <session_token>
Content-Type: application/json

{
  "peptides": ["bpc-157", "tb-500"],
  "mode": "research",
  "provider": "copilot"
}
```

**Parameters:**
- `peptides` (array of strings, required): 2-4 peptide slugs or names
- `mode` (string, optional): `quick` | `research` | `deep`
- `provider` (string, optional): `local` | `copilot`

### peptbase_protocol

Build a research-context peptide stack for a goal.

```http
POST https://agent.peptbase.xyz/api/protocol
Authorization: Bearer <session_token>
Content-Type: application/json

{
  "goal": "recovery",
  "risk_level": "conservative",
  "mode": "research",
  "provider": "copilot"
}
```

**Parameters:**
- `goal` (string, required): `recovery` | `longevity` | `sleep` | `fat_loss` | `inflammation` | `cognitive_support` | `skin`
- `risk_level` (string, required): `conservative` | `balanced` | `experimental`
- `mode` (string, optional): `quick` | `research` | `deep`
- `provider` (string, optional): `local` | `copilot`

### peptbase_get_profile

Retrieve a peptide profile by slug.

```http
GET https://agent.peptbase.xyz/api/peptide/{slug}
Authorization: Bearer <session_token>
```

**Parameters:**
- `slug` (string, required): Peptide slug (e.g., `bpc-157`, `tb-500`, `ipamorelin`)

## OpenClaw Tool Registration

Register PeptBase as an external HTTP tool in OpenClaw using the manifest at:

```
https://agent.peptbase.xyz/openclaw.plugin.json
```

Or use the simplified tool manifest:

```
https://agent.peptbase.xyz/openclaw.tool.json
```

## Response Format

All responses are JSON with a mandatory research disclaimer:

```json
{
  "answer": { ... },
  "limitations": ["..."],
  "disclaimer": "This is for research and educational purposes only, not medical advice. PeptBase does not diagnose, treat, cure, or prevent any disease."
}
```

## Example Prompts for OpenClaw

- "Ask PeptBase what BPC-157 is used for in research context."
- "Compare BPC-157 and TB-500 using PeptBase."
- "Build a conservative recovery research stack from PeptBase."
- "Get the full profile for Epithalon from PeptBase."

## Notes

- All responses are read-only research context
- Medical claims are sanitized automatically
- Citations are validated against the local dataset
- LLM-assisted endpoints fall back to deterministic local data if the provider fails
