Developer Cookbook

The below examples assume you're running a Python agent alongside a Django server for the agent developer's backend.

API Key Setup

# The API can be initialized within the agent and/or within the backend
from agent_protocol import AgentProtocol

ap = AgentProtocol(api_key="YOUR_API_KEY")

Initializing an Agent

Agents can be initialized anywhere. This will create a unique agent ID.

new_agent = ap.init_agent(
    name="MyAgent",
    user_agent_protocol_id="userID"
    description="An assistant agent"
)

print(f"New agent created with ID: {new_agent.id}")

Linking a User's Plaid Account

Agent Developer Django Server:

Here you must pass in the user's unique Agent Protocol ID. The callback URL will receive a user-specific key for their Plaid authorization.

Creating & Funding a Virtual Fiat Card

Agent Developer Django Server:

Creating & Funding a Crypto Keypair

Agent code:

Agent Developer Django Server:

Handing Transaction Failures

Agent Developer Django Server:

Last updated