← 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 a clear, professional voice 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 and confirm it reads well aloud:

      "Welcome to Open Enthrium. 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: Select Voice
    content: |
      GET /voices to retrieve the list of available ElevenLabs voices.
      Select a professional, clear voice suitable for corporate narration.
      Save the voice_id of the selected voice.
  - name: Generate Audio
    content: |
      POST /text-to-speech/<voice_id> with body:
      {
        "text": "<prepared text from step 1>",
        "model_id": "eleven_multilingual_v2",
        "voice_settings": { "stability": 0.7, "similarity_boost": 0.8 }
      }
      The response is an audio file saved to a local temp path. Report that path.
  - name: Report
    content: |
      Summarize the result:
      - Text converted (character count)
      - Voice selected (name and voice_id)
      - Voice settings used (stability, similarity_boost)
      - Output audio file path
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",
      "headerName": "xi-api-key",
      "baseUrl": "https://api.elevenlabs.io/v1"
    }
  ]
}

Get your ElevenLabs API key from elevenlabs.io/app/settings. The agent automatically fetches available voices via GET /voices and selects the best match for the content — no need to hardcode a voice ID. Browse the full voice library at elevenlabs.io/voice-library. The generated audio is saved to a local file and the path is returned in the report.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

Windows

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

macOS

chmod +x oe-runtime-macos
oe-runtime-macos speech-audio/agent.yaml --config speech-audio/oe-config.json

Linux

chmod +x oe-runtime-linux
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 →
Series OE Runtime Agent Guides — 21 Connectors
Series overview →