Skip to content

Your First Agent - Step by Step

In this guide, you'll create and train your first AI agent in just a few minutes.

What You'll Build

A simple text classification agent that can: - Learn from examples - Classify new text inputs - Provide confidence scores

Prerequisites

  • ✅ IOValence installed (Installation Guide)
  • ✅ Python 3.8 or higher
  • ✅ Sample data (we'll provide templates)

Step 1: Create a New Agent

iovalence create-agent --name my-first-agent --type classification

This creates a new agent project with the following structure:

my-first-agent/
├── config.yaml          # Agent configuration
├── data/
│   ├── train.csv        # Training data
│   └── test.csv         # Test data
└── agent.py             # Agent code

Step 2: Prepare Your Training Data

Create a data/train.csv file with examples:

text,label
"I love this product!",positive
"This is terrible",negative
"It works great",positive
"Not what I expected",negative

Step 3: Configure Your Agent

Edit config.yaml:

agent:
  name: my-first-agent
  type: classification
  version: 1.0

training:
  epochs: 10
  batch_size: 32
  learning_rate: 0.001
  validation_split: 0.2

data:
  train_path: data/train.csv
  test_path: data/test.csv
  text_column: text
  label_column: label

Step 4: Train Your Agent

iovalence train --agent my-first-agent

You'll see output like:

Training started...
Epoch 1/10: loss=0.45, accuracy=0.89
Epoch 2/10: loss=0.32, accuracy=0.92
...
Training complete!
Accuracy: 94.5%

Step 5: Test Your Agent

iovalence test --agent my-first-agent --text "This is amazing!"

Output:

{
  "prediction": "positive",
  "confidence": 0.98,
  "reasoning": "Contains positive sentiment indicators"
}

Step 6: Deploy Your Agent (Optional)

iovalence deploy --agent my-first-agent --target local

Your agent is now ready to use in your application!

Next Steps

Troubleshooting

Issue: Command not found
Solution: Make sure IOValence is installed: pip install iovalence

Issue: Data format error
Solution: Check your CSV has headers matching the config

Issue: Low accuracy
Solution: Add more training examples or adjust learning_rate

Need more help? See Troubleshooting Guide