LogoLogo
  • Overview
  • Prompts
    • Quickstart
    • DeFi Swaps
    • MEME Launcher
    • Image Gen Mint
    • Drop Links
    • NFT Collection
    • Buys, Lists, Transfers
    • Create Contract
  • Agents
    • Introduction
    • Quick Start
    • Manifest
    • Embeddable Chat Component
    • Widget Component
    • Deploy Your Open Agent
    • MCP
    • make-agent
    • Contract To Agent
    • Sui Agent Building
  • Wallet
    • Quickstart
    • NFT Drops
    • Paymaster
    • Integrations
    • Sign Messages
    • Cross Chain Signatures
    • Telegram Integration
Powered by GitBook
LogoLogo

Socials

  • X (Twitter)
On this page
Export as PDF
  1. Agents

Sui Agent Building

Quick Start: Building Your Bitte Open Agent on Sui

PreviousContract To AgentNextQuickstart

Last updated 28 days ago

Prerequisite: make-agent v0.3.1+ installed


1. Clone the Boilerplate & Install

git clone https://github.com/BitteProtocol/agent-next-boilerplate.git
cd agent-next-boilerplate
pnpm install

This gives you the core agent framework, UI sandbox, and plugin manifest support.


2. Configure Your Bitte API Key

  1. Visit 🔑 and generate a key.

  2. Copy .env.example → .env and insert:

    dotenvCopyEditBITTE_API_KEY="bitte_YOUR_KEY_HERE"

3. Wire Up Sui: Add Your Transaction Tool

In tools/, change any of the routes to return a sui transaction, check the sui ts sdk for more information on how to create Sui Transactions:


  const { senderAddress, recipientAddress, amountInSui, network } = args;
  const tx = new Transaction();
  const MIST_PER_SUI = 1e9;
  const amountInMist = Math.floor(amountInSui * MIST_PER_SUI);

  if (amountInMist > Number.MAX_SAFE_INTEGER) {
    throw new Error('Amount exceeds safe integer limit');
  }
  
  const [coin] = tx.splitCoins(tx.gas, [tx.pure.u64(BigInt(amountInMist))]);
  tx.setSender(senderAddress);
  tx.transferObjects([coin], tx.pure.address(recipientAddress));

  const txBytes = await tx.build({ client: suiClientFor(network) });
  return { data: { suiTransactionBytes: Buffer.from(txBytes).toString('base64') } };

4. Declare Your Tool in the Plugin Manifest

Open ai-plugin/manifest.json (or wherever your manifest lives) and add the corresponding spec for your endpoint Since this is a next js project the route path will correspond to the folder

'/api/send-sui': {
  post: {
    summary: 'Send a Sui tokens',
    description: 'Accept the args and return a valid sui transaction in bytes to send tokens to an address',
    operationId: 'generateSuiTx',
    requestBody: {
      required: true,
      content: {
        'application/json': {
          schema: {
            type: 'object',
            properties: {
              senderAddress: {
                type: 'string',
                description: 'Address sending SUI',
              },
              recipientAddress: {
                type: 'string',
                description: 'Address receiving SUI',
              },
              amountInSui: {
                type: 'number',
                description: 'Amount of SUI to send',
              },
              network: {
                type: 'string',
                enum: ['mainnet', 'testnet', 'devnet'],
                default: 'mainnet',
                description: 'Which Sui network to use',
              },
            },
            required: ['senderAddress', 'recipientAddress', 'amountInSui'],
          },
        },
      },
    },
    responses: {
      '200': {
        description: 'Successful response',
        content: {
          'application/json': {
            schema: {
              type: 'object',
              properties: {
                success: {
                  type: 'boolean',
                  description: 'Whether the transaction was successfully built or validated',
                },
                data: {
                  type: 'object',
                  description: 'Additional result data',
                },
              },
            },
          },
        },
      },
      '500': {
        description: 'Error response',
        content: {
          'application/json': {
            schema: {
              type: 'object',
              properties: {
                error: {
                  type: 'string',
                  description: 'Error message',
                },
              },
            },
          },
        },
      },
    },
  },
},

5. Add generate-sui-tx to the Tools Array

To enable the review transaction component in the frontend, add the generate-sui-tx primitive to the tools array in your configuration file:

{
  "tools": [
 tools: [
          { type: 'get-sui-balances' },
          { type: 'generate-sui-tx' },
        ],

This update ensures that the frontend can display the transaction review component appropriately.

6. Define Behaviour

To control how your agent behaves, customize its instructions—this is the equivalent of setting the system prompt. Use this to tailor the agent’s behavior to your tool’s needs. For example, you might instruct it to confirm addresses or amounts, adopt a specific tone or personality, or behave deterministically in certain scenarios.

If the transaction review screen isn’t appearing as expected, you can explicitly instruct the agent to show it after your tool call.

7. Run Locally & Test

pnpm dev
  • The console UI opens your chat sandbox.

  • Ask the agent to build the transaction related to your tool

  • The agent will call your tool and then call generate-sui-tx to display the transaction signing component so you can try sending your transaction


7. Deploy Your Agent

  1. Push to GitHub.

  2. Deploy to vercel or any provider

  3. Update your URL env or hard code it in the spec

    BITTE_AGENT_URL="https://my-sui-agent.vercel.app"
  4. Run:

    make-agent deploy

This validates your key, registers your plugin URL, and you’re live!

https://key.bitte.ai