> For the complete documentation index, see [llms.txt](https://sentinelagent.gitbook.io/sentinel-agent/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sentinelagent.gitbook.io/sentinel-agent/technology-stack.md).

# Technology Stack

## Technology Stack

### Architecture Overview

```
┌─────────────────────────────────────────────────┐
│            USER (Phantom Wallet)                │
└──────────────────┬──────────────────────────────┘
                   │ Funds agent
                   ↓
┌─────────────────────────────────────────────────┐
│        SENTINEL FRONTEND (Next.js 14)           │
│    • TypeScript, Tailwind CSS, shadcn/ui        │
└──────────────────┬──────────────────────────────┘
                   │
                   ↓
┌─────────────────────────────────────────────────┐
│      CDP EMBEDDED WALLET CREATION               │
│    Creates dedicated Solana wallet for agent    │
└──────────────────┬──────────────────────────────┘
                   │
                   ↓
┌─────────────────────────────────────────────────┐
│         AGENT WALLET (Solana)                   │
│    • Holds USDC/CASH budget                          │
│    • Signs all transactions autonomously        │
└────────┬──────────────────────┬─────────────────┘
         │                      │
         │ Pays 0.0003 CASH/USDC    │ Pays 0.04 USDC/CASH
         ↓                      ↓
┌──────────────────┐   ┌──────────────────────┐
│ x402 SERVER      │   │   CLAUDE AI API      │
│ + SWITCHBOARD    │   │   (Anthropic)       │
│ ORACLE           │   │                      │
└──────────────────┘   └──────────────────────┘
         │                      │
         ↓                      ↓
     Price Data            AI Analysis
         │                      │
         └──────────┬───────────┘
                    ↓
          ALERT TO USER
```

***

### Technologies Deep Dive

#### 🔷 **Frontend: Next.js 14 (App Router)**

* Server components for optimal performance
* TypeScript for type safety
* Tailwind CSS + shadcn/ui for UI
* Real-time updates via React Server Components

**Why:** Modern, performant, scales well

***

#### 💰 **Blockchain: Solana + Phantom CASH**

* **Solana**: 400ms finality, $0.00025 tx fees
* **CASH Token**: USD-pegged stablecoin by Phantom
* **Token Address**: CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH

**Why:** Fast + cheap enough for micropayments to be profitable

***

#### 🔐 **Wallets: Coinbase CDP Embedded Wallets**

* Instant wallet creation (no seed phrases)
* Non-custodial (user owns, agent uses)
* Seamless onboarding

**Why:** Enables true agent autonomy without key management complexity

***

#### 💳 **Payments: x402 Protocol**

* HTTP 402 "Payment Required" standard
* Agent pays → Server verifies → Data returned
* Transparent pricing (no hidden fees)

***

#### 📊 **Oracles: Switchboard**

* Decentralized price feeds
* Solana-native (no bridging)
* Sub-second updates

**Feeds Used:**

* SOL/USD: `GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR`
* More feeds coming soon (JUP/USDC, NFT floors)

**Why:** Reliable, verifiable, decentralized data

***

***

#### 🗄️ **Database: Supabase (PostgreSQL)**

* Stores agent configurations
* Tracks payment history
* Manages alert logs

**Why:** Postgres reliability + real-time subscriptions

***

#### 🚀 **Deployment: Vercel**

* Edge functions for low-latency x402 server
* Automatic scaling
* Global CDN

**Why:** Serverless scales with usage, perfect for pay-per-use model

***

### Integration Points

| Component   | Talks To            | Protocol      | Purpose              |
| ----------- | ------------------- | ------------- | -------------------- |
| Frontend    | CDP API             | REST          | Create agent wallets |
| Agent       | x402 Server         | HTTP 402      | Pay for data         |
| x402 Server | Switchboard         | On-chain read | Get price data       |
| Agent       | Claude API/DeepSeek | REST + x402   | Get AI analysis      |
| Agent       | Solana RPC          | JSON-RPC      | Send payments        |

***

### Code Examples

**x402 Payment Flow:**

```typescript
import { Keypair } from '@solana/web3';
import { sendUSDCPayment } from './lib/payments';
import { getOraclePublicKey } from './lib/treasury';

// Initialize your keypair (in production, load from environment variable)
const senderKeypair = Keypair.generate(); // Replace with actual keypair

async function checkPriceWithPayment() {
  try {
    // 1. First, try to get the price
    let response = await fetch('/api/check-price');
    
    // 2. If payment is required (HTTP 402)
    if (response.status === 402) {
      const paymentDetails = await response.json();
      console.log('Payment required:', paymentDetails);
      
      // 3. Send the payment
      const txSignature = await sendUSDCPayment(
        senderKeypair,
        getOraclePublicKey(),
        paymentDetails.amount
      );
      
      console.log('Payment successful, tx:', txSignature);
      
      // 4. Retry with payment proof
      response = await fetch('/api/check-price', {
        headers: {
          'X-Payment-Proof': txSignature
        }
      });
    }
    
    // 5. Handle the final response
    if (!response.ok) {
      throw new Error(`Request failed: ${response.statusText}`);
    }
    
    const priceData = await response.json();
    console.log('Price data:', priceData);
    return priceData;
    
  } catch (error) {
    console.error('Error checking price:', error);
    throw error;
  }
}

// Usage
checkPriceWithPayment()
  .then(priceData => {
    // Handle the price data
  })
  .catch(console.error);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sentinelagent.gitbook.io/sentinel-agent/technology-stack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
