Examples

Practical examples and use cases to help you get started with Phoenix AI agents.

Basic Examples

Beginner
Simple Chatbot
Create a basic conversational AI agent
const agent = { name: "Helper Bot", systemPrompt: "You are a helpful assistant.", tools: [], temperature: 0.7 }
Beginner
Web Search Agent
Agent that can search the web for information
const searchAgent = { name: "Research Assistant", systemPrompt: "You help users find information online.", tools: ["webSearch"], maxSteps: 3 }

Advanced Examples

Advanced
Email Management Agent
Comprehensive email assistant with reading and sending capabilities

Configuration

const emailAgent = { name: "Email Assistant", systemPrompt: `You are an email management assistant. You can read emails, compose responses, and organize communications. Always ask for confirmation before sending emails.`, tools: ["readEmail", "sendEmail"], maxSteps: 5, temperature: 0.3 }

Example Usage

User: "Check my latest emails and draft a response to any urgent ones" Agent: "I'll check your emails and help you respond to urgent messages."
Advanced
Creative Content Agent
Multi-modal agent for content creation and analysis

Configuration

const creativeAgent = { name: "Creative Assistant", systemPrompt: `You are a creative content assistant specializing in visual and written content creation. You can generate images, analyze existing content, and provide creative suggestions.`, tools: [ "generateImage", "webSearch", "analyzeSrcStructureTool" ], maxSteps: 7, temperature: 0.8 }

Use Cases

  • • Generate marketing visuals
  • • Create social media content
  • • Analyze competitor content
  • • Design blog post illustrations

Specialized Use Cases

Expert
Development Assistant
Code analysis and project management
const devAgent = { name: "Dev Assistant", systemPrompt: `You are a software development assistant. You can analyze code structure, suggest improvements, and help with project organization.`, tools: [ "analyzeSrcStructureTool", "executeShell", "webSearch" ], maxSteps: 10 }
Expert
Research Agent
Comprehensive research and documentation
const researchAgent = { name: "Research Assistant", systemPrompt: `You are a research specialist who can gather information from multiple sources, analyze data, and create comprehensive reports.`, tools: [ "webSearch", "scrapeDocsTool", "fetchYouTubeVideo" ], maxSteps: 15 }

Best Practices

Agent Design Guidelines

System Prompts

  • • Be specific about the agent's role and capabilities
  • • Include guidelines for tool usage
  • • Set clear boundaries and limitations
  • • Provide examples of expected behavior

Tool Selection

  • • Only include tools relevant to the agent's purpose
  • • Consider security implications of each tool
  • • Test tool combinations thoroughly
  • • Monitor tool usage patterns

Performance Tuning

  • • Adjust temperature based on use case
  • • Set appropriate maxSteps limits
  • • Monitor response times and costs
  • • Implement proper error handling