Skip to main content

CDP Agentkit Langchain Extension

Project description

CDP Agentkit Extension - Langchain Toolkit

Developing

  • cdp-sdk has a dependency on cargo, please install rust and add cargo to your path
  • Agentkit uses poetry for package management and tooling

Formatting

make format

Linting

  • Check linter make lint

  • Fix linter errors make lint-fix

Adding an Agentic Action to the Langchain Toolkit

  1. Ensure the action is implemented in cdp-agentkit-core.
  2. Add a wrapper method to CdpAgentkitWrapper in ./cdp_langchain/utils/cdp_agentkit_wrapper.py
    • E.g.
    def mint_nft_wrapper(self, contract_address: str, destination: str) -> str:
        """Mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation.

        Args:
            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.

        """
        return mint_nft(
            wallet=self.wallet,
            contract_address=contract_address,
            destination=destination,
        )
  1. Add call to the wrapper in CdpAgentkitWrapper.run in ./cdp_langchain/utils/cdp_agentkit_wrapper.py
    • E.g.
        if mode == "mint_nft":
            return self.mint_nft_wrapper(**kwargs)
  1. Add the action to the list of available tools in the CdpToolkit in ./cdp_langchain/agent_toolkits/cdp_toolkit.py
    • E.g.
        actions: List[Dict] = [
            {
                "mode": "mint_nft",
                "name": "mint_nft",
                "description": MINT_NFT_PROMPT,
                "args_schema": MintNftInput,
            },
        ]
  1. Add the action to the list of tools in the CdpToolkit class documentation.

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

cdp_langchain-0.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

cdp_langchain-0.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file cdp_langchain-0.0.1.tar.gz.

File metadata

  • Download URL: cdp_langchain-0.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0

File hashes

Hashes for cdp_langchain-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d384de4bfbcdb284b448d209f061c61822edc99364546a6e33ed1632195f01ca
MD5 d9f2389a05ba7f4a461107786aefeb88
BLAKE2b-256 93b48a4ae4a5a59f58a63c7b7b8c7c0715ecb4ebd2c1bacb19981b7180671613

See more details on using hashes here.

File details

Details for the file cdp_langchain-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cdp_langchain-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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

Hashes for cdp_langchain-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 05f488dfa0f93ddb47d39e5ac1196cc0158908a257e953f96e836a6a3b8d8a2a
MD5 36ed2219c1a26532613248ac6f7d86cd
BLAKE2b-256 cca2040e54e691f381a7086e515954118ce66ba431ca076965f479109968afec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page