← Back to Blog

How to Run an AI Text-to-Speech Agent with OE Runtime

Convert written content into natural-sounding speech audio automatically. OE Runtime connects to ElevenLabs, prepares your text for audio delivery, generates the audio with your chosen voice settings, and returns the file URL — all from a single YAML file.

🔊
Step 1
Prepare Content
Clean and optimise the text for audio delivery — expand abbreviations and add natural pause markers.
Step 2
Generate Audio
Call ElevenLabs with voice settings (stability 0.7, similarity boost 0.8) and retrieve the audio URL.
Step 3
Report
Return character count, voice settings used, audio URL, estimated duration, and generation confirmation.

The Agent YAML

Create a file called agent.yaml inside a speech-audio/ directory:

name: Text to Speech Agent
description: Convert text to natural-sounding speech audio
instructions: |
  You are a speech synthesis agent. Convert provided text to audio using ElevenLabs.
  Choose voice settings appropriate for the content type.
  Complete all steps fully before writing your report.
steps:
  - name: Prepare Content
    content: |
      Prepare the following text for speech synthesis. Clean it for audio delivery -
      expand abbreviations, add natural pause markers, and confirm it reads well aloud:

      "Welcome to Open Enterprise. Your AI automation platform is ready. You can now
      build, deploy, and run intelligent agents that connect to any tool or service.
      Let's get started."
  - name: Generate Audio
    content: |
      Call the ElevenLabs connector to convert the prepared text to speech.
      Use a professional, clear voice. Set stability to 0.7 and similarity boost to 0.8.
      Wait for generation to complete and retrieve the audio file URL or path.
  - name: Report
    content: |
      Summarize the result:
      - Text converted (character count)
      - Voice settings used (voice name, stability, similarity boost)
      - Output audio URL or file path
      - Estimated duration
      - Confirm successful generation
connectors:
  - connection_name: ElevenLabs
    connection_type: elevenlabs

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": "ElevenLabs",
      "connection_type": "elevenlabs",
      "apiKey": "YOUR_ELEVENLABS_API_KEY",
      "voiceId": "21m00Tcm4TlvDq8ikWAM",
      "modelId": "eleven_multilingual_v2"
    }
  ]
}

Get your ElevenLabs API key from elevenlabs.io/app/settings. The voiceId shown is Rachel — a clear, professional voice. Browse all available voices at elevenlabs.io/voice-library and replace the voiceId with your preferred option. The eleven_multilingual_v2 model supports 29 languages.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

Windows

# Run the agent
oe-runtime-win.exe speech-audio/agent.yaml --config speech-audio/oe-config.json

macOS

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

# Run the agent
oe-runtime-macos speech-audio/agent.yaml --config speech-audio/oe-config.json

Linux

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

# Run the agent
oe-runtime-linux speech-audio/agent.yaml --config speech-audio/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 speech-audio/oe-config.json

Then send a request:

curl -X POST http://localhost:3333/run \
  -H "Content-Type: application/json" \
  -d '{"yaml": "speech-audio/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 →