← Back to Blog

How to Run an AI Music Generation Agent with OE Runtime

Generate original music tracks from text descriptions automatically. OE Runtime connects to Suno, crafts optimised music prompts, and returns the audio URL — from a background track to a full composition, all from a YAML file.

🎵
Step 1
Design Music Prompt
Craft a detailed Suno prompt specifying genre, mood, tempo, instruments, and duration.
Step 2
Generate Track
Submit the prompt to Suno and poll for completion before retrieving the audio URL.
Step 3
Report
Return the prompt used, track title, audio URL, duration, format, and generation time.

The Agent YAML

Create a file called agent.yaml inside a music-generation/ directory:

name: Music Creator
description: Generate original music tracks from text descriptions
instructions: |
  You are a music generation agent. Create original music using Suno.
  Describe genre, mood, tempo, and instruments clearly in your prompt.
  Music is generated asynchronously — poll for completion before returning the URL.
  Complete all steps fully before writing your report.
steps:
  - name: Design Music Prompt
    content: |
      Craft a detailed Suno music prompt for an upbeat corporate background track.
      Specify: genre (corporate pop), mood (energetic, optimistic), tempo (120 BPM),
      instruments (acoustic guitar, light drums, piano), duration (60 seconds), no vocals.
  - name: Generate Track
    content: |
      Submit the music prompt to Suno. Wait for generation to complete — poll every 10 seconds
      until status is "complete". Retrieve the audio URL and title once done.
  - name: Report
    content: |
      Summarize the result:
      - Prompt used for generation
      - Track title assigned by Suno
      - Audio URL
      - Duration and format
      - Generation time taken
connectors:
  - connection_name: Suno
    connection_type: suno

The Config File

Create oe-config.json in the same directory:

{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "YOUR_OPENAI_API_KEY"
  },
  "server": {
    "enabled": false,
    "port": 3333,
    "apiKey": "your-secret-api-key"
  },
  "connectors": [
    {
      "connection_name": "Suno",
      "connection_type": "suno",
      "apiKey": "YOUR_SUNO_API_KEY",
      "model": "chirp-v3-5"
    }
  ]
}

Get your Suno API key from suno.com. The model field accepts chirp-v3-5 (default, highest quality) or chirp-v3-0. Music generation is asynchronous — the agent polls until the track is complete before returning the URL.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

Windows

# Run the agent
oe-runtime-win.exe music-generation/agent.yaml --config music-generation/oe-config.json

macOS

# Make executable (first time only)
chmod +x oe-runtime-macos

# Run the agent
oe-runtime-macos music-generation/agent.yaml --config music-generation/oe-config.json

Linux

# Make executable (first time only)
chmod +x oe-runtime-linux

# Run the agent
oe-runtime-linux music-generation/agent.yaml --config music-generation/oe-config.json

macOS Gatekeeper: On first run, macOS may block the binary. Go to System Settings → Privacy & Security → click "Allow Anyway" next to oe-runtime-macos.

Running as an API Server

Add --serve to start OE Runtime as an HTTP server on port 3333:

oe-runtime-win.exe --serve --config music-generation/oe-config.json

Then send a request:

curl -X POST http://localhost:3333/run \
  -H "Content-Type: application/json" \
  -d '{"yaml": "music-generation/agent.yaml", "params": {}}'

Or import the Postman collection (download above) to test all endpoints visually.

Use Cases

Build your own agents with OE Runtime

Download OE Runtime and run any AI agent locally or as a server — no cloud required.

Get OE Runtime →