Agent Protocol Docs
  • Introduction
  • 💡Background & Motivation
    • What is Agent Protocol?
    • Background on AI Agents
    • The Future of AI Agents
    • Why Will Agents Use Crypto?
    • Agent Payments with Agent Protocol
  • 🏗️Developers
    • Background & Setup
    • Quick Start: Travel Assistant
    • Developer Cookbook
    • Agent Developer Backend API
    • Agent API
Powered by GitBook
On this page
  • Creating a Keypair for your Agent
  • Purchases
  1. Developers

Agent API

These functions are intended to be invoked from within the agent.

Creating a Keypair for your Agent

Generate a new keypair for a specified blockchain

def gen_keypair(self, blockchain: str) -> Tuple[str, str]:
    """
    Args:
        blockchain (str): The blockchain for which to generate the keypair.

    Returns:
        Tuple[str, str]: The public key and private key.
    """

Authorize a keypair for blockchain transactions.

def authorize_keypair(self, agent_id: str, blockchain: str, permissions: dict) -> Card:
    """
    Args:
        agent_id (str): The ID of the agent.
        blockchain (str): The blockchain to authorize.
        permissions (dict): The permissions and limits for the keypair.

    Returns:
        Card: The authorized keypair object.
    """

Purchases

Retrieve cards authorized for a specific use case.

def retrieve_authorized_cards(self, use_case: str) -> List[Card]:
    """
    Args:
        use_case (str): The use case for filtering the cards.

    Returns:
        List[Card]: The list of authorized cards.
    """

Describe an expense for a card

def describe_expense(self, card: Card, estimated_txn_size: float, txn_description: str) -> str:
    """
    Args:
        card (Card): The card to use for the expense.
        estimated_txn_size (float): The estimated size of the transaction.
        txn_description (str): The description of the transaction.

    Returns:
        str: The transaction ID.
    """

Screen a vendor to assess the likelihood of fraud

def screen_vendor(vendor_id: str, transaction_amount: int, vendor_info: dict = None) -> dict:
    """
    Returns:
        VendorScreen: The result of screening the vendor.
    """

Report an issue with a purchase.

def report_purchase_issue(self, card_id: str, transaction_id: str, issue_description: str) -> IssueReport:
    """
    Args:
        card_id (str): The ID of the card.
        transaction_id (str): The ID of the transaction.
        issue_description (str): The description of the issue.

    Returns:
        IssueReport: The issue report object.
    """

Initiate a buyer dispute for a transaction

def initiate_buyer_dispute(self, card_id: str, transaction_id: str, dispute_reason: str) -> DisputeResult:
    """
    Args:
        card_id (str): The ID of the card.
        transaction_id (str): The ID of the transaction.
        dispute_reason (str): The reason for the dispute.

    Returns:
        DisputeResult: The result of the dispute initiation.
    """
PreviousAgent Developer Backend API

Last updated 11 months ago

🏗️