This is a demo. Its data may be reset from time to time.
Sandbox
AI Framework / Documentation

AI Framework Documentation

This page explains how the FinAegis AI agent framework is built. It also shows how agents connect to it and pay for API calls.

Overview

The FinAegis AI framework lets autonomous agents work with the banking platform. Large language models reach the platform through Model Context Protocol (MCP) tools. Agents talk to each other through Google's Agent2Agent protocol. They pay for single API requests with x402 micropayments.

Key Capabilities

  • The tool registry holds 24 tools, including TransactionQueryTool and X402PaymentTool.
  • The Agent2Agent protocol lets several agents share tasks.
  • Agents pay in USDC with x402, within their spending limits.
  • Agents can use more than 1,000 REST API routes and a GraphQL API across 43 domains.

Architecture

The AI framework spans three domain modules. AgentProtocol handles communication between agents. X402 handles paid API access. AI holds the agents, the workflows and the tool definitions.

app/
├── Domain/
│   ├── AgentProtocol/     # Google A2A protocol implementation
│   │   ├── Services/      # AgentPaymentIntegrationService
│   │   └── Models/        # Agent, A2ATask, Escrow
│   ├── X402/              # HTTP 402 payment gate
│   │   └── Services/      # Settlement, Verification, Pricing
│   └── AI/                # Agents, workflows, MCP tools
│       └── MCP/Tools/     # TransactionQueryTool, X402PaymentTool
├── Http/Middleware/       # X402PaymentGateMiddleware
└── Infrastructure/
    └── AI/                # OpenAI, Claude and Pinecone adapters

MCP Tools

FinAegis implements Model Context Protocol tools. Large language models such as Claude use them to work with the banking platform. Each tool is registered in the tool registry with a name and an input schema.

TransactionQueryTool

This tool turns a plain-language question about transactions into a structured database query. It can filter by account, date range, amount, category and asset.

X402PaymentTool

This tool lets an agent pay for API access in USDC with the x402 protocol. One tool call reads the price, signs the payment and checks the result.

Agent2Agent Protocol

The Agent2Agent protocol follows Google's specification. Agents use it to find each other, hand over tasks and work together on financial workflows with several steps.

Agent Cards

Each agent publishes a card that describes its skills and capabilities. Other agents read these cards to decide which agent should get a task.

Task Lifecycle

A task starts as submitted and moves to working. It can wait in input-required, and it ends as completed, failed or canceled. Agents report progress through protocol messages.

x402 Agent Payments

The x402 protocol adds payments to normal HTTP requests. When an agent calls a paid endpoint, it gets a 402 Payment Required response with the price. The agent signs a USDC payment and sends the request again with the signature.

# 1. Agent calls a gated endpoint
GET /api/v2/premium/data
→ 402 Payment Required
# PAYMENT-REQUIRED: base64 JSON with amount, asset and network
# 2. Agent signs the payment and retries
GET /api/v2/premium/data
# PAYMENT-SIGNATURE: base64 signed payment payload
# 3. Server verifies and settles the payment
→ 200 OK
# PAYMENT-RESPONSE: base64 settlement result

Spending Controls

Spending limits keep an autonomous agent from paying more than its owner allows. Each agent can have a daily limit and a limit per payment. The platform checks both limits before it signs a payment.

  • Each agent has its own daily limit.
  • A limit per payment caps a single request.
  • The /spending-limits API routes read and change the limits.

Transaction Query

The TransactionQueryTool answers questions about transaction data in plain language. An agent asks a question and gets a structured result.

Example Queries

  • "Show my top 5 transactions this week"
  • "Show transactions over $100 last week"
  • "How much did I spend on groceries last month?"

Start Building

You can connect your first AI agent to FinAegis in the sandbox. It uses test data only.