Build Your First AI Agent Contract

If you like video tutorials, here is one of our latest workshops on building your first AI Agent Contract. In this tutorial, you will learn:

  • How to get an OpenAI API Key at https://red-pill.ai

  • Clone the AI Agent Contract template repo

  • Build and test your Agent Script

  • Launch and interact with your Agent Script through the Phala Agent Gateway

In this guide you will learn about the two components that make up AI Agent Contract:

  • The "Agent Script": Prompts and code written in TypeScript/JavaScript to define the agent running on Phala Network.

  • The "Agent DAO": Regulates the Agent Script's access keys, tokenomic, access control, and market. The Agent DAO is deployed on a Smart Contract EVM Chains.

The diagrams above shows the architecture of the AI Agent Contract with the first diagram showing the Agent DAO regulates the Agent Script. Then the second diagram shows how the Agent Script is executed on Phala Network's serverless backend.

This guide will focus on the following topics:

  • Build Your AI Agent Contract

    • Build your Agent Script that is deployed to IPFS and served through the Phala Agent Gateway executed on Phala Network.

    • Build your Agent DAO to "regulate" your deployed agent by enabling access control through access keys for communication, governance, tokenomics, and optionally run token-gating logic.

  • Launch Your AI Agent Contract

    • Deploy your Agent DAO to an EVM Chain.

    • The Agent DAO will store where the Agent Script code/prompt is located on IPFS.

      • Automatically host on the Phala Agent Gateway (https://agents.phala.network/<chain>/<contract-id>).

      • Subscribe to external agents for cross-communication.

  • Use/Interact with Your AI Agent Contract

Last updated

Logo

COPYRIGHT © 2024 PHALA.LTD ALL RIGHTS RESERVED. May Phala be with you!