feat(action-providers): add The Graph provider (query subgraphs directly, pay-per-query over x402)#1358
Open
PaulieB14 wants to merge 1 commit into
Open
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
|
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.
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