CtrlK
BlogDocsLog inGet started
Tessl Logo

guydemo/music

Generate music using ElevenLabs Music API - instrumental tracks, songs with lyrics, and fine-grained composition plans

95

1.57x
Quality

93%

Does it follow best practices?

Impact

99%

1.57x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Music Generation Service with User-Submitted Prompts

Problem/Feature Description

A creative agency is building an internal web service where designers can type in a description and get AI-generated music for their projects. Since designers may type anything — including references to popular songs or artists for inspiration — the service needs to handle content restriction errors gracefully and guide users toward valid alternatives.

Write a Python module called music_service.py that provides a generate_music(user_prompt, duration_ms) function. This function should:

  • Attempt to generate music based on the user's text prompt
  • Handle cases where the prompt or composition plan gets rejected by the API due to content policy violations
  • Attempt to recover gracefully from content rejections rather than simply failing
  • Return either the path to the saved audio file on success, or a clear error message on failure
  • Log each attempt and outcome for debugging

The agency also wants a companion test file called test_prompts.py that demonstrates the function being called with both a safe prompt and a prompt that would likely be flagged (e.g., one referencing a real band name), showing how the retry logic works.

Output Specification

  • music_service.py — The Python module with the generate_music function
  • test_prompts.py — Demo script showing usage with safe and unsafe prompts

evals

SKILL.md

tile.json