ମୁଖ୍ୟ ବିଷୟବସ୍ତୁକୁ ଛାଡ଼ନ୍ତୁ
CREWAI INTEGRATION

CrewAI ପେମେଣ୍ଟ୍ ଇଣ୍ଟେଗ୍ରେସନ୍।

CrewAI କ୍ରୁକୁ ଏକ ୱାଲେଟ୍ ଦିଅନ୍ତୁ। ଏକ ନିର୍ଦ୍ଧାରିତ ଟ୍ରେଜରର୍ ଏଜେଣ୍ଟ USDC ପଠାଇଥାଏ, ଇନଭଏସ୍ ସେଟଲ୍ କରେ, ଏବଂ କାମ ଏଜେଣ୍ଟମାନେ କାମରେ ଧ୍ୟାନ ଦେଇଥିବାବେଳେ ବାଲାନ୍ସ ପଢିଥାଏ।

ସଂକ୍ଷିପ୍ତ ଉତ୍ତର

Blockchain0x ଏକ real Python package, , ଶିପ୍ କରେ। Install କରନ୍ତୁ, ସେଟ୍ କରନ୍ତୁ, କଲ୍ କରନ୍ତୁ, ଏବଂ tools କୁ ଏକ dedicated treasurer agent କୁ ଦିଅନ୍ତୁ। ସେହି agent USDC ପଠାଇପାରେ, on-chain proof ସହିତ invoice settle କରିପାରେ, ଏବଂ wallets ପଢ଼ିପାରେ, ଯେତେବେଳେ crew ର work agents ମାନଙ୍କ ପାଖରେ କୌଣସି wallet access ନଥାଏ। USDC Base ରେ settle ହୁଏ।

କାହିଁକି ଏକ ସମର୍ପିତ ଖଜାନ୍ଚୀ ଭୂମିକା

CrewAIର ଶକ୍ତି ହେଉଛି ଭୂମିକା ବିଭାଜନ। ଏହାକୁ ୱାଲେଟ୍ ପାଇଁ ମଧ୍ୟ ବ୍ୟବହାର କର।

ଅନ୍ୟ ଫ୍ରେମ୍‌ୱର୍କ୍ ଗୋଟିଏ ଏଜେଣ୍ଟ୍ ଉପରେ ପ୍ରତ୍ୟେକ ଟୁଲ୍ ପିଲାଇ ଦେଇଥାଏ। CrewAI ର ଡିଜାଇନ୍ ଭୂମିକା ବିଭାଜନକୁ ପ୍ରୋତ୍ସାହନ କରେ: ଗବେଷକ ଗବେଷଣା କରେ, ଲେଖକ ଲେଖେ, ସମୀକ୍ଷକ ସମୀକ୍ଷା କରେ। ଟଙ୍କା ସେହି ଚିକିତ୍ସାକୁ ଯୋଗ୍ୟ - ଏକ ନିର୍ଦ୍ଦିଷ୍ଟ ଟ୍ରେଜର୍ ଏଜେଣ୍ଟ୍ ୱାଲେଟ୍ ଟୁଲ୍ ଧରେ, ଏବଂ କାମ କରୁଥିବା ଏଜେଣ୍ଟ୍ କିଛି ଧରେ ନାହିଁ। ବ୍ୟୟ କ୍ଷମତା ଗୋଟିଏ ସ୍ଥାନରେ ଅଛି ବଜାୟ ସେହି ଏଜେଣ୍ଟ୍ ମଧ୍ୟରେ ଲିକ୍ କରିବା।

ଏହି shape audit trails କୁ ମଧ୍ୟ ଅଧିକ ସ୍ପଷ୍ଟ କରେ। ଯେତେବେଳେ USDC move ହୁଏ, ଆପଣ ନିର୍ଦ୍ଦିଷ୍ଟ ଭାବେ ଜାଣନ୍ତି କେଉଁ agent ଏହା move କଲା (treasurer) ଏବଂ କେଉଁ task ପାଇଁ ଥିଲା (ଯେଉଁଟି ଏହାକୁ hand off କଲା)। Single-agent integrations ସେହି line କୁ blur କରିଦିଏ ଏବଂ per-task spend analytics କୁ ଅଧିକ କଷ୍ଟକର କରେ।

ଇନ୍ସ୍ଟଲେସନ୍

ଗୋଟିଏ pip ଇନ୍‌ସ୍ଟଲ୍। ଗୋଟିଏ ପରିବେଶ ଚଳକ।

ଏହି package କୁ Python 3.10 କିମ୍ବା ତାହାଠାରୁ ନୂତନ ଆବଶ୍ୟକ ଏବଂ poetry କିମ୍ବା pip ସହିତ କାମ କରେ। ଏହା core blockchain0x SDK ଏବଂ crewai କୁ dependencies ଭାବେ ନେଇଆସେ; ଆଉ କିଛି ଯୋଡ଼ିବାକୁ ନାହିଁ।

ଇନ୍ସ୍ଟଲ୍
pip install blockchain0x-crewai
ପରିବେଶ ଚଳକଗୁଡିକ
export BLOCKCHAIN0X_API_KEY=sk_test_...   # sk_test_ = Base Sepolia, sk_live_ = Base mainnet

BLOCKCHAIN0X_API_KEY ହେଉଛି ଆପଣଙ୍କ Blockchain0x dashboard ରୁ ମିଳୁଥିବା sk_test_ testnet କିମ୍ବା sk_live_ mainnet key, ଏବଂ ଏହାହିଁ adapter ଦ୍ୱାରା ଆବଶ୍ୟକ ଏକମାତ୍ର variable - ଏହା key କୁ backend କୁ ପଠାଏ ଏବଂ ନିଜସ୍ୱ କୌଣସି secret ରଖେ ନାହିଁ। ନିମ୍ନର webhook handler ପାଇଁ ଆପଣ BLOCKCHAIN0X_WEBHOOK_SECRET ମଧ୍ୟ set କରନ୍ତି, ଯାହା dashboard webhook create କିମ୍ବା rotate କରିବାବେଳେ ଗୋଟିଏଥର ଦେଉଛି।

ସମ୍ପୂର୍ଣ୍ଣ କ୍ରୁ ଉଦାହରଣ

ବିଲିଂ + ଗବେଷଣା ଭୂମିକା ସହିତ କାମ କରୁଥିବା ଦୁଇ-ଏଜେଣ୍ଟ କ୍ରୁ।

ନିମ୍ନରେ ଏକ ସମ୍ପୂର୍ଣ୍ଣ CrewAI crew ଅଛି, ଯେଉଁଠାରେ ଜଣେ treasurer agent USDC ରେ ଏକ data vendor କୁ payment କରେ, ଏବଂ ଜଣେ researcher agent ସେହି result ବ୍ୟବହାର କରେ। treasurer ପାଖରେ wallet tools ଥାଏ; researcher ପାଖରେ କିଛି ନଥାଏ। ଏହା spend କରୁଥିବା crew ପାଇଁ canonical pattern।

CREW.PY
from crewai import Agent, Task, Crew
from blockchain0x import Client
from blockchain0x_crewai import create_blockchain0x_toolset

client = Client()  # reads BLOCKCHAIN0X_API_KEY from the environment
tools = create_blockchain0x_toolset(client)

# A dedicated treasurer holds the wallet tools; the work agents do not.
treasurer = Agent(
    role="Treasurer",
    goal="Pay vendor invoices in USDC within owner-set limits",
    backstory="Operates a Blockchain0x agent wallet on Base.",
    tools=tools,
    allow_delegation=False,
)

researcher = Agent(
    role="Senior Market Analyst",
    goal="Produce a thorough Q4 LLM market analysis",
    backstory="A specialist analyst with 10 years in tech-market research.",
    tools=[],
    allow_delegation=False,
)

pay_task = Task(
    description="Pay 0.01 USDC from our agent wallet to the data vendor at 0xVendor.",
    expected_output="The transaction hash of the settled payment.",
    agent=treasurer,
)

research_task = Task(
    description="Using the purchased dataset, write the Q4 LLM market analysis.",
    expected_output="A 1,500-word market analysis.",
    agent=researcher,
    context=[pay_task],
)

crew = Crew(agents=[treasurer, researcher], tasks=[pay_task, research_task])
result = crew.kickoff()

When you call crew.kickoff(), the pay_task runs first: the treasurer calls blockchain0x_send_payment, the SDK submits the transfer on Base, and the transaction hash is the task output. The research_task runs next and uses the purchased result. amount_wei is USDC base units, so 0.01 USDC is the string "10000". On a sk_test_ key the whole flow runs on Base Sepolia, and payments.create can answer 503 until the chain adapter is wired for your network.

ୱେବ୍‌ହୁକ୍ ହ୍ୟାଣ୍ଡଲିଂ

Payment land ହେଲେ next crew କୁ trigger କରିବା।

USDC ଆପଣଙ୍କ agent କୁ settle ହେଲେ, Blockchain0x ଆପଣଙ୍କ webhook URL କୁ ଏକ signed event POST କରେ। verify helper Node SDK ରେ ship ହୁଏ; ଏକ Python service documented HMAC ବିରୁଦ୍ଧରେ ନିଜେ ଯାଞ୍ଚ କରେ, ଯାହା helper ଯେତେଟି କରେ ସେତେଟି ହିଁ। ତଳେ Flask example ଦିଆଯାଇଛି; ସେହି code FastAPI କିମ୍ବା କୌଣସି Python web framework ରେ ମଧ୍ୟ କାମ କରେ।

ୱେବ୍‌ହୁକ୍_ହ୍ୟାଣ୍ଡଲର୍.ପାଇ
import hmac, hashlib, os, time
from flask import Flask, request, abort

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

@app.post("/webhooks/payment")
def receive():
    raw = request.get_data()  # RAW bytes - do not parse first
    sig = request.headers.get("X-Blockchain0x-Signature", "")
    ts = request.headers.get("X-Blockchain0x-Timestamp", "")
    # Header is "t=<unix>,v1=<hex>"; some proxies send bare hex + the ts header.
    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:
        abort(401)
    if request.headers.get("X-Blockchain0x-Event-Type") == "payment.received":
        run_followup_for(request.get_json())  # USDC landed - do the work
    return "ok", 200

ଏହା ହିଁ ଆସଲ algorithm: t.rawBody string ଉପରେ HMAC-SHA256, ଏକ constant-time compare, ଏବଂ 300-second replay window। raw body (request.get_data()) ପଢନ୍ତୁ, କେବେ ମଧ୍ୟ request.get_json() କୁ re-serialized କରନ୍ତୁ ନାହିଁ, କାରଣ ତାହା signature ଯେ bytes କୁ cover କରେ ସେଗୁଡିକୁ ପରିବର୍ତ୍ତନ କରେ। Architecture: handler କୁ ଏକ job (Celery, RQ, Redis list) enqueue କରିବାକୁ ଦିଅନ୍ତୁ ଯାହା ଆସଲ CrewAI run କୁ trigger କରେ। handler ଭିତରେ crew.kickoff() call କଲେ କେତେକ minute ଲାଗିପାରେ ଏବଂ HTTP request timeout ହୋଇଯାଏ।

ଏକ ଟୁଲ୍, କିମ୍ବା ସମସ୍ତ ପାଞ୍ଚ

କ୍ରୁକୁ ସମସ୍ତ ଟୁଲ୍ ସେଟ୍ ଦିଅନ୍ତୁ, କିମ୍ବା କେବଳ ଗୋଟିଏ ଟୁଲ୍।

create_blockchain0x_toolset ସମସ୍ତ ପାଞ୍ଚଟି tool ଫେରାଏ: blockchain0x_send_payment, blockchain0x_settle_invoice, blockchain0x_get_wallet, blockchain0x_list_wallets, ଏବଂ blockchain0x_get_transaction। ଯଦି କୌଣସି crew କୁ କେବଳ pay କରିବା ଆବଶ୍ୟକ, ସେଥିରେ single factory ସହିତ ସେହି ଗୋଟିଏ tool ହିଁ ଦିଅନ୍ତୁ।

SINGLE_TOOL.PY
from blockchain0x_crewai import create_payment_tool

pay = create_payment_tool(client)
# amount_wei is USDC base units: 6 decimals, so 10000 = 0.01 USDC.
pay.run(agent_id="agt_123", to="0xRecipient", amount_wei="10000")

per-capability factory ଗୁଡ଼ିକ ହେଉଛି create_payment_tool, create_invoice_tool, create_wallet_tool, create_wallets_list_tool, ଏବଂ create_transaction_tool। Source ଏବଂ testnet example ଗୁଡ଼ିକ the Python SDK repo ରେ ଅଛି; CrewAI support matrix the docs ରେ ଅଛି।

ସାଧାରଣ ବିପଦ

କ୍ରୁରେ ବିଲ୍‌ ଯୋଡିବା ସମୟରେ ଦେଖିବାକୁ ଯୋଗ୍ୟ ପାଞ୍ଚ ଜିନିଷ।

CrewAIର ଭୂମିକା-ଆଧାରିତ ଡିଜାଇନ୍ ପେମେଣ୍ଟ୍ ଇଣ୍ଟେଗ୍ରେସନ୍‌କୁ ଅନ୍ୟ ଫ୍ରେମ୍‌ୱର୍କ୍‌ଗୁଡିକୁ ତୁଳନାରେ ସଫା କରେ। ଏହାର ନିଜସ୍ୱ ଫୁଟଗନ୍‌ଗୁଡିକ ମଧ୍ୟ ଅଛି। ଏହାକୁ ପୂର୍ବରୁ ଜାଣିବା ସମୟ ବଚାଇଥାଏ।

PITFALL 1

ଭୁଲ ଏଜେଣ୍ଟ୍ ଉପରେ ୱାଲେଟ୍ ଟୁଲ୍ ରଖିବା

CrewAI ଏଜେଣ୍ଟମାନେ ଭୂମିକା ରଖନ୍ତି। ୱାଲେଟ୍ ଟୁଲ୍‌ଗୁଡିକୁ ଗବେଷକଙ୍କୁ ହସ୍ତାନ୍ତର କର, ଯିଏ ଗବେଷଣା କରିବା ଉଚିତ, ଏବଂ LLM ମଧ୍ୟ-ବିଶ୍ଳେଷଣରେ ଧନ ଚଳାଇବାକୁ ଚେଷ୍ଟା କରେ। ସଫା ପ୍ୟାଟର୍ନ ହେଉଛି ଏକ ସମର୍ପିତ ଟ୍ରେଜରର ଏଜେଣ୍ଟ ଯେଉଁଥିରେ ଟୁଲ୍‌ଗୁଡିକୁ ଧରିଥାଏ ଏବଂ ତାଙ୍କର ନିଜ କାର୍ଯ୍ୟରେ ଚାଲେ; କାମ ଏଜେଣ୍ଟମାନେ କୌଣସି ୱାଲେଟ୍ ଆକ୍ସେସ୍ ନେଇନାହାନ୍ତି। ଉପରୋକ୍ତ ଉଦାହରଣ ଏହି ଆକୃତିକୁ ଅନୁସରଣ କରେ। ଏହାକୁ କପି କର।

PITFALL 2

କ୍ରମବଦ୍ଧ ବନାମ ହିଅରାର୍କିକାଲ୍ ପ୍ରକ୍ରିୟା

CrewAI କ୍ରମବଦ୍ଧ (ଡିଫଲ୍ଟ) ଏବଂ ପଦାନୁକ୍ରମିକ ନିଷ୍ପାଦନକୁ ସମର୍ଥନ କରେ। ପଦାନୁକ୍ରମିକ ସହିତ, ଏକ ମ୍ୟାନେଜର ଏଜେଣ୍ଟ କ୍ରୁକୁ ସଂଗଠନ କରେ। ଯଦି ମ୍ୟାନେଜରଙ୍କୁ ୱାଲେଟ୍ ଟୁଲ୍‌ଗୁଡିକୁ ଦେଲିଗେଟ୍ କରିବାକୁ ଅନୁମତି ମିଳେ, ତେବେ ଏହାକୁ କୌଣସି ଅଧୀନକୁ ହସ୍ତାନ୍ତର କରିପାରିବ, ଯାହା ତୁମେ ବ୍ୟୟ ଅଧିକାର ପାଇଁ ଚାହାଁନ୍ତି ନାହିଁ। କିମ୍ବା ଏକ ସମର୍ପିତ ଏଜେଣ୍ଟରେ ଟୁଲ୍‌ଗୁଡିକୁ ରଖିବା ଏବଂ କ୍ରମବଦ୍ଧ ଚାଲାଇବା, କିମ୍ବା ମ୍ୟାନେଜରଙ୍କର ଦେଲିଗେସନ୍ ନୀତିଗୁଡିକୁ ସୀମିତ କର।

PITFALL 3

Task context ରୁ settlement status ପଢ଼ୁଛି

Inbound settlement asynchronous ଅଟେ। ଯଦି research task ତାହାର context ଭିତରେ pay task କୁ ତାଲିକାଭୁକ୍ତ କରେ (ଠିକ୍) କିନ୍ତୁ LLM ପରେ ସେଇ context ରୁ final payment status ପଢ଼ିବାକୁ ଚେଷ୍ଟା କରେ (ଠିକ୍ ନୁହେଁ, confirmation ପରେ webhook ଦ୍ୱାରା ଆସେ), ତେବେ muddled output ମିଳେ। downstream work କୁ webhook-triggered signal ଉପରେ gate କରନ୍ତୁ, task context ଉପରେ ନୁହେଁ। CrewAI ର task callbacks ସଠିକ୍ hook ଅଟେ।

PITFALL 4

ରାଶିଗୁଡ଼ିକ USDC base units ରେ, string ଭାବେ

blockchain0x_send_payment takes amount_wei: a string of USDC base units, not a float and not a dollar figure. USDC has 6 decimals, so 0.01 USDC is "10000". CrewAI passes tool inputs through as-is, so a Python float arrives as a float and the SDK rejects it - but the error reads like a CrewAI tool error, which throws off first integrators. Pass a string.

PITFALL 5

Webhook ହ୍ୟାଣ୍ଡଲର୍ କ୍ରୁ ପ୍ରକ୍ରିୟା ବାହାରେ

ଆପଣଙ୍କ webhook handler ସାଧାରଣତଃ crew runtime ର ଅଂଶ ନୁହେଁ, ଏକ ପୃଥକ Flask କିମ୍ବା FastAPI process ହୋଇଥାଏ। crew ତାହାର kickoff() ସମାପ୍ତ କରି ଫେରିଆସେ; payment settle ହେଲେ webhook ପରେ ଆସେ। ଦୁହିଁଟିକୁ queue କିମ୍ବା webhook ଲେଖୁଥିବା ଏବଂ crew ତାହାର ପରବର୍ତ୍ତୀ run ରେ ପଢ଼ୁଥିବା database row ଦ୍ୱାରା ଯୋଡ଼ନ୍ତୁ। webhook ପାଇଁ crew କୁ ଜୀବନ୍ତ ରଖନ୍ତୁ ନାହିଁ - CrewAI runs ଡିଜାଇନ୍ ଅନୁସାରେ short-lived ଅଟେ।

ପ୍ରାୟତଃ ପ୍ରଶ୍ନ

ତିନି CrewAI-ନିର୍ଦ୍ଦିଷ୍ଟ ପ୍ରଶ୍ନ।

ଏହା CrewAI Flows (ନୂତନ ଗ୍ରାଫ୍-ଆଧାରିତ କାର୍ଯ୍ୟାନ୍ବୟନ) ସହ କାମ କରେ କି?

ହଁ। create_blockchain0x_toolset standard CrewAI tools ଫେରାଏ, ସେହିପାଇଁ ସେମାନେ classic Crew + Task structures ଏବଂ CrewAI Flow ର @start/@listen patterns ରେ କାମ କରନ୍ତି। Flow ରେ, work steps ପୂର୍ବରୁ payment କିମ୍ବା settlement step କୁ dedicated treasurer step ଉପରେ ରଖନ୍ତୁ, ଏବଂ webhook handler shared state update କରିଦେବା ପରେ fire ହେଉଥିବା Flow event ଉପରେ work steps କୁ listen କରାନ୍ତୁ।

କି ସେହି କ୍ରୁ ଏକ ସମୟରେ ଅନେକ ଦେୟ କାର୍ଯ୍ୟ ଚାଲାଇପାରିବ?

ହଁ। payments.create (ଯାହାକୁ blockchain0x_send_payment wrap କରେ) ସ୍ୱୟଂଚାଳିତ ଭାବରେ stable Idempotency-Key mint କରେ, ସେହିପାଇଁ retried submission ଦୁଇଥର ପେ କରିବା ପରିବର୍ତ୍ତେ single on-chain transfer ହୋଇଯାଏ। ଯଦି ଆପଣ ଏକା ସମୟରେ ଅନେକ kickoff ଯାହା ପ୍ରତ୍ୟେକଟି ଟଙ୍କା move କରେ fan out କରନ୍ତି, ପ୍ରତ୍ୟେକଟିକୁ ନିଜ intent (ଅଲଗା recipients କିମ୍ବା metadata) ଦିଅନ୍ତୁ, ଯାହାଦ୍ୱାରା ସେମାନେ ଏକାକାର duplicate ପରି ଦେଖାଯିବେନାହିଁ। processes across dedupe କରିବାକୁ ଚାହାଁନ୍ତି ନାହିଁ ଯେପର୍ଯ୍ୟନ୍ତ, idempotency header ନିଜେ manage କରିବାକୁ ପଡେନାହିଁ।

କି କ୍ରୁ ଇନ୍ଭଏସ୍ ସେଟ୍ କରିପାରିବ, ଏବଂ କିଛି ରିଫଣ୍ଡ ଟୁଲ୍ ଅଛି?

ଏହା settle କରିପାରେ: blockchain0x_settle_invoice dashboard ରେ ଆପଣ ସୃଷ୍ଟି କରିଥିବା payment request କୁ settle କରେ ଏବଂ on-chain proof (tx hash, payer, verified USDC amount) record କରେ। refund helper ନାହିଁ - ସେହି identifier ଅବସ୍ଥିତ ନାହିଁ। ଟଙ୍କା ଫେରାଇବାକୁ, treasurer ସରଳଭାବେ blockchain0x_send_payment ସହିତ payer କୁ ନୂତନ USDC payment ପଠାଏ। ଏହାକୁ treasurer role ରେ ରଖନ୍ତୁ ଯାହାରେ spending authority ଗୋଟିଏ ସ୍ଥାନରେ ରହେ।

ଆପଣଙ୍କର କ୍ରୁକୁ ବିଲିଂ ଭୂମିକା ଯୋଡନ୍ତୁ।

pip ସଂସ୍ଥାପନରୁ ଆପଣଙ୍କର ପ୍ରଥମ ଭୁଗତାନ କ୍ରୁ କିକଅଫ୍ ପାଇଁ କିଛି ମିନିଟ୍। ଆରମ୍ଭ କରିବାକୁ ମାଗଣା।