Official Python SDK for GT8004 — AI agent observability with MCP, A2A, x402 payment tracking. FastAPI, Flask, FastMCP middleware included.
gt8004-sdk is an early-stage Python project in the AI payments / x402 ecosystem, focused on a2a, ai-agent, analytics, fastapi. It currently has 1 GitHub stars and 0 forks, and sits alongside related tools like python-gate, nexus, os-moda, AIephant-AI-Agent-Gateway, ampersend-sdk, agoragentic-integrations.
Official Python SDK for GT8004 - AI Agent Analytics & Observability Platform.
pip install git+https://github.com/vataops/gt8004-sdk.git
With framework-specific extras:
# FastAPI / Starlette
pip install "gt8004-sdk[fastapi] @ git+https://github.com/vataops/gt8004-sdk.git"
# FastMCP (MCP servers)
pip install "gt8004-sdk[mcp] @ git+https://github.com/vataops/gt8004-sdk.git"
# All frameworks
pip install "gt8004-sdk[all] @ git+https://github.com/vataops/gt8004-sdk.git"
from fastmcp import FastMCP
from gt8004 import GT8004Logger
from gt8004.middleware.mcp import GT8004MCPMiddleware
logger = GT8004Logger(agent_id="your-agent-id", api_key="your-api-key", protocol="mcp")
logger.transport.start_auto_flush()
mcp = FastMCP("my-server")
mcp.add_middleware(GT8004MCPMiddleware(logger))
@mcp.tool()
def search(query: str) -> str:
return "results..."
# Automatically logs tool_name="search", protocol="mcp"
from fastapi import FastAPI
from gt8004 import GT8004Logger
from gt8004.middleware.fastapi import GT8004Middleware
logger = GT8004Logger(agent_id="your-agent-id", api_key="your-api-key", protocol="a2a")
logger.transport.start_auto_flush()
app = FastAPI()
app.add_middleware(GT8004Middleware, logger=logger)
# Automatically extracts skill_id from A2A request bodies
@app.on_event("shutdown")
async def shutdown():
await logger.close()
When using x402 payment middleware, use GT8004ASGIMiddleware as the outermost wrapper to capture all requests including 402 payment responses:
from fastapi import FastAPI
from gt8004 import GT8004Logger
from gt8004.middleware.asgi import GT8004ASGIMiddleware
logger = GT8004Logger(agent_id="your-agent-id", api_key="your-api-key", protocol="a2a")
logger.transport.start_auto_flush()
app = FastAPI()
# Apply x402 payment middleware first, then GT8004 outermost
app = x402_middleware(app)
app = GT8004ASGIMiddleware(app, logger)
# Automatically captures x402 payment fields (amount, tx_hash, payer)
from flask import Flask
from gt8004 import GT8004Logger
from gt8004.middleware.flask import GT8004FlaskMiddleware
logger = GT8004Logger(agent_id="your-agent-id", api_key="your-api-key")
logger.transport.start_auto_flush()
app = Flask(__name__)
app.wsgi_app = GT8004FlaskMiddleware(app.wsgi_app, logger)
Your analytics are now live at https://gt8004.xyz/agents/{agent-id} with protocol-specific breakdowns.
export GT8004_AGENT_ID="your-agent-id"
export GT8004_API_KEY="your-api-key"
import os
from gt8004 import GT8004Logger
logger = GT8004Logger(
agent_id=os.environ["GT8004_AGENT_ID"],
api_key=os.environ["GT8004_API_KEY"],
network="mainnet", # "mainnet" (default) or "testnet"
protocol="a2a", # "mcp" or "a2a" (optional)
batch_size=50, # Flush after N entries (default: 50)
flush_interval=5.0, # Auto-flush interval in seconds (default: 5.0)
)
# Start auto-flush background task
logger.transport.start_auto_flush()
# Verify connectivity on startup
ok = await logger.verify_connection()
# Graceful shutdown (flushes pending logs)
await logger.close()
| Framework | Middleware | Install Extra |
|---|---|---|
| FastMCP (MCP servers) | GT8004MCPMiddleware |
[mcp] |
| FastAPI / Starlette | GT8004Middleware |
[fastapi] |
| Pure ASGI (x402 compatible) | GT8004ASGIMiddleware |
[fastapi] |
| Flask / Django (WSGI) | GT8004FlaskMiddleware |
(none) |
By default, health check endpoints are excluded from logging. You can customize this with exclude_paths:
# FastAPI / Starlette
app.add_middleware(GT8004Middleware, logger=logger, exclude_paths={"/health", "/metrics", "/internal"})
# Pure ASGI
app = GT8004ASGIMiddleware(app, logger, exclude_paths={"/health", "/metrics"})
Default excluded paths:
GT8004Middleware: /health, /healthz, /readyz, /_health, /.well-known/agent.json/healthGT8004ASGIMiddleware: /health, /healthz, /readyz, /_health| Protocol | Tool Name Source | Example |
|---|---|---|
| (none) | URL path last segment | /api/search -> search |
mcp |
FastMCP on_call_tool hook |
@mcp.tool() def search(...) -> search |
a2a |
Request body skill_id or path |
{"skill_id":"translate"} -> translate |
All middleware adapters automatically extract x402 payment data from HTTP headers:
x402_amount - Payment amount in USDCx402_tx_hash - On-chain settlement transaction hashx402_token - Token identifier (e.g. USDC-base-mainnet)x402_payer - Payer wallet addressNo additional configuration needed — payment headers (X-Payment, X-Payment-Response) are parsed automatically when present.
MIT - see LICENSE
Trust-gating middleware for Python web frameworks (FastAPI, Flask, Django) using AgentScore
The AI-to-AI Protocol Layer that catches unreliable agent outputs before they cost you money. Claim-level verification, escrow, and slashing. 224 tests, 12/12 adversarial patterns caught.
An operating system built for AI agents — talk to your NixOS server instead of SSH-ing in. Typed, audited tool access with atomic rollback on every change. Research-grade; run it on a disposable box, not production.
Alephant is an open-source AI Agent Gateway for routing, tracking, and controlling LLM usage across AI agents, members, and workflows, and for publishing agent capabilities as paid endpoints with x402 and MPP payment rails.
Tooling for building applications with x402 payment capabilities. Supports buyer and seller roles.
Public adapters and discovery catalog for Triptych OS (Agent OS): agent frameworks, MCP/A2A/x402 protocols, workflows, wallets, SDKs, and examples for execute-first routing, governed handoffs, and receipt-aware agent commerce.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.
Daydreams is a set of tools for building agents for commerce
Live data for AI agents — search, research, markets, crypto, X/Twitter. Pay-per-call via x402 micropayments.