Specialised Agents

Use specialised agent types (AudioAgent, VideoAgent, ImageAgent, OCRAgent) in YAML workflows

Specialised agents give your workflows domain-specific capabilities — speech, vision, video, and document extraction — from a single agent: field in YAML or a few lines of Python.

python
from praisonaiagents import Agent, ImageAgent

artist = ImageAgent(model="openai/dall-e-3")
artist.generate("A mountain landscape at sunset", output="sunset.png")

The user requests media or OCR in a workflow; the specialised agent type handles that step.

Diagram

Workflow Step

Agent Type

AudioAgent

ImageAgent

VideoAgent

OCRAgent

Media Output

How It Works

Diagram
Specialised AgentsAgentUserSpecialised AgentsAgentUserRequestProcess requestResult Agent–>>User: Response

Quick Start

  1. Text-to-Speech (YAML)
    yaml
    agents:
      speaker:
        agent: AudioAgent
        llm: openai/tts-1
        role: Text-to-Speech Agent
        goal: Convert text to speech
    
    steps:
      - agent: speaker
        action: speech
        text: "Hello, welcome to PraisonAI!"
        output: "hello.mp3"
  2. Python API
    python
    from praisonaiagents import AudioAgent, ImageAgent, VideoAgent, OCRAgent
    
    audio = AudioAgent(model="openai/tts-1")
    audio.speech("Hello world!", output="hello.mp3")
    
    image = ImageAgent(model="openai/dall-e-3")
    image.generate("A mountain landscape", output="sunset.png")
    
    video = VideoAgent(model="openai/sora-2")
    video.generate("A sunset timelapse", output="timelapse.mp4")
    
    ocr = OCRAgent(model="mistral/mistral-ocr-latest")
    text = ocr.extract("document.pdf")

Supported Agent Types

Agent TypePurposeKey Methods
AudioAgentText-to-Speech (TTS) and Speech-to-Text (STT)speech(), transcribe()
VideoAgentVideo generationgenerate()
ImageAgentImage generation, editing, variationsgenerate(), edit()
OCRAgentText extraction from documents/imagesextract()
DeepResearchAgentAutomated research with citationsresearch()

YAML Examples

Speech-to-Text

yaml
agents:
  transcriber:
    agent: AudioAgent
    llm: openai/whisper-1
    role: Transcriber
    goal: Transcribe audio to text

steps:
  - agent: transcriber
    action: transcribe
    input: "recording.mp3"

Document OCR

yaml
agents:
  reader:
    agent: OCRAgent
    llm: mistral/mistral-ocr-latest
    role: Document Reader
    goal: Extract text from documents

steps:
  - agent: reader
    action: extract
    source: "document.pdf"

CLI Usage

bash
praisonai recipe run ai-text-to-speech --var text="Hello world"
praisonai recipe run ai-speech-to-text --var audio=recording.mp3
praisonai recipe run ai-generate-image --var prompt="A sunset"
praisonai recipe run ai-generate-video --var prompt="A cat playing"
praisonai recipe run ai-document-ocr --var source=document.pdf

Best Practices

Choose the right model

Use tts-1-hd for higher-quality audio, dall-e-3 for detailed images, and provider-specific OCR models for scanned PDFs.

Set explicit output paths

Specialised agents produce files — always specify output or source paths so downstream steps can chain results.

Chain with standard agents

Combine specialised agents with a standard Agent for analysis, summarisation, or formatting of media outputs.

Pass context between steps

Use {{previous_output}} in YAML workflows to feed transcribed text or extracted content into the next agent step.


Related