Moya Documentation

Quickstart Guide

Installation

The Moya library is already set up with several example agents and tools. To get started:

Terminal
pip install moya-ai

Prerequisites

Before running the examples, you'll need:

The repository includes several pre-configured example files in moya/examples/:

  • quick_start_openai.py - Basic OpenAI chat agent
  • quick_start_bedrock.py - AWS Bedrock integration
  • quick_start_ollama.py - Local Ollama models
  • quick_start_multiagent.py - Multiple agent orchestration
  • dynamic_agents.py - Runtime agent creation

Basic Usage

Let's walk through a simple example that demonstrates Moya's core functionality:

Python
from moya.agents.openai_agent import OpenAIAgent, OpenAIAgentConfig

# Create an agent configuration
agent_config = OpenAIAgentConfig(
    system_prompt="You are a helpful AI assistant.",
    model_name="gpt-4o"
)

# Initialize the agent
agent = OpenAIAgent(
    agent_name="my_assistant",
    description="A general-purpose AI assistant",
    agent_config=agent_config
)

# Set up the agent
agent.setup()

# Send a message and get a response
response = agent.handle_message("Hello, how can you help me?")

This example demonstrates:

Running Examples

Moya comes with several example scripts that demonstrate different capabilities:

1. Simple Chat Agent

The quick_start_openai.py example shows how to create an interactive chat agent with memory:

Terminal
python examples/quick_start_openai.py

This example demonstrates:

2. Multi-Agent System

The quick_start_multiagent.py example shows how to create a system with multiple specialized agents:

Terminal
python examples/quick_start_multiagent.py

This example showcases:

3. Local Model Integration

For users who prefer to run models locally, the Ollama integration example demonstrates using local models:

Terminal
# First, install and start Ollama
# Install from https://ollama.ai
ollama run llama2  # Downloads and runs the model

# Then run the example
python examples/quick_start_ollama.py

This example shows:

Next Steps

Now that you have Moya up and running, you can: