મુખ્ય સામગ્રી પર જાઓ
AGNO ઇન્ટિગ્રેશન

Agno ચુકવણી એકીકરણ.

કોઈ Agno પેકેજ નથી, અને તમને એકની જરૂર નથી. વાસ્તવિક blockchain0x ક્લાયન્ટને નાનકડી Toolkit માં લપેટો અને તમારો એજન્ટ Base પર USDC ખસેડી શકે છે - ન્યૂનતમ અભિપ્રાય, Agnoનો માર્ગ.

ટૂંકું જવાબ

કોઈ Agno-specific package નથી, અને તમને તેની જરૂર પણ નથી. Agno એક method ને tool માં ફેરવે છે, તેથી તમે real Python client ને નાનાં toolkit માં wrap કરો છો અને તેને તમારા માં ઉમેરો છો. agent USDC મોકલી શકે છે, invoices settle કરી શકે છે, અને wallets વાંચી શકે છે, Agno ના દરેક model (OpenAI, Anthropic, DeepSeek, Llama, Mistral) પર. Payments Base પર settle થાય છે.

શા માટે AGNO

હલકો પાયથન ફ્રેમવર્ક. કોઈ અભ્યાસ કરવાપણું કરવું નથી.

Agno (પૂર્વે Phidata) એ એજન્ટ ફ્રેમવર્ક છે જે તમે ઓછા સમારંભ માટે પહોંચો છો. ત્યાં કોઈ ગ્રાફ બિલ્ડર નથી, કોઈ ક્રૂ નથી, કોઈ વર્કફ્લો નથી - ફક્ત એજન્ટ, ટૂલ્સ, અને run() પદ્ધતિ. ટૂલ્સ પાયથન કોલેબલ્સ છે. ફ્રેમવર્ક ટૂલ સપોર્ટ સાથે LLMsને બોલાવવા માટે પૂરતી સ્કાફોલ્ડિંગ ઉમેરે છે, મેમરીને મેનેજ કરે છે, અને સ્ટ્રીમિંગ આઉટપુટ ઉત્પન્ન કરે છે, પછી તમારા માર્ગમાંથી બહાર નીકળી જાય છે.

રીસિપી સમાન તત્વોનું પાલન કરે છે. તમે એક નાનું Toolkit ઉપવર્ગ લખો છો જે એક પદ્ધતિને નોંધણી કરે છે જે વાસ્તવિક ક્લાયન્ટને કૉલ કરે છે - તે અન્ય દરેક Agno સાધનની જેમ દેખાય છે અને વર્તે છે. સ્થાપનથી આગળ કોઈ વિશેષ સેટઅપ નથી, કોઈ ગ્રાફને વાયર કરવા માટે નથી, કોઈ એડેપ્ટર સંસ્કરણને ટ્રેક કરવા માટે નથી. સરળતા મુદ્દો છે: જો તમે ગ્રાફ્સ ઇચ્છતા હો, તો તમે LangGraph પર હશો.

સ્થાપન

Agno અને મુખ્ય SDK સ્થાપિત કરો. બે કી.

જોડવા માટે કોઈ blockchain0x Agno પેકેજ નથી. તમે Agno (Python 3.10+, Phidata નામ બદલ્યા પછી 1.0+ લાઇન) અને વાસ્તવિક blockchain0x મુખ્ય SDKને ઇન્સ્ટોલ કરો છો, પછી નીચેનું ટૂલકિટ લખો. જો તમે હજુ phi.* આયાત પર છો, તો પહેલા pip install -U agno ચલાવો.

સ્થાપિત કરો
pip install agno blockchain0x
પર્યાવરણ ચલ
export OPENAI_API_KEY=sk-...
export BLOCKCHAIN0X_API_KEY=sk_test_...   # sk_test_ = Base Sepolia, sk_live_ = Base mainnet

OPENAI_API_KEY (અથવા તમે ઉપયોગ કરો તે Agno-supported modelનું સમકક્ષ). BLOCKCHAIN0X_API_KEY તમારા dashboardમાંથી મળતી sk_test_ testnet અથવા sk_live_ mainnet key છે; client તેને environmentમાંથી વાંચે છે. જો તમારો agent પૈસા પણ મેળવે છે, તો webhook handler ને વધારામાં BLOCKCHAIN0X_WEBHOOK_SECRETની જરૂર પડશે.

રસોઈ

એક ટૂલકિટ જે ચૂકવે છે, એજન્ટને સોંપવામાં આવે છે.

નીચે સમગ્ર એકીકરણ છે. WalletTools એ Toolkit ઉપવર્ગ છે જે send_usdcને નોંધણી કરે છે, જે વાસ્તવિક blockchain0x ક્લાયન્ટને કોલ કરે છે. તેને એજન્ટમાં ઉમેરો અને run() કોલ સાધન આમંત્રણને સંચાલિત કરે છે. Agno પદ્ધતિના હસ્તાક્ષર અને ડોકસ્ટ્રિંગને વાંચે છે જેથી સ્કીમા બનાવવામાં આવે.

AGENT.PY
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools import Toolkit
from blockchain0x import Client

blockchain0x = Client()  # reads BLOCKCHAIN0X_API_KEY from the environment

# Wrap the real client in an Agno Toolkit. No dedicated package needed.
class WalletTools(Toolkit):
    def __init__(self):
        super().__init__(name="wallet_tools")
        self.register(self.send_usdc)

    def send_usdc(self, agent_id: str, to: str, amount_wei: str) -> str:
        """Send a USDC payment from an agent wallet.

        amount_wei is USDC base units (6 decimals), so "10000" is 0.01 USDC.
        """
        return str(
            blockchain0x.payments.create(body={"agentId": agent_id, "to": to, "amountWei": amount_wei})
        )

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[WalletTools()],
    instructions=["You pay vendor invoices in USDC within owner-set limits."],
)

result = agent.run("Pay 0.01 USDC from agent agt_123 to 0xVendor for the dataset.")
print(result.content)

When agent.run() executes, the model decides to pay, calls send_usdc, the SDK submits the transfer, and you get a transaction hash back. amount_wei is base units, so 0.01 USDC is "10000". A sk_test_ key keeps it on Base Sepolia until you switch to sk_live_. Register more methods on the toolkit - read a wallet, settle an invoice - the same way.

વેબહૂક હેન્ડલિંગ

સહી કરેલ વેબહૂક સાથે ઇનબાઉન્ડ ચુકવણીઓની પુષ્ટિ કરો.

જો તમારો એજન્ટ પણ USDC પ્રાપ્ત કરે છે, તો તેને વેબહૂક સાથે પુષ્ટિ કરો, પોલિંગ દ્વારા નહીં. ચકાસણી સહાયક નોડ SDK માં શિપ થાય છે; એક પાયથન સેવા માં તમે દસ્તાવેજિત HMAC સામે હાથથી ચકાસો છો, જે સહાયક કરે છે. નીચેનું ફાસ્ટએપીઆઈ ઉદાહરણ; તે જ કોડ કોઈપણ અસિંક પાયથન ફ્રેમવર્કમાં કાર્ય કરે છે.

વેબહૂક.PY
import hmac, hashlib, os, time
from fastapi import FastAPI, Request, HTTPException

app = FastAPI()
SECRET = os.environ["BLOCKCHAIN0X_WEBHOOK_SECRET"].encode()

@app.post("/webhooks/payment")
async def receive(request: Request):
    raw = await request.body()  # RAW bytes - do not parse first
    sig = request.headers.get("X-Blockchain0x-Signature", "")
    ts = request.headers.get("X-Blockchain0x-Timestamp", "")
    parts = dict(p.split("=", 1) for p in sig.split(",") if "=" in p)
    t, v1 = parts.get("t", ts), parts.get("v1", sig)
    want = hmac.new(SECRET, t.encode() + b"." + raw, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(want, v1) or abs(time.time() - int(t)) > 300:
        raise HTTPException(status_code=401)
    if request.headers.get("X-Blockchain0x-Event-Type") == "payment.received":
        await trigger_followup()  # USDC landed - run the next step
    return {"ok": True}

અલ્ગોરિધમ t.rawBody પર HMAC-SHA256 છે, એક સ્થિર-સમયની તુલના, અને 300-સેકન્ડનું પુનરાવર્તન વિન્ડો. કાચી બોડીને await request.body() દ્વારા વાંચો, ક્યારેય request.json() ફરીથી-સિરિયલાઇઝ ન કરો, કારણ કે તે સહીના કવર કરેલા બાઇટ્સને બદલે છે. શિપ કરેલ ઇવેન્ટ્સ છે payment.received, payment.sent, wallet.deployed, અને webhook.test. ભારે અનુસરણ કાર્ય માટે, એક નોકરી (Celery, arq) એન્ક્યૂ કરો અને હેન્ડલરને બ્લોક કરવા કરતાં તરત 200 પ્રતિસાદ આપો.

સ્રોત અને દસ્તાવેજો

તમે લપેટી રહેલા ક્લાયન્ટ ખુલ્લા છે. તેને વાંચો.

ક્લોન કરવા માટે કોઈ Agno starter package નથી - ઉપર આપેલું recipe જ integration છે. blockchain0x SDKs GitHub પર open source છે; આ recipe Python SDK (blockchain0x-python)ને wrap કરે છે, અને સંપૂર્ણ method surface docsમાં છે. toolkit methods માટે reference તરીકે તેને વાંચો.

github.com/tosh-labs/blockchain0x-python

સંપૂર્ણ SDK method surface અને scopes the docsમાં documented છે. Base Sepolia સામે sk_test_ keyથી શરૂ કરો, પછી toolkit અપેક્ષા મુજબ કામ કરે ત્યારે sk_live_ પર switch કરો.

સામાન્ય ખોટા પગલાં

પાંચ Agno-વિશિષ્ટ બાબતો જે ધ્યાનમાં રાખવી.

Agno એ જોડાણ કરવા માટેના વધુ સ્વચ્છ એજન્ટ ફ્રેમવર્કમાંની એક છે, પરંતુ તેમાં તેના પોતાના ગોટચાસ છે - ખાસ કરીને Phidata નામ બદલવા અને માર્કડાઉન રેન્ડરિંગની આસપાસ.

PITFALL 1

કોઈ Agno પેકેજ નથી - તમે SDK ને Toolkit માં લપેટો છો

Blockchain0x LangChain અને CrewAI માટે એડેપ્ટર્સ મોકલે છે અને MCP સર્વર; ત્યાં કોઈ સમર્પિત Agno પેકેજ નથી. ઉપરનો નુસખો માર્ગ છે: એક Toolkit ઉપવર્ગ જે વાસ્તવિક blockchain0x ક્લાયન્ટને કોલ કરતી પદ્ધતિને નોંધણી કરે છે. Agno પદ્ધતિના હસ્તાક્ષર અને ડોકસ્ટ્રિંગને વાંચે છે જેથી સાધન સ્કીમા બનાવવામાં આવે, તેથી ડોકસ્ટ્રિંગને ચોક્કસ રાખો.

PITFALL 2

Phidata થી Agno માઇગ્રેશન ગેરસમજ

Agnoને 2024માં Phidataમાંથી નામ બદલવામાં આવ્યું હતું. phi.agent અથવા phi.toolsમાંથી આયાત કરનારી જૂની કોડબેઝો હજુ પણ સુસંગત શિમ દ્વારા કાર્ય કરે છે, પરંતુ agno.* આયાતો વર્તમાન છે. રેસીપી agno.* ને સમગ્રમાં ઉપયોગ કરે છે; જો તમારું કોડ હજુ phi.* આયાત પર છે, તો pip install -U agno ચલાવો અને ટૂલકિટ ઉમેરવા પહેલા આયાતના માર્ગોને બદલાવો.

PITFALL 3

રકમ USDC આધાર એકમો છે, સ્ટ્રિંગ્સ તરીકે

payments.create takes amountWei: a string of USDC base units (6 decimals), so 0.01 USDC is "10000" and 5 USDC is "5000000". Type the method argument as str. It also does not retry by default and can answer 503 until the chain adapter is wired for your network - return a clear message rather than letting the agent loop.

PITFALL 4

સંકલન સામે અસંકલન ચલાવો

Agno એજન્ટ.run() (સંકલન) અને એજન્ટ.arun() (અસંકલન) ને સપોર્ટ કરે છે. દરેક એજન્ટ માટે એક મોડ પસંદ કરો - એજન્ટ.run()ને કોલ કરો અને પરિણામની રાહ જોવાનો પ્રયાસ કરો અને તમને એક કોરુટિન મળે છે જ્યાં તમે એક સ્ટ્રિંગની અપેક્ષા રાખી હતી. ટૂલકિટની અંદર blockchain0x કોલ સંકલિત છે; જો તમે અસંકલિત માર્ગ પર છો અને વાસ્તવિક વોલ્યુમ ખસેડી રહ્યા છો, તો તેને asyncio.to_thread સાથે લપેટો જેથી ઇવેન્ટ લૂપ પ્રતિસાદી રહે.

PITFALL 5

કાચા બોડી સામે વેબહુક્સની પુષ્ટિ કરો

જો તમારો એજન્ટ પણ USDC પ્રાપ્ત કરે છે, તો તેને વેબહૂક સાથે પુષ્ટિ કરો, પોલિંગ દ્વારા નહીં. RAW વિનંતી બાઇટ્સ (await request.body()) પર સહીને ચકાસો, ક્યારેય request.json() પુનઃસિરિયલાઇઝ ન કરો, કારણ કે HMAC ચોક્કસ બાઇટ્સને આવરી લે છે. તે HMAC-SHA256 છે જે 300-સેકન્ડ રિપ્લે વિન્ડો સાથે છે. નીચેનો હેન્ડલર આખું છે.

વારંવાર પૂછવામાં આવતી

ત્રણ Agno-વિશિષ્ટ પ્રશ્નો.

શું સ્થાપિત કરવા માટે કોઈ સમર્પિત Agno પેકેજ છે?

ના. Agno પહેલેથી જ Toolkit પદ્ધતિને એક ટૂલમાં ફેરવે છે, તેથી સત્ય માર્ગ એ છે કે વાસ્તવિક blockchain0x ક્લાયન્ટને Toolkit ઉપવર્ગમાં તમે જાતે લપેટો, જેમ કે ઉપર દર્શાવ્યું છે. એકમાત્ર શિપ્ડ ફ્રેમવર્ક પેકેજો blockchain0x-langchain અને blockchain0x-crewai (બન્ને Python) અને @blockchain0x/mcp સર્વર છે. Agno, અન્ય ફ્રેમવર્ક્સની જેમ જે સમર્પિત એડેપ્ટર વિના છે, આ થોડા-લાઇન રેસીપી છે.

શું આ Agno Teams (બહુ-એજન્ટ સહયોગ) સાથે કાર્ય કરે છે?

હાં. Agno Teams અનેક Agents ને એક coordinated unit માં જોડે છે. WalletTools toolkit તે સૂચિમાં ધરાવતો કોઈપણ agent માં કામ કરે છે. Teams માટે સ્વચ્છ pattern એ છે કે wallet toolkit એક dedicated treasurer agent ને આપો અને બીજા members ને કામ કરવા દો, જેથી spending authority એક જ જગ્યાએ રહે - CrewAI recipe જેવી જ રચના. toolkit માં read અને settle methods પણ એ જ રીતે ઉમેરો (blockchain0x.transactions.get, blockchain0x.agents.get, blockchain0x.payment_requests.settle).

શું તે કારણભૂત મોડલ અને એજન્ટયુઆઈ સાથે કાર્ય કરે છે?

હા. તર્ક મોડેલ (o1, DeepSeek R1) ટૂલ્સને સમાન રીતે કોલ કરે છે, ફક્ત દરેક ફેરવવા માટે ધીમું, તેથી જો તમે ઇચ્છો છો કે વપરાશકર્તા કોલ પૂર્ણ થાય તે પહેલાં પ્રગતિ જોઈ શકે, તો આંશિક પ્રતિસાદને સ્ટ્રીમ કરો. AgentUIમાં, Agnoના રન ઇન્સ્પેક્ટર, send_usdc કોલ ટૂલ-કોલ્સ પેનલમાં અન્ય કોઈપણ ટૂલની જેમ દેખાય છે, જે વિકાસ દરમિયાન Base Sepolia પર ચુકવણી પસાર થવા માટે જોવા માટે ઉપયોગી છે.

તમારા Agno એજન્ટના કાર્ય માટે ચાર્જ કરો.

વાસ્તવિક ક્લાયન્ટને લપેટતા એક નાનું ટૂલકિટ, ઇન્સ્ટોલ કરવા માટે કોઈ પેકેજ નથી. શરૂ કરવા માટે મફત.