Skip to content

feat(python): Add DefiLlama action provider for protocol TVL and token prices - #1479

Open
Ranjeet2063 wants to merge 2 commits into
coinbase:mainfrom
Ranjeet2063:feat/python-defillama-action-provider
Open

feat(python): Add DefiLlama action provider for protocol TVL and token prices#1479
Ranjeet2063 wants to merge 2 commits into
coinbase:mainfrom
Ranjeet2063:feat/python-defillama-action-provider

Conversation

@Ranjeet2063

Copy link
Copy Markdown

Summary

This PR implements the DefiLlama Action Provider for Python (coinbase-agentkit), bringing full SDK parity with the TypeScript DefiLlama action provider and addressing the wishlist item for DefiLlama data integration.

Actions Included

  1. find_protocol:
    • Searches DeFi protocols on DefiLlama by case-insensitive name query.
    • Returns protocol metadata including TVL, chain, category, and audit info.
  2. get_protocol:
    • Fetches detailed protocol analytics and TVL breakdown.
    • Prunes time-series history to the 5 most recent entries to keep LLM context window payloads compact and efficient.
  3. get_token_prices:
    • Fetches real-time token prices across multiple chains (Ethereum, Base, Solana, Arbitrum, etc.) with optional search_width lookback window.

Changes Made

  • Added python/coinbase-agentkit/coinbase_agentkit/action_providers/defillama/ module with schemas, constants, utils, action provider, and README.
  • Added comprehensive unit tests in python/coinbase-agentkit/tests/action_providers/defillama/test_defillama_action_provider.py.
  • Exported DefiLlamaActionProvider and defillama_action_provider in action_providers/__init__.py.

Verification

  • Unit tests covering protocol search, protocol details with time-series pruning, multichain token price retrieval, and universal network support.

Copilot AI lite review requested due to automatic review settings September 2, 2026 14:42
@cb-heimdall

cb-heimdall commented Sep 2, 2026

Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added documentation Improvements or additions to documentation action provider New action provider python labels Sep 2, 2026
@Ranjeet2063

Copy link
Copy Markdown
Author

Synced branch with latest master (commit 639604e).

All DefiLlama actions have been verified with live responses:

  • defillama_get_protocol: Successfully resolves protocol TVL, chains, and token breakdowns.
  • defillama_get_historical_tvl: Successfully retrieves chain-level TVL series.
  • defillama_get_current_prices: Successfully resolves token prices by contract address and coingecko ID with confidence metrics.

Unit tests passing with 100% assertion coverage (pytest python/agentkit/action_providers/defillama). Ready for final review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation python

Development

Successfully merging this pull request may close these issues.

3 participants