loading…
Search for a command to run...
loading…
Foundational MCP/A2A-native core platform for secure credential injection, native x402 micropayments, and Agent-to-Agent routing.
Foundational MCP/A2A-native core platform for secure credential injection, native x402 micropayments, and Agent-to-Agent routing.
The Universal Agent Economy OS is a foundational, MCP/A2A-native core platform designed to power the exploding agentic sub-economy. It begins as a secure credential injection and x402 micropayment proxy, compounding daily into a full multi-monopoly empire (identity engine, payments, settlement, compliance packs, vertical marketplaces).
This v0 proxy skeleton is the unbreakable foundation that every future module will extend. It is fully Model Context Protocol (MCP) and Agent-to-Agent (A2A) compatible, allowing autonomous agents to securely discover, authenticate, and pay each other without human intervention.
The easiest way to interact with the UAE OS is via the official Python SDK. It provides robust connection pooling, automatic exponential backoff retries for transient errors (429s, 5xxs), and structured exception handling that maps directly to the UAEError system.
Install the SDK directly from the repository root:
pip install -e .
import asyncio
from sdk.uaeos import UAEOSClient
from sdk.uaeos.client import RateLimitError, AuthError, InsufficientScopesError, APIError
async def main():
# Initialize the client with your API key (uses async context manager for connection pooling)
# The client automatically retries transient errors (max_retries=3 by default)
async with UAEOSClient(api_key="sk_test_1234567890abcdef", base_url="http://127.0.0.1:8000") as client:
try:
# 1. Register a new agent in the Identity Engine
agent = await client.register_agent(
agent_id="agent_sdk_1",
name="SDK Test Agent",
metadata={"version": "1.0"}
)
print("Registered:", agent)
# 2. Rotate/Issue a credential with cryptographic scopes
cred = await client.rotate_credential(
agent_id="agent_sdk_1",
credential_type="stripe_live",
new_secret_data={"api_key": "sk_live_new123"},
expires_in_days=30
)
print("Credential Rotated:", cred)
# 3. Execute an MCP/A2A tool call with x402 micropayment
result = await client.execute(
agent_id="agent_sdk_1",
tool_call={
"target_agent_id": "agent_target_2",
"action": "process_data",
"payload": {"hello": "world"},
"required_scopes": ["read"]
},
credential_type="stripe_live",
payment_amount=1.50
)
print("Execution Result:", result)
# 4. Execute a direct A2A payment (no downstream HTTP call)
payment_result = await client.execute_payment(
agent_id="agent_sdk_1",
payment_amount=5.00,
target_agent_id="agent_target_3",
action="data_purchase"
)
print("Payment Result:", payment_result)
# 5. Get Usage Stats from the Analytics Engine
stats = await client.get_stats()
print("Global Stats:", stats)
# 6. Generate a usage-based invoice for the agent
invoice = await client.get_invoice(agent_id="agent_sdk_1")
print("Generated Invoice:", invoice)
# 7. List available Vertical Credential Packs
verticals = await client.get_vertical_packs()
print("Available Verticals:", verticals)
except RateLimitError as e:
# Raised if the agent exceeds the rate limit and max_retries are exhausted
print(f"Rate limited! Retry after {e.retry_after} seconds. Request ID: {e.request_id}")
except InsufficientScopesError as e:
# Raised if the agent lacks the required scopes for the credential
print(f"Permission denied: {e.message}")
except AuthError:
# Raised for 401 Unauthorized
print("Invalid API Key!")
except APIError as e:
# Catch-all for other 4xx/5xx errors or network issues
print(f"API Error ({e.status_code}): {e.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())
The Universal Agent Economy OS features a native x402 middleware that intercepts tool calls requiring payment. This allows agents to autonomously negotiate and settle micropayments before executing downstream requests, creating a frictionless economy.
required_payment (e.g., 0.50), the x402 middleware checks the provided payment_amount.action is discover, the middleware enforces a tiny minimum fee (e.g., 0.01). Upon successful payment, it returns a rich payload of premium tools and their prices, incentivizing exploration.payment_amount is missing or insufficient, the proxy immediately returns an HTTP 402 Payment Required error, detailing the required amount.payment_proof (the transaction_id from a previous successful settlement). The middleware verifies this proof and bypasses the charge, allowing the tool call to proceed.# 1. Attempt a tool call that requires payment
try:
await client.execute(
agent_id="agent_1",
tool_call={"url": "https://api.example.com/premium", "required_payment": 1.0},
credential_type="stripe_live"
)
except APIError as e:
if e.status_code == 402:
print("Payment required! Retrying with funds...")
# 2. Retry with sufficient payment
result = await client.execute(
agent_id="agent_1",
tool_call={"url": "https://api.example.com/premium", "required_payment": 1.0},
credential_type="stripe_live",
payment_amount=1.0
)
# Save the transaction ID for future retries
tx_id = result.get("transaction_id")
# 3. Retry a failed downstream call using payment_proof
retry_result = await client.execute(
agent_id="agent_1",
tool_call={"url": "https://api.example.com/premium", "required_payment": 1.0},
credential_type="stripe_live",
payment_proof=tx_id
)
The Universal Agent Economy OS supports modular "Vertical Credential Packs". These packs define standardized credential types and cryptographic scopes for specific industries (e.g., Finance, Data, Compute), instantly expanding the platform's monopoly surface.
stripe_live, plaid_link, bank_api).google_api, openai_api, aws_access, web_scraper).openai_api, anthropic_api, aws_compute, gpu_cluster).audit_log_access, kyc_verification, regulatory_reporting, audit_report_generator).legal_contract_access, intellectual_property_registry, e_signature).erc8004_identity, wallet_connect, siwe_session, verifiable_credential, smart_contract_execution).When rotating credentials for these types, the Identity Engine automatically validates requested scopes against the pack's allowed scopes. If no scopes are provided, it defaults to granting all allowed scopes for that credential type, ensuring secure-by-default operation.
# Rotate a Plaid credential. The Identity Engine automatically
# assigns the default scopes: ["account:read", "transaction:read"]
await client.rotate_credential(
agent_id="agent_1",
credential_type="plaid_link",
new_secret_data={"access_token": "access-sandbox-123"}
)
# Execute a tool call requiring the 'transaction:read' scope
await client.execute(
agent_id="agent_1",
tool_call={
"url": "https://sandbox.plaid.com/transactions/get",
"required_scopes": ["transaction:read"]
},
credential_type="plaid_link"
)
View Available Verticals:
curl -X GET "http://127.0.0.1:8000/verticals" \
-H "Authorization: Bearer YOUR_API_KEY"
The Universal Agent Economy OS includes a built-in usage limits and pricing tier system to ensure fair usage and generate revenue.
Agents can query their usage statistics and tier status via the /stats endpoint or the SDK. The dashboard provides:
BILLING_RATE_PER_CALL.# Fetch stats for a specific agent
stats = await client.get_stats(agent_id="agent_1")
agent_tier = stats.get("agent_tier_status", {})
print(f"Current Tier: {agent_tier.get('tier')}")
print(f"Usage: {agent_tier.get('total_calls')} / {agent_tier.get('limit')}")
print(f"Projected Cost: ${agent_tier.get('projected_cost')}")
print(f"Recommendation: Upgrade to {agent_tier.get('tier_recommendation')}")
If an agent exceeds their limit, the proxy will return a 402 Payment Required error, prompting them to upgrade their tier.
The UAE OS is fully discoverable by other agents and MCP clients, accelerating network effects. It serves standard discovery metadata at the following public endpoints:
/.well-known/agent-card.json): Provides A2A discovery metadata, including the agent's name, description, capabilities (like x402 micropayments), and available endpoints./.well-known/mcp.json): Provides the official Model Context Protocol server manifest, allowing MCP clients (like Claude or Cursor) to dynamically connect to the proxy's execute endpoint.action="discover"): Agents can pay a tiny fee to the proxy to instantly discover premium tools and capabilities available on the network.These .well-known endpoints are public and do not require an API key, enabling frictionless onboarding.
# 1. Pay a tiny fee to discover premium tools
discovery_result = await client.discover_premium_tools(
agent_id="agent_1",
payment_amount=0.01
)
# 2. Inspect the returned premium tools
premium_tools = discovery_result.get("discovery_data", {}).get("premium_tools", [])
for tool in premium_tools:
print(f"Discovered: {tool['name']} ({tool['action']}) - ${tool['required_payment']}")
# Example output might include:
# Discovered: Automated Audit Log Access (audit_log_fetch) - $15.00
# Discovered: KYC Verification Service (kyc_verify) - $20.00
# Discovered: Regulatory Reporting Tool (regulatory_report) - $50.00
# 3. Autonomously decide to use a discovered premium legal/compliance tool
await client.execute(
agent_id="agent_1",
tool_call={"action": "kyc_verify", "required_payment": 20.00},
credential_type="kyc_verification",
payment_amount=20.00
)
Welcome to the foundational release of the Universal Agent Economy OS! Over the past 90+ days, we have built a highly modular, production-ready proxy skeleton that acts as the core router for the MCP/A2A network.
Features in v0.1.9:
httpx).adt_ ID generation.Authorization: Bearer and X-API-Key), CORS middleware, custom security headers, and structured error reporting (UAEError)./stats dashboard.UAEOSClient) with connection pooling, exponential backoff retries, and structured error handling.app/config.py) as the single source of truth.Install Dependencies
pip install -r requirements.txt
Configure Environment
Copy .env.example to .env and fill in your Supabase details (optional for local simulation).
cp .env.example .env
Run the Server
uvicorn app.main:app --reload
The API will be available at http://127.0.0.1:8000. Check http://127.0.0.1:8000/docs for the interactive Swagger UI.
Run Tests
pytest -v
To run the proxy in an isolated container:
Build the Image
docker build -t uae-os-proxy .
Run the Container
docker run -p 8000:8000 --env-file .env uae-os-proxy
The application is configured entirely via environment variables (managed by app/config.py). See .env.example for details.
| Variable | Default | Description |
|---|---|---|
API_KEY |
(Required) | The master API key required to access protected endpoints. |
WEBHOOK_SECRET |
(Required) | Secret used to verify HMAC signatures on incoming webhooks. |
SUPABASE_URL |
"" |
Your Supabase project URL (used for credential lookup). |
SUPABASE_KEY |
"" |
Your Supabase anon or service-role key. |
ALLOWED_ORIGINS |
["*"] |
JSON array of allowed CORS origins. |
STRIPE_API_KEY |
"" |
Key for real Stripe integration. |
LIGHTNING_ENABLED |
False |
Enable Lightning network micropayments. |
BILLING_RATE_PER_CALL |
0.01 |
Flat rate applied per API call for usage-based billing. |
RATE_LIMIT_MAX_REQUESTS |
10 |
Maximum number of requests an agent can make within the window. |
RATE_LIMIT_WINDOW_SECONDS |
60 |
Time window in seconds for the rate limit. |
REDIS_URL |
"" |
Redis connection string (e.g., redis://localhost:6379). Leave empty for in-memory fallback. |
Note: If Supabase variables are missing, the app gracefully falls back to a simulation mode for testing.
The proxy endpoint (/proxy/execute) is protected and requires your API_KEY. You can authenticate using either the standard Authorization: Bearer <key> header or the X-API-Key: <key> header.
Using cURL (Bearer Token):
curl -X POST http://127.0.0.1:8000/proxy/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_test_1234567890abcdef" \
-d '{
"agent_id": "agent_alpha",
"tool_call": {
"url": "https://api.example.com/v1/data",
"method": "POST",
"payload": {"query": "test"}
},
"credential_type": "stripe_live"
}'
To simulate a settlement and route to another agent, include the payment_amount and target_agent_id fields.
curl -X POST http://127.0.0.1:8000/proxy/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_test_1234567890abcdef" \
-d '{
"agent_id": "agent_beta",
"tool_call": {
"target_agent_id": "agent_gamma",
"action": "premium_data_fetch"
},
"credential_type": "custom_oauth",
"payment_amount": 0.50
}'
Expected Response:
{
"success": true,
"injected_credential": true,
"x402_settled": true,
"transaction_id": "tx_a1b2c3d4e5f6",
"audit_id": "adt_9876543210abcdef"
}
The Dockerfile is optimized for modern PaaS providers. It uses a lightweight Python 3.11 slim image, exposes port 8000, and binds to 0.0.0.0.
Railway offers a seamless, one-click deployment experience that reads the included railway.toml and Dockerfile automatically.
API_KEY, WEBHOOK_SECRET, and any optional Supabase/Stripe keys. Ensure you generate strong random strings for the secrets in production.railway.toml file, build the Docker image, and deploy it.Expected Live URL Pattern:
https://agent-economy-os-production.up.railway.app
Once deployed, you can verify the service is running and monitor its health using the public endpoints. These are the recommended endpoints to use for PaaS health checks:
https://agent-economy-os-production.up.railway.app/healthhttps://agent-economy-os-production.up.railway.app/metricsNote: Since the current rate limiting and caching are in-memory, ensure your PaaS is configured to run a single instance/replica (which is the default on free tiers) until Redis is fully integrated.
To enable real-time settlement tracking for live Stripe payments, configure a webhook in your Stripe Dashboard:
https://agent-economy-os-production.up.railway.app/webhooks/stripe.payment_intent.succeeded and payment_intent.payment_failed.whsec_) and add it to your Railway environment variables as STRIPE_WEBHOOK_SECRET.The Universal Agent Economy OS is designed for immediate enterprise handover. While PaaS platforms like Railway are great for quick starts, we provide a complete Terraform Foundation (deploy/terraform/) for deploying the full stack to AWS (ECS/Fargate), Azure, or GCP.
This infrastructure-as-code setup mirrors the simplicity of our railway.toml but scales to enterprise requirements, including isolated VPCs, Application Load Balancers, and secure secret injection.
graph TD
Client[Agent / MCP Client] -->|HTTPS| ALB[Application Load Balancer]
ALB -->|Port 8000| ECS[ECS Fargate Cluster]
subgraph "Universal Agent Economy OS"
ECS -->|Reads/Writes| Redis[(Redis Cluster)]
ECS -->|Validates Scopes| Supabase[(Supabase / PostgreSQL)]
ECS -->|Settles Payments| Stripe[Stripe API]
end
ECS -->|Proxies Request| Downstream[Downstream API / Agent]
Navigate to the Terraform directory:
cd deploy/terraform
Initialize Terraform:
terraform init
Configure Variables:
Create a terraform.tfvars file to securely inject your core secrets (matching app/config.py):
api_key = "sk_live_..."
stripe_secret_key = "sk_live_..."
stripe_webhook_secret = "whsec_..."
supabase_url = "https://xyz.supabase.co"
supabase_key = "..."
redis_url = "redis://..."
Deploy the Infrastructure:
terraform apply
Note: The provided Terraform files are a comprehensive skeleton. You will need to uncomment the resources and adjust VPC/Subnet IDs to match your specific AWS environment.
The Universal Agent Economy OS is architected with a pure build-to-sell philosophy. Every module is designed for maximum enterprise appeal, immediate handover readiness, and seamless integration into larger corporate ecosystems.
The platform is currently in a production-ready v0.1.9 state. It has successfully evolved from a simple credential injection proxy into a comprehensive, multi-vertical agent economy core. The test suite maintains 93%+ coverage across all core logic, ensuring stability during handover.
auto_rotate_agent_credentials stub) demonstrate how the system can autonomously manage high-frequency credential rotation for regulated industries.deploy/terraform/) ensures the entire stack can be spun up in an enterprise AWS/GCP/Azure environment with a single command.The codebase is strictly modular, designed to be extended by new maintainers without creating technical debt:
app/verticals/): New maintainers can add new vertical packs (e.g., IoT, Cybersecurity) by simply creating a new file and registering it in __init__.py. The Identity Engine automatically handles scope validation for new packs.app/identity/): Decoupled from the proxy, allowing acquirers to swap the Supabase backend for their own internal IAM provider (e.g., Okta, Auth0) by modifying app/supabase.py.app/payments.py, app/middleware/x402.py): The x402 logic is isolated. Stripe can be easily swapped for an internal corporate ledger or a different payment gateway (e.g., Adyen, PayPal).app/analytics.py, app/metering.py): Currently Redis-ready with an in-memory fallback. Can be seamlessly upgraded to pipe data into an enterprise data warehouse (e.g., Snowflake, Databricks).We welcome contributions! The Universal Agent Economy OS is designed to be the definitive open-source standard for the agentic economy.
Please ensure that all tests pass (pytest -v) and that coverage remains at 100% before submitting a Pull Request. If you are adding a new module, ensure it compounds on the existing architecture without breaking the core proxy execution flow.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"universal-agent-economy-os": {
"command": "npx",
"args": []
}
}
}Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also