feat(action-providers): add The Graph provider (query subgraphs directly, pay-per-query over x402)#1358
feat(action-providers): add The Graph provider (query subgraphs directly, pay-per-query over x402)#1358PaulieB14 wants to merge 3 commits into
Conversation
…tly, pay-per-query over x402) Adds a `thegraph` action provider that lets an agent query The Graph directly and pay per query over x402 from its own wallet: search_subgraphs, get_subgraph_schema, query_subgraph. Query prices are variable, so each action probes the 402 price and enforces a per-query maxPaymentUsdc cap before signing. Base-only; reuses AgentKit's existing x402 signing stack (no new deps). Discovery + query construction ported from PayQL (Apache-2.0). Includes README, unit tests, and a changeset. Complements the managed `graphadvocate` provider with a direct/self-serve tier.
🟡 Heimdall Review Status
|
…turn results The Graph network subgraph's subgraphMetadataSearch fulltext index returns zero rows for an AND of multiple prefix terms, so search_subgraphs came back empty for any multi-word topic (e.g. the README's own 'uniswap v3 arbitrum' example). OR-join instead; the existing signal-desc sort surfaces the most relevant subgraph first. Verified live: 'uniswap:* & v3:*' -> 0 hits, 'uniswap:* | v3:*' -> 5 hits. Mirrors the upstream PayQL fix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@murrlincoln — following up with verification (like #1357), and I pushed a fix to this branch just now. While testing end-to-end I found With that in, all three actions check out against the live gateway:
CI should re-run on the two new commits. Happy to add an example-chatbot transcript if useful. Thanks for taking a look! |
Description
Adds a
thegraphaction provider that lets an agent query The Graph directly and pay per query over x402 from its own wallet — no API key, no signup. Three actions:search_subgraphs— find the best subgraph(s) for a plain-English topicget_subgraph_schema— list a subgraph's queryable entities + argsquery_subgraph— run a GraphQL query against a subgraphQuery prices are variable, so each paid action probes the gateway's 402 price, enforces a per-query
maxPaymentUsdccap, and only then signs and pays. Base-only; reuses the same x402 signing stack as the built-inx402provider, so no new dependencies. Discovery + query-construction logic is ported from PayQL (Apache-2.0).This complements #1357 (the managed
graphadvocateprovider) as the self-serve tier:graphadvocate= pay an agent that does the routing/querying for you (no setup);thegraph= query The Graph gateway directly and pay your own way (cheaper, more control). Fits WISHLIST → "Trading & Data".Tests
supportsNetwork, the EVM-wallet guard (rejects non-EVM before any network call), and the portedtoFulltext+parseHitslogic.tsc --noEmitclean; 5/5 tests pass locally in a matched (pnpm/lockfile) env.Checklist
thegraph/README.md).changeset/thegraph-action-provider.md)🤖 Generated with Claude Code