CDP Agentkit core primitives
Project description
Agentkit Core
Core primitives and framework agnostic tools that are meant to be composable and used via Agentkit framework extensions.
Developing
cdp-sdk
has a dependency oncargo
, please install rust and addcargo
to your path- Rust Installation Instructions
export PATH="$HOME/.cargo/bin:$PATH"
- Agentkit uses
poetry
for package management and tooling- Poetry Installation Instructions
- Run
poetry install
to installcdp-agentkit-core
dependencies - Run
poetry shell
to activate the virtual environment
Formatting
make format
Linting
-
Check linter
make lint
-
Fix linter errors
make lint-fix
Unit Testing
- Run unit tests
make test
Contributing Agentic Actions
- Actions are defined in
./cdp_agentkit_core/actions
module. See./cdp_agentkit_core/actions/mint_nft.py
for an example.
Components of an Agentic Action
Each action will define and export 3 components:
- Prompt - A string that will provide the AI Agent with context on what the function does and a natural language description of the input.
- E.g.
MINT_NFT_PROMPT = """
This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation. It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs."""
- ArgSchema - A Pydantic Model that defines the input argument schema for the action.
- E.g.
class MintNftInput(BaseModel):
"""Input argument schema for mint NFT action."""
contract_address: str = Field(
...,
description="The contract address of the NFT (ERC-721) to mint, e.g. `0x036CbD53842c5426634e7929541eC2318f3dCF7e`",
)
destination: str = Field(
...,
description="The destination address that will receieve the NFT onchain, e.g. `0x036CbD53842c5426634e7929541eC2318f3dCF7e`",
)
- Action Callable - A function (or Callable class) that executes the action.
- E.g.
def mint_nft(wallet: Wallet, contract_address: str, destination: str) -> str:
"""Mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation.
Args:
wallet (Wallet): The wallet to trade the asset from.
contract_address (str): The contract address of the NFT (ERC-721) to mint, e.g. `0x036CbD53842c5426634e7929541eC2318f3dCF7e`.
destination (str): The destination address that will receieve the NFT onchain, e.g. `0x036CbD53842c5426634e7929541eC2318f3dCF7e`.
Returns:
str: A message containing the NFT mint details.
"""
mint_args = {"to": destination, "quantity": "1"}
mint_invocation = wallet.invoke_contract(
contract_address=contract_address, method="mint", args=mint_args
).wait()
return f"Minted NFT from contract {contract_address} to address {destination} on network {wallet.network_id}.\nTransaction hash for the mint: {mint_invocation.transaction.transaction_hash}\nTransaction link for the mint: {mint_invocation.transaction.transaction_link}"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cdp_agentkit_core-0.0.1.tar.gz
.
File metadata
- Download URL: cdp_agentkit_core-0.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abdc8d9a4c31259048fa718b650f294d0b2ad0065667b6cde0ae6e77571ac057 |
|
MD5 | eb1c4fcbf7557c8e3ccec59ab2aaa75c |
|
BLAKE2b-256 | b84cab5674b3725aa840d322ebffee0dece1103d649a46b2390362c2985cb8d5 |
File details
Details for the file cdp_agentkit_core-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: cdp_agentkit_core-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476716ad16df056bebf8d72c44270c80845804902b07ad66b8b9a38add86e561 |
|
MD5 | a17b450488a26fa88aa94cbb3169ddad |
|
BLAKE2b-256 | a7bd232f5f97f5609c5326b1a144578bf68fe3c591f7d2935647fc9d37b41db3 |