Skip to main content
from praisonaiagents import Agent

audio_agent = Agent(name="transcriber", instructions="Transcribe audio to text.")
summary_agent = Agent(name="summariser", instructions="Summarise the transcript.")
result = audio_agent.start("Transcribe this podcast episode.")
summary_agent.start(result)
The user chains media agents; each step passes output to the next via pipeline context. Create powerful media processing workflows by chaining specialised agents (AudioAgent, VideoAgent, ImageAgent, OCRAgent) with standard agents. Context passes between steps using {{previous_output}}.

Quick Start

1

Simple Usage

name: Media Pipeline
process: sequential

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

  summarizer:
    role: Summarizer
    goal: Summarise the transcript

steps:
  - agent: transcriber
    action: transcribe
    input: "{{audio_file}}"

  - agent: summarizer
    action: "Summarise: {{previous_output}}"

variables:
  audio_file: input.mp3
2

With Configuration

name: Media Pipeline
description: Complete media pipeline from audio to video
process: sequential

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

  researcher:
    role: Research Specialist
    goal: Research the topic
    tools:
      - tavily_search

  image_creator:
    agent: ImageAgent
    llm: openai/dall-e-3
    role: Visual Artist
    goal: Create images

  video_creator:
    agent: VideoAgent
    llm: openai/sora-2
    role: Video Producer
    goal: Create videos

  narrator:
    agent: AudioAgent
    llm: openai/tts-1-hd
    role: Voice Narrator
    goal: Create voiceovers

steps:
  - agent: transcriber
    action: transcribe
    input: "{{audio_file}}"

  - agent: researcher
    action: "Research based on: {{previous_output}}"

  - agent: image_creator
    action: generate
    prompt: "{{previous_output}}"

  - agent: video_creator
    action: generate
    prompt: "{{previous_output}}"

  - agent: narrator
    action: speech
    text: "{{previous_output}}"
    output: "voiceover.mp3"

variables:
  audio_file: input.mp3

How It Works

PhaseWhat happens
1. StartThe pipeline runs steps in sequence
2. PassEach step’s output becomes {{previous_output}} for the next
3. ReturnThe final step’s output flows back to you

Context Passing

Use {{previous_output}} to pass the output from one agent to the next:
steps:
  - agent: transcriber
    action: transcribe
    input: "audio.mp3"
  
  - agent: researcher
    action: "Research this topic: {{previous_output}}"
  
  - agent: artist
    action: generate
    prompt: "Create an image for: {{previous_output}}"

Mixed Agent Types

Combine specialised agents with standard agents:
agents:
  transcriber:
    agent: AudioAgent
    llm: openai/whisper-1
    role: Transcriber
    goal: Transcribe audio

  analyzer:
    role: Content Analyst
    goal: Analyze and summarize content
    instructions: You analyze content and provide insights.

  visualizer:
    agent: ImageAgent
    llm: openai/dall-e-3
    role: Visualizer
    goal: Create visual representations

steps:
  - agent: transcriber
    action: transcribe
    input: "meeting.mp3"
  
  - agent: analyzer
    action: "Analyze this transcript and identify key themes: {{previous_output}}"
  
  - agent: visualizer
    action: generate
    prompt: "Create an infographic showing: {{previous_output}}"

CLI Usage

Run the multi-agent pipeline recipe:
praisonai recipe run ai-media-pipeline --var audio_file=input.mp3
praisonai recipe run ai-media-pipeline --var audio_file=podcast.mp3 --var output_dir=./output

Python API

from praisonaiagents import YAMLWorkflowParser

yaml_content = """
name: Custom Pipeline
process: sequential

agents:
  transcriber:
    agent: AudioAgent
    llm: openai/whisper-1
    role: Transcriber
    goal: Transcribe audio
  
  summarizer:
    role: Summarizer
    goal: Summarize content

steps:
  - agent: transcriber
    action: transcribe
    input: "{{audio_file}}"
  
  - agent: summarizer
    action: "Summarize: {{previous_output}}"

variables:
  audio_file: recording.mp3
"""

parser = YAMLWorkflowParser()
workflow = parser.parse_string(yaml_content)
result = workflow.start()

Available Recipes

RecipeDescriptionAgents
ai-text-to-speechConvert text to speechAudioAgent
ai-speech-to-textTranscribe audioAudioAgent
ai-generate-imageGenerate imagesImageAgent
ai-generate-videoGenerate videosVideoAgent
ai-document-ocrExtract text from documentsOCRAgent
ai-media-pipelineComplete 5-agent pipelineAudioAgent, Agent, ImageAgent, VideoAgent

Best Practices

Place agents in input → processing → output sequence so each step receives meaningful context.
Use Whisper for transcription, DALL·E for images, and TTS models for voiceovers — not general chat models.
Set output on steps that produce files so downstream agents and recipes can find artefacts.
Validate each agent in isolation before chaining the full pipeline.

Error Handling

Add error handling with guardrails:
steps:
  - agent: transcriber
    action: transcribe
    input: "{{audio_file}}"
    max_retries: 3
  
  - agent: researcher
    action: "Research: {{previous_output}}"
    guardrail: validate_research_output

Specialized Agents

AudioAgent, VideoAgent, ImageAgent, and OCRAgent reference.

YAML Workflows

Workflow syntax, variables, and step definitions.