Case Study 3: Building a Custom Agent.

For developers who want to create a unique trading strategy or personality, CogniFi allows the deployment of custom ElizaOS agents. This guide walks through the code required to ship a custom bot.

Step 1: Defining the Character

Create a file named agent-smith.json. This defines how the Large Language Model (LLM) perceives itself.

{
  "name": "Agent Smith",
  "bio": [
    "A cold, calculating DeFi predator.",
    "Obsessed with market efficiency and arbitrage."
  ],
  "knowledge": [
    "Solana SPL Token Standard",
    "Raydium CPMM Math",
    "Vampire Attack Mechanics"
  ],
  "style": {
    "all": ["concise", "technical", "robotic"]
  }
}

Step 2: Configuring Logic (agent.config.ts)

Define the operational boundaries. This code runs deterministically inside the TEE.

Step 3: Local Simulation

Before spending real funds, test the agent in a local environment.

Watch the console logs to see how the agent reacts to simulated market data feeds.

Step 4: Mainnet Deployment

Once satisfied, deploy the agent to the Phala Network decentralized cloud.

Output: > Agent Deployed Successfully. > Enclave ID: 0x7f...3a > Remote Attestation Hash: 0x9c...11

Your agent is now alive, immutable, and autonomous on the Solana blockchain.

Last updated