Agent Integration · Python · x402

Connect your agent
to Tally.

Drop the integration folder into your agent's project. The app generates the full .env block for you — open the Agents tab, create a new connection, tap Copy .env block, paste. Everything pre-filled.

In practice: point your agent at the folder and tell it to read the contents. It figures out the rest on its own. We tested funding and x402 end-to-end by asking the agent to run both — no manual steps, no guidance needed. It just worked.

How it works
01
Agent requests budget
Calls request_funding()
02
Telegram notification
Amount + task description sent to your phone
03
Card tap authorizes
Session wallet funded on-chain
04
Funds sweep back
Remaining USDC returns to vault automatically

tally_integration.zip

warm_vault_auth.py · tg_bot.py · .env.example · SETUP.md · demo scripts

Download ↓ View on GitHub ↗
Setup: 4 steps
1

Install dependencies

Python 3.10+ required. Install the three packages the skill uses.

pip install solana solders requests
2

Connect in the Tally app

Open the Tally app → Agents tab → New Connection. The wizard walks you through Telegram bot setup and generates a session keypair. At the end, tap Copy .env block.

That block has everything pre-filled: Telegram token, chat ID, session private key, vault address, and deep-link secret. Paste it directly into tally_integration/.env.

No Telegram bot yet? The wizard has step-by-step instructions inside the app under each field.
3

Fund your vault

Your vault needs SOL for gas and USDC for agent sessions. On devnet, both are free.

# SOL airdrop (replace with your vault address from Tally home screen)
solana airdrop 1 <YOUR_VAULT_ADDRESS> --url devnet

# USDC — use the Circle faucet (also creates the required USDC token account)
# https://faucet.circle.com
The Circle faucet creates the USDC Associated Token Account on your vault address. This is required for fund sweeps to work. Do it once before your first session.
4

Run the demo

Test the full x402 flow end-to-end. The agent hits the live paywalled endpoint, your phone gets a Telegram notification, you tap your card, real USDC moves on-chain, signal returned.

cd tally_integration
python3 run_x402_demo.py

Expected output:

→ GET tally.lll.mk/api/signal
← 402 Payment Required
→ Telegram notification sent
← Card tap received · Session funded
→ 0.1 USDC sent on-chain (tx: 3xKp...)
→ Waiting for propagation...
→ GET /api/signal + X-Tally-Session + X-Tally-Tx
← 200 OK
   signal: BULLISH | SOL/USDC | Entry: $86.49 | RR: 1:1.7
→ Funds swept back to vault
Quick usage

Request funding and execute a task:

from warm_vault_auth import request_funding, return_funds

# Sends Telegram notification, waits for card tap, returns funded session
session = request_funding(
    amount_usdc=5.0,
    task_description="Research flight prices to Tokyo",
)

# Agent executes tasks using session wallet...

# Sweep residual back to vault when done
return_funds(session)

Hit a paywalled x402 API automatically:

from warm_vault_auth import request_with_payment

# Full x402 flow: 402 → card tap → USDC on-chain → signal → sweep back
result = request_with_payment(
    url="https://tally.lll.mk/api/signal",
    amount_usdc=1.0,
    task_description="Fetch SOL/USDC market signal",
    return_funds_after=True,
)

if result["ok"]:
    signal = result["data"]["signal"]
    print(signal["signal"])   # BULLISH / BEARISH
    print(signal["entry"])    # entry price

What's in the zip

warm_vault_auth.py
Core skill: request_funding, check_balance, return_funds, request_with_payment
tg_bot.py
Telegram notifications: funding requests, payment confirmations, sweep alerts
.env.example
Config template with all TALLY_* variables documented
SETUP.md
Full setup guide including manual config, mainnet checklist, and troubleshooting table
SKILL.md
Quick reference for AI agents: function signatures and usage patterns
AGENT_PROMPT.md
System prompt and user message to trigger the x402 demo in any AI agent
run_x402_demo.py
Full x402 demo: hits the live paywalled endpoint, card tap, real USDC, signal returned
run_test.py
Smoke test: request funding and verify on-chain balance
run_return_funds.py
Sweep residual USDC back to vault from an existing session