AutoGen ଭୁଗତାନ ସମ୍ମିଳନ।
AutoGen package ନାହିଁ, ଏବଂ ଆପଣଙ୍କୁ ତାହା ଦରକାର ମଧ୍ୟ ନାହିଁ। ଆସଲ blockchain0x client କୁ ଏକ function ଭିତରେ wrap କରନ୍ତୁ, ଆପଣଙ୍କ agent କୁ ଦିଅନ୍ତୁ, ଏବଂ ଏହା Base ଉପରେ USDC move କରିପାରିବ।
AutoGen-ନିର୍ଦ୍ଦିଷ୍ଟ କୌଣସି package ନାହିଁ, ଏବଂ ଆପଣଙ୍କୁ ଦରକାର ମଧ୍ୟ ନାହିଁ। AutoGen ପୂର୍ବରୁ ହିଁ ସାଧାରଣ typed function କୁ tool କରେ, ସେଥିପାଇଁ ଆପଣ ସତ୍ୟ Python client କୁ ଗୋଟିଏ function ଭିତରେ wrap କରନ୍ତୁ, କୁ ମାଧ୍ୟମରେ ଦିଅନ୍ତୁ, ଏବଂ agent Base ରେ USDC ପଠାଇପାରେ, invoice settle କରିପାରେ, ଏବଂ wallet ପଢ଼ିପାରେ। ସେଟ୍ କରନ୍ତୁ ଏବଂ ଆରମ୍ଭ କରନ୍ତୁ।
AutoGen ପୂର୍ବରୁ ଏକ function କୁ tool କରିଦେଇଛି। ସେଇଟି ବ୍ୟବହାର କରନ୍ତୁ।
AutoGen ଏକ Python function ର signature ଏବଂ docstring ରୁ ସିଧା tool schema ତିଆରି କରେ। ଏକ dedicated AutoGen adapter କେବଳ ସେହି function କୁ wrap କରିଥାନ୍ତା, ଯାହା ଆମେ ଯେପରିହେଉ ବୋଲି ଲେଖିଥାନ୍ତୁ, ତାପରେ AutoGen ର ଦ୍ରୁତଗତିରେ ବଦଳୁଥିବା API ସହିତ ସମୟସାପେକ୍ଷ ରହିପାରିବ ନାହିଁ। ସେଥିପାଇଁ ଆମେ ଏହା ship କରୁନାହୁଁ। ଆପଣ କିଛି line ଲେଖନ୍ତି ଯାହା real blockchain0x client କୁ call କରେ, ଏବଂ arguments, validation, ଏବଂ error handling ଉପରେ ସମ୍ପୂର୍ଣ୍ଣ control ରଖନ୍ତି।
ଏହା ସେହି ଏକାଇ client ଯାହାକୁ shipped LangChain ଏବଂ CrewAI adapters hood ର ତଳେ wrap କରନ୍ତି। ଏଠାରେ ଆପଣ ଏହାକୁ ନିଜେ wrap କରନ୍ତି, ଯାହାର ଅର୍ଥ track କରିବାକୁ କୌଣସି adapter version ନାହିଁ ଏବଂ ଆପଣଙ୍କ agent ଏବଂ API ମଧ୍ୟରେ ଆପଣଙ୍କ ନିଜ function ବ୍ୟତୀତ ଅନ୍ୟ କିଛି ନାହିଁ। Multi-agent teams ମଧ୍ୟ ସେହିଭଳି କାମ କରେ: wallet function କୁ ଏକ agent କୁ ଦିଅନ୍ତୁ, ଅନ୍ୟମାନଙ୍କ ପାଖରେ ଏହା ନ ରଖନ୍ତୁ, ଏବଂ spending authority ଏକ ସ୍ଥାନରେ ରହିଥାଏ।
AutoGen ଏବଂ core SDK ଇନଷ୍ଟଲ୍ କରନ୍ତୁ। ଗୋଟିଏ environment variable।
ଯୋଡିବା ପାଇଁ ଅଲଗା AutoGen package ନାହିଁ। ଆପଣ AutoGen (Python 3.10+) ଏବଂ ଆସଲ blockchain0x core SDK install କରନ୍ତୁ, ତାପରେ ତଳେ ଥିବା function ଲେଖନ୍ତୁ। ସମ୍ପୂର୍ଣ୍ଣ dependency list ଏତିକି ହିଁ।
pip install autogen-agentchat "autogen-ext[openai]" blockchain0x
export BLOCKCHAIN0X_API_KEY=sk_test_... # sk_test_ = Base Sepolia, sk_live_ = Base mainnet
BLOCKCHAIN0X_API_KEY ହେଉଛି ଆପଣଙ୍କ dashboard ରୁ ମିଳୁଥିବା sk_test_ testnet କିମ୍ବା sk_live_ mainnet key; client ଏହାକୁ environment ରୁ ପଢ଼େ। ଯଦି ଆପଣଙ୍କ agent ମଧ୍ୟ ଟଙ୍କା ଗ୍ରହଣ କରେ, webhook handler କୁ ଅତିରିକ୍ତ ଭାବେ BLOCKCHAIN0X_WEBHOOK_SECRET ଆବଶ୍ୟକ, ଯାହା dashboard webhook create କିମ୍ବା rotate କରିବାବେଳେ ଗୋଟିଏଥର ଦେଉଛି।
ପେ କରୁଥିବା ଏକ function, AssistantAgent କୁ ଦିଆଯାଏ।
ନିମ୍ନରେ ସମ୍ପୂର୍ଣ୍ଣ integration ଅଛି। send_usdc real blockchain0x client କୁ call କରେ; AssistantAgent(tools=[send_usdc]) ଏହାକୁ model call କରିପାରୁଥିବା tool ରେ ପରିଣତ କରେ। AutoGen schema build କରିବା ପାଇଁ type hints ଏବଂ docstring ପଢେ, ସେଥିପାଇଁ ସେଗୁଡିକୁ ସତ୍ୟ ରଖନ୍ତୁ। ଏହାକୁ run କରନ୍ତୁ ଏବଂ agent Base ରେ USDC move କରେ।
from autogen_agentchat.agents import AssistantAgent from autogen_ext.models.openai import OpenAIChatCompletionClient from blockchain0x import Client blockchain0x = Client() # reads BLOCKCHAIN0X_API_KEY from the environment # AutoGen turns a plain typed function into a tool. No dedicated package needed. def send_usdc(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. """ result = blockchain0x.payments.create( body={"agentId": agent_id, "to": to, "amountWei": amount_wei}, ) return str(result) treasurer = AssistantAgent( name="treasurer", model_client=OpenAIChatCompletionClient(model="gpt-4o"), tools=[send_usdc], system_message="You pay vendor invoices in USDC within owner-set limits.", ) result = await treasurer.run( task="Pay 0.01 USDC from agent agt_123 to 0xVendor for the dataset.", )
When the agent decides to pay, it 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_. Add more functions - read a wallet, settle an invoice - the same way; each becomes another entry in tools.
ସାଇନ୍ କରାଯାଇଥିବା ଓବ୍ହେକ୍ ସହିତ ଆସନ୍ତା ଦେୟଗୁଡିକୁ ନିଶ୍ଚୟ କରନ୍ତୁ।
ଯଦି ଆପଣଙ୍କ agent ମଧ୍ୟ USDC receive କରେ, polling ଚାଇଁତି ନୁହେଁ, webhook ଦ୍ୱାରା ଏହାକୁ confirm କରନ୍ତୁ। verify helper Node SDK ସହିତ ଆସେ; Python service ରେ ଆପଣ documented HMAC ଅନୁସାରେ ହାତେ verify କରନ୍ତି, ଯାହା helper ହିଁ କରେ। ତଳେ FastAPI example ଅଛି; ସେଇ code ଯେକୌଣସି async Python framework ରେ କାମ କରେ।
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}
algorithm ଟି t.rawBody string ଉପରେ HMAC-SHA256, constant-time compare, ଏବଂ 300-second replay window ବ୍ୟବହାର କରେ। await request.body() ମାଧ୍ୟମରେ raw body ପଢ଼ନ୍ତୁ, କେବେ ମଧ୍ୟ request.json() re-serialized କରନ୍ତୁ ନାହିଁ, କାରଣ ଏହା signature ଆବର୍ତ୍ତିତ bytes କୁ ପରିବର୍ତ୍ତନ କରେ। shipped events ହେଉଛି payment.received, payment.sent, wallet.deployed, ଏବଂ webhook.test। heavy follow-up work ପାଇଁ, job (Celery, RQ, arq) enqueue କରନ୍ତୁ ଏବଂ handler କୁ block କରିବା ପେକ୍ଷା ସତ୍ୱର 200 respond କରନ୍ତୁ।
ଆପଣ wrap କରୁଥିବା client open ଅଟେ। ଏହାକୁ ପଢ଼ନ୍ତୁ।
Clone କରିବା ପାଇଁ AutoGen starter package ନାହିଁ - ଉପରେ ଥିବା recipe ହିଁ integration। blockchain0x SDKs GitHub ଉପରେ open source ଅଟେ; ଏହି recipe Python SDK (blockchain0x-python) କୁ wrap କରେ, ଏବଂ docs ରେ full method surface ଅଛି। function bodies ପାଇଁ reference ଭାବେ ଏହାକୁ ପଢନ୍ତୁ।
github.com/tosh-labs/blockchain0x-pythonFull SDK method surface ଏବଂ scopes the docs ରେ documented ଅଛି। Base Sepolia ବିରୁଦ୍ଧରେ sk_test_ key ରୁ ଆରମ୍ଭ କରନ୍ତୁ, ପରେ function ଆପଣ ଆଶା କରୁଥିବାଭଳି କାମ କଲେ sk_live_ କୁ switch କରନ୍ତୁ।
ପାଞ୍ଚ ଗ୍ରୁପ୍-ଚାଟ୍ ଏବଂ ଏସିଙ୍କ୍ ଜାଲକୁ ଏଡାଇବାକୁ।
AutoGen ର ମଲ୍ଟି-ଏଜେଣ୍ଟ + async ଡିଜାଇନ୍ ଶକ୍ତିଶାଳୀ ଆକୃତିଗୁଡିକୁ ଖୋଲେ କିନ୍ତୁ ଏହାର ନିଜସ୍ୱ ଫୁଟଗନ୍ସକୁ ଆଣେ। ଏହାଗୁଡିକ ଆମର ସମର୍ଥନ ଇନ୍ବକ୍ସରୁ ଆସିଛି।
AutoGen package ନାହିଁ - ଆପଣ SDK କୁ wrap କରନ୍ତି
Blockchain0x LangChain ଏବଂ CrewAI ପାଇଁ adapters ସହିତ MCP server ମଧ୍ୟ ship କରେ; AutoGen ପାଇଁ dedicated package ନାହିଁ। ଉପରେ ଥିବା recipe ହିଁ supported path: ଏକ ସାଧାରଣ typed function, ଯାହା real blockchain0x client କୁ call କରେ, ଏବଂ AssistantAgent(tools=[...]) କୁ ଦିଆଯାଏ। AutoGen tool schema build କରିବା ପାଇଁ function signature ଏବଂ docstring ପଢେ, ସେଥିପାଇଁ docstring କୁ ସଠିକ୍ ରଖନ୍ତୁ।
ରାଶିଗୁଡ଼ିକ USDC base units ରେ, string ଭାବେ
payments.create takes amountWei: a string of USDC base units, not a float and not a dollar figure. USDC has 6 decimals, so 0.01 USDC is "10000" and 5 USDC is "5000000". Type the tool argument as str and validate it before the call - a float that sneaks through either errors at the backend or moves a millionth of what you meant.
send_payment ପ୍ରାରମ୍ଭରେ 503 ଫେରାଇପାରେ
payments.create default ଭାବରେ retry କରେ ନାହିଁ ଏବଂ chain adapter ଆପଣଙ୍କ network ପାଇଁ wired ହେଉପର୍ଯ୍ୟନ୍ତ 503 ଫେରାଇପାରେ। group chat କୁ failed payment ଉପରେ loop କରିବାକୁ ଦିଅନ୍ତୁ ନାହିଁ - ଆପଣଙ୍କ function ଭିତରେ error କୁ ଧରନ୍ତୁ, model କାର୍ଯ୍ୟ କରିପାରିବା ପାଇଁ ସ୍ପଷ୍ଟ message ଫେରାନ୍ତୁ, ଏବଂ auto-minted idempotency key ଉପରେ ଭରସା କରନ୍ତୁ ଯାହାଦ୍ୱାରା manual retry ଦୁଇଥର ଭୁଗତାନ କରିବ ନାହିଁ।
AutoGen 0.4+ async ଅଟେ; SDK call sync ଅଟେ
AutoGen 0.4 tools କୁ async loop ରେ ଚଲାଏ। blockchain0x client call synchronous, ଯାହା ଏକ ଶୀଘ୍ର request ପାଇଁ ଠିକ୍, କିନ୍ତୁ ଏକ ଧୀର call loop କୁ block କରେ। ଯଦି ଆପଣ ପ୍ରକୃତ volume handle କରୁଛନ୍ତି, event loop responsive ରଖିବା ପାଇଁ SDK call କୁ asyncio.to_thread ସହିତ wrap କରନ୍ତୁ। ପ୍ରତି turn ରେ ଗୋଟିଏ payment ପାଇଁ, ସିଧାସଳଖ call କରିବା ଠିକ୍ ଅଟେ।
କଚା ଦେହ ବିପରୀତ ଇନବାଉଣ୍ଡ ଓେଭୁକ୍ସକୁ ପରୀକ୍ଷା କରନ୍ତୁ
ଯଦି ଆପଣଙ୍କ agent ମଧ୍ୟ money RECEIVE କରେ, polling ଦ୍ୱାରା ନୁହେଁ, webhook ଦ୍ୱାରା ଏହାକୁ confirm କରନ୍ତୁ। RAW request bytes (await request.body()) ଉପରେ signature verify କରନ୍ତୁ, କେବେ ମଧ୍ୟ request.json() କୁ re-serialized କରିବେ ନାହିଁ, କାରଣ HMAC exact bytes କୁ ଆବରଣ କରେ। ଏହା 300-second replay window ସହିତ HMAC-SHA256। ତଳର handler ହିଁ ସମ୍ପୂର୍ଣ୍ଣ।