Skip to content

Your First Agent

This guide walks you through creating, configuring, and testing your first AG2Trust agent.

Prerequisites

Before creating an agent, ensure you have:

  • [x] An AG2Trust account
  • [x] At least one LLM provider configured (Settings > Providers)

Creating an Agent

Via Dashboard

  1. Navigate to Agents in the sidebar
  2. Click the Create Agent button
  3. Fill in the configuration form

Agent Configuration

Field Required Description
Name Yes A unique, descriptive name for your agent
System Prompt Yes Instructions defining agent behavior
Provider Yes The LLM provider to use
Model Yes The specific model (e.g., gpt-4o)
Temperature No Creativity level (0.0-1.0, default: 0.7)
Max Tokens No Maximum response length

Writing Effective System Prompts

Your system prompt defines how the agent behaves. A good system prompt includes:

  1. Role definition - Who is the agent?
  2. Capabilities - What can it help with?
  3. Constraints - What should it avoid?
  4. Tone - How should it communicate?

Example: Customer Support Agent

You are a customer support agent for TechCorp, a software company.

## Your Role
- Help customers with product questions
- Troubleshoot common technical issues
- Guide users through account management

## Guidelines
- Be friendly, professional, and empathetic
- Keep responses concise (2-3 paragraphs max)
- If you don't know the answer, say so honestly
- Never make up information about products or policies

## Escalation
If a customer asks about:
- Refunds or billing disputes
- Legal matters
- Account security concerns
Say: "I'll connect you with a specialist who can help with that."

Example: Code Assistant

You are a senior software engineer helping developers write better code.

## Expertise
- Python, JavaScript, TypeScript, Go
- Web frameworks (React, Vue, FastAPI, Express)
- Database design and SQL
- API design and best practices

## Response Format
- Explain your reasoning briefly
- Provide working code examples
- Include error handling
- Note any security considerations

## Style
- Be direct and technical
- Use code blocks with syntax highlighting
- Reference official documentation when helpful

Starting Your Agent

After creating an agent:

  1. Find your agent in the Agents list
  2. Click the Start button
  3. Wait for status to change to Running (5-10 seconds)

Agent Status Lifecycle

stateDiagram-v2
    [*] --> Created: Create Agent
    Created --> Running: Start
    Running --> Idle: No activity (30s)
    Idle --> Running: New message
    Running --> Stopped: Stop
    Stopped --> Running: Start
    Running --> Error: Failure
    Error --> Running: Start (retry)
Status Description
created Agent configured but never started
running Agent is active and processing messages
idle Agent running but no recent activity
stopped Agent manually stopped
error Agent encountered an error

Testing Your Agent

Via Dashboard Chat

  1. Click on your running agent
  2. Use the built-in chat interface
  3. Send test messages and verify responses

Via API

# Get your agent ID from the Dashboard
AGENT_ID="your-agent-id"
API_KEY="cust_your_api_key"

# Send a message
curl -X POST "https://agents.ag2trust.com/api/v1/agents/${AGENT_ID}/messages" \
  -H "X-API-Key: ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello! What can you help me with?"}'

Expected Response

{
  "message_id": "msg_7f8g9h0i",
  "content": [
    {
      "type": "text",
      "text": "Hello! I'm here to help you with product questions, technical troubleshooting, and account management. What can I assist you with today?"
    }
  ],
  "metadata": {
    "tokens_used": 38,
    "model": "gpt-4o",
    "duration_ms": 892
  }
}

Agent Tools & Capabilities

AG2Trust agents can be equipped with various tools:

Available Tool Categories

Category Tools Use Case
File Operations read_file, write_file, list_directory File management in workspace
Git git_status, git_commit, git_push, etc. Version control operations
Web http_get, http_post API calls and web requests
Search web_search Internet research
Collaboration discover_agent, send_agent_message Multi-agent communication

Configuring Capabilities

Capabilities are predefined tool bundles:

code_review    - Git read-only + file read
file_operations - Full filesystem access
git_full       - All git operations
web_http       - HTTP client access
research       - Web search + HTTP

Configure capabilities when creating or editing your agent in the Dashboard.

Best Practices

1. Start Simple

Begin with a focused use case before adding complexity.

# Good: Focused
You are a code review assistant. Review code for bugs and suggest improvements.

# Too broad
You are an AI that can do anything the user asks.

2. Set Clear Boundaries

Define what the agent should and shouldn't do.

## Do
- Answer questions about our product
- Help troubleshoot common issues

## Don't
- Make promises about future features
- Share internal company information
- Provide legal or medical advice

3. Test Edge Cases

Before going live, test:

  • [ ] Normal use cases
  • [ ] Empty or very short inputs
  • [ ] Very long inputs
  • [ ] Off-topic questions
  • [ ] Potentially harmful requests

4. Monitor Performance

Use the Dashboard to track:

  • Response times
  • Token usage
  • Error rates
  • User interactions

Troubleshooting

Agent won't start

  1. Check provider status - Verify your LLM provider API key is valid
  2. Review logs - Check agent logs in the Dashboard
  3. Try a different model - Some models may have availability issues

Slow responses

  1. Simplify the system prompt - Long prompts increase latency
  2. Use a faster model - Consider gpt-4o-mini for speed
  3. Check provider rate limits - You may be hitting API limits

Unexpected behavior

  1. Review system prompt - Ensure instructions are clear
  2. Check temperature setting - Lower for more consistent responses
  3. Test in isolation - Rule out context from previous messages

Next Steps