Repository navigation
Example: CrewAI pre-pay check of an x402 endpoint - #7
Open
TechCodinz wants to merge 2 commits into
Open
TechCodinz wants to merge 2 commits into
TechCodinz wants to merge 2 commits into
Conversation
run_with_agent never passed llm=, so a Gemini-only user got CrewAI's OpenAI default despite the README promising Gemini support. Select LLM(model="gemini/gemini-2.5-flash") when GEMINI_API_KEY is set and OPENAI_API_KEY is not; otherwise leave CrewAI's default untouched. Also pins the google-genai extra (crewai[google-genai]) so the native Gemini provider is installed, and names the model in the README.
|
👀 We've notified the reward creators here. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/claim #2
Add a runnable CrewAI example that checks an x402 paid endpoint before anything pays for it.
What it does
examples/crewai-prepay-check/tool.py— a CrewAI custom tool that runsnpx -y @agent402-dev/pay-server check <url> --jsonand returns the JSON to the agent (fieldsfixes,findings, amounts). One request, no payment header, nothing signed or paid, no key read.examples/crewai-prepay-check/main.py— a CrewAI agent whose instructions say: do not pay whenfixes > 0. Refuses non-https URLs before running the check (loopback http allowed only so the local demo server can be checked).examples/crewai-prepay-check/broken_server.py— a ~20-line local server answering a broken 402, for the will-not-pay demo.examples/crewai-prepay-check/requirements.txt— pinnedcrewai[google-genai]==1.15.50;README.md— install, run, what the tool returns, "nothing is paid" line.Verified (real runs, no keys spent)
python main.py https://api.xynaptic.io/v1/crypto-price→fixes: 0, price 0.02 USDC,signedOrPaid: false, exit 0.fixes: 1(header_missing), agent will not pay.python main.py http://example.com/...→ refused before any check runs (verified nonpxinvocation).OPENAI_API_KEY(default) orGEMINI_API_KEY(gemini/gemini-2.5-flash, wired viallm=). No wallet, key, RPC or paid API key needed otherwise. Note: the full agent kickoff was verified by code review + model-resolution probe only — no real LLM key was available in the build environment, so the agent's spoken answer was not exercised end to end; the check-tool paths above were run for real.Notes
/trycould not be posted on the issue from the API (the token used returns 403 on issue comments for this repo); work started 2026-12-05 ~09:50 UTC.examples/crewai-prepay-check/is touched — no payment code, rules, keys, wallets or signing.