CARV
CARVPlayPortalProtocol
  • Overview
    • Introducing CARV
  • SVM - AI AGENTIC CHAIN
    • Introduction
      • Architecture
      • AI Agent in TEE environment
      • CARV Verifier Nodes
    • Quick Start
      • Bridge Token
      • Explorer
      • Command line tool
      • Reading from CARV SVM Network
      • Writing to the Network
      • Network Info
  • D.A.T.A. - AI FRAMEWORK
    • Introduction
      • DeepSeek Integration
      • D.A.T.A's Core Features
      • How It Empowers AI Agents
      • Driving the Future of AI and Blockchain
      • Leveraging CARV SVM Chain for Privacy and Trustless Data Sharing
    • Quick Start Guide
    • Architecture
    • ERC-7231 (CARV ID)
    • Examples
      • On-Chain Insights
    • Getting Started
      • D.A.T.A Framework Plugin for Eliza
    • Use Cases and Implementation
      • Getting On-Chain Data for AI Agents
      • What's Coming with the D.A.T.A Framework
    • API Documentation
      • News
      • On-chain Data SQL Query
        • Ethereum Schema
        • Bitcoin Schema
        • Base Schema
        • Solana Schema
      • On-chain Data SQL Query by LLM
      • Token Info and Price
      • User Balance by Twitter ID
      • User Balance by Discord ID
  • CARV Ecosystem
    • CARV Play
      • Portal Access
      • Integration Guide
        • .Play Name Service Integration
        • API-Verified Quest (RESTFUL)
        • API-Verified Quest (GraphQL)
        • CARV ID OAuth 2.0
        • CARV ID Telegram SDK
      • Smart Contracts & Security
    • MOFF Bot & Customer Data Platform
    • CARV Account
      • ERC 7231
    • Verifier Nodes
      • How to Purchase Nodes
      • Buyback Program
      • Why Verifier Nodes
      • How do Verifier Nodes Work
        • CARV/veCARV Token
        • CARV Vault
        • CARV NFT License
        • CARV Protocol Service
        • Trusted Execution Environment (TEE)
        • Verifier Node
        • Attestation
        • Delegation
        • Rewards
        • SGX Attestation Verification
      • Verifier Node Sale Dynamics
      • Smart Contract Addresses
      • License Key (NFT)
      • Delegation
      • Node Rewards
      • Join Mainnet Verifier Nodes
        • Prerequisites
        • Delegation Tutorial
        • Operating a Verifier Node
          • Running in VPS
          • Running in CLI
            • Using Source Code
            • Using Docker
            • Gasless Server API
          • Running in Desktop App
      • Explorer
      • FAQ
        • Node Sale
        • Node Operation
  • CARV LABS
    • Introduction
    • Working with CARV Labs
  • Tokenomics
    • Utility
      • veCARV(s)
    • Distribution & Vesting
  • DECENTRALIZED GOVERNANCE
    • ⚔️Universal Guardian Program
    • 📔DAO Governance
    • 🌏Community Programs & Activities
  • Resources
    • 🗜️Writings
    • 🗞️CARV in the News
    • 🫶Social & Community Links
    • 🅰️Brand Guideline
    • 💰Job Openings
Powered by GitBook
On this page
  • Prerequisites
  • Installation
  • Basic Configuration
  • Running Your First Agent
  • Basic Usage Examples
  • Common Operations
  • Common Issues and Solutions
  • Next Steps
  1. D.A.T.A. - AI FRAMEWORK

Quick Start Guide

This guide will help you set up and run your first D.A.T.A framework agent. Follow these steps to get started quickly.

Prerequisites

  • Go 1.19 or higher

  • SQLite3

  • Git

  • Discord/Twitter/Telegram API credentials (optional)

  • CARV API key

Installation

  1. Clone the repository:

git clone https://github.com/carv-protocol/d.a.t.a
cd d.a.t.a
  1. Install dependencies:

go mod download

Basic Configuration

  1. Create a .env file in the project root:

# LLM Configuration
LLM_API_KEY=your_api_key
LLM_PROVIDER=openai

# CARV Configuration
CARV_DATA_BASE_URL=https://api.carv.io
CARV_DATA_API_KEY=your_carv_api_key

# Optional Social Media Configuration
DISCORD_API_TOKEN=your_discord_token
TWITTER_API_KEY=your_twitter_key
TWITTER_API_KEY_SECRET=your_twitter_secret
TWITTER_ACCESS_TOKEN=your_twitter_access
TWITTER_TOKEN_SECRET=your_twitter_token
TELEGRAM_BOT_TOKEN=your_telegram_token
  1. Create a basic character configuration (src/config/character.json):

{
  "name": "DataAgent",
  "system": "An AI agent for Web3 data analysis",
  "bio": [
    "Specialized in blockchain data analysis",
    "Expert in token-based interactions"
  ],
  "style": {
    "tone": ["professional", "helpful", "precise"],
    "constraints": []
  },
  "goals": [
    {
      "name": "Data Analysis",
      "description": "Provide accurate blockchain data analysis",
      "priority": 0.8
    }
  ],
  "priority_accounts": [
    {
      "platform": "discord",
      "id": "your_priority_account_id"
    }
  ]
}
  1. Update the config file (src/config/config.yaml)

Config will be override by the env vars.

character:
  # Path to character configuration file
  path: "./src/config/character_data_agent.json"

database:
  # Database type: "sqlite" or "postgres"
  type: "sqlite"
  # Database path (for SQLite) or connection string (for Postgres)
  path: "./data/agent.db"

llm_config:
  # LLM provider: "openai", "deepseek", etc.
  provider: "deepseek"
  # API key for the LLM provider
  api_key: ""
  # Base URL for API calls
  base_url: "https://api.deepseek.com"
  # Model name
  model: "deepseek-chat"

data:
  carvid:
    # CarvID API endpoint
    url: "https://api.carv.io/v1"
    # API key for CarvID
    api_key: "your-carvid-api-key-here"

token:
  network: "base"
  ticker: "carv"

Running Your First Agent

  1. Build the project:

go build -o data-agent ./src/cmd/agent
  1. Run the agent:

./data-agent

Basic Usage Examples

1. Implementing a Custom Tool

package tools

import (
    "context"
    "github.com/carv-protocol/d.a.t.a/src/internal/core"
)

type CustomTool struct{}

func (t *CustomTool) Initialize(ctx context.Context) error {
    return nil
}

func (t *CustomTool) Name() string {
    return "custom tool"
}

func (t *CustomTool) Description() string {
    return "A custom tool for specific functionality"
}

func (t *CustomTool) AvailableActions() []core.Action {
    return nil
}

2. Adding a New Social Platform Integration

package social

import (
    "context"
    "github.com/carv-protocol/d.a.t.a/src/internal/core"
)

type CustomPlatform struct {
    // Your platform-specific fields
}

func (p *CustomPlatform) SendMessage(ctx context.Context, msg core.SocialMessage) error {
    // Implementation
    return nil
}

func (p *CustomPlatform) GetMessageChannel() <-chan core.SocialMessage {
    // Implementation
    return nil
}

Common Operations

Checking Token Balance

balance, err := tokenManager.FetchNativeTokenBalance(
    context.Background(),
    "user_id",
    "platform",
)
if err != nil {
    log.Printf("Error fetching balance: %v", err)
    return
}
log.Printf("User balance: %f", balance.Balance)

Processing Social Messages

msg := &core.SocialMessage
    Type:     "message",
    Content:  "Hello, agent!",
    Platform: "discord",
    FromUser: "user123",
}

processedMsg, err := agent.ProcessMessage(context.Background(), msg)
if err != nil {
    log.Printf("Error processing message: %v", err)
    return
}

Common Issues and Solutions

  1. Database Connection Issues

    • Ensure SQLite3 is installed

    • Check database path permissions

    • Verify database file exists

  2. API Authentication Errors

    • Validate API keys in .env file

    • Check API endpoint availability

    • Confirm network connectivity

  3. Memory Management

    • Monitor memory usage

    • Adjust batch sizes if needed

    • Check for memory leaks

Next Steps

  1. Check out example implementations in the /examples directory

  2. Learn about advanced features in the Architecture Guide

PreviousLeveraging CARV SVM Chain for Privacy and Trustless Data SharingNextArchitecture

Last updated 4 months ago

Explore the

Join D.A.T.A

full documentati
Discord community