feat: Add BlockRun action provider for pay-per-request LLM access#916
Open
1bcMax wants to merge 4 commits intocoinbase:mainfrom
Open
feat: Add BlockRun action provider for pay-per-request LLM access#9161bcMax wants to merge 4 commits intocoinbase:mainfrom
1bcMax wants to merge 4 commits intocoinbase:mainfrom
Conversation
Add BlockRun action provider enabling AI agents to access multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek) using pay-per-request USDC micropayments on Base chain via the x402 protocol. Features: - chat_completion action for LLM inference - list_models action to discover available models - Supports Base Mainnet and Sepolia networks - Uses blockrun-llm SDK for x402 payment handling Install with: pip install coinbase-agentkit[blockrun]
🟡 Heimdall Review Status
|
- Add conftest.py with mock fixtures for wallet_key, wallet_provider, and llm_client - Add test_blockrun_action_provider.py: 10 tests for initialization, network support, factory - Add test_chat_completion.py: 7 tests for chat completion action - Add test_list_models.py: 5 tests for list models action - Add e2e tests for real API testing (requires BLOCKRUN_WALLET_KEY env var) All 22 unit tests pass. E2e tests require funded wallet on Base.
Major changes: - Replace blockrun-llm SDK with x402 library using wallet_provider.to_signer() - Add get_usdc_balance action to check wallet balance before requests - Add balance check in chat_completion to prevent failed requests - Update e2e tests to use CDP wallet provider credentials - Remove private key exposure - keys are now managed by wallet provider This follows the same pattern as the existing x402_action_provider, ensuring BlockRun integrates properly with AgentKit's secure wallet infrastructure.
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.
Summary
Add BlockRun action provider enabling AI agents to access multiple LLM providers (OpenAI, Anthropic, Google, DeepSeek) using pay-per-request USDC micropayments on Base chain via the x402 protocol.
Why BlockRun?
wallet_provider.to_signer()Changes
BlockrunActionProviderwithchat_completion,list_models, andget_usdc_balanceactionsx402_action_provider)Actions Provided
chat_completionlist_modelsget_usdc_balanceArchitecture
Usage Example
Testing
x402_action_provider)Wallet Provider Compatibility
CdpEvmWalletProviderEvmWalletProviderto_signer()Links