Skip to main content
For Agent Developers

Integrate Audio Processing into Your AI Agents

Integrate the SonicAura native MCP server into your Python or TypeScript projects. Use OpenAI Agents SDK or LangChain to automate denoising, stem separation, and transcription in your code workflows.

13-Minute Quickstart

Here is how to add SonicAura to your OpenAI Agents SDK project in Python.If you are signed in, your API key is already pre-filled in the code below.

Python (OpenAI Agents SDK)
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerStdio

async def main():
    # 1. Configure the MCP Server (Your API Key is pre-filled)
    sonicaura_server = MCPServerStdio(
        command="npx",
        args=["-y", "@sonicaura/mcp-server"],
        env={"SONICAURA_API_KEY": "sk_your_api_key_here"} 
    )

    # 2. Create an Agent with SonicAura attached
    podcast_agent = Agent(
        name="Podcast Preprocessor",
        instructions="You are an audio assistant. When given a file, use SonicAura to denoise and extract vocals.",
        mcp_servers=[sonicaura_server]
    )

    # 3. Run the Agent
    result = await Runner.run(
        podcast_agent, 
        "Please clean this audio file: /path/to/noisy_interview.mp3"
    )
    print(result.final_output)

if __name__ == "__main__":
    asyncio.run(main())

2Tool Dictionary (Agent View)

Your Agent reads these descriptions to decide which tool to call. We've optimized them for LLM reasoning.

denoise_audioConsumes 1 Credit

When to use: When the input audio contains human speech with heavy background noise (e.g., wind, traffic, cafe). Do NOT use this for pure music tracks.

Input: file_url (string)
Output: JSON containing clean_audio_url

extract_vocalsConsumes 1 Credit

When to use: When the user wants to separate the lead vocal track from the instrumental/background track.

Input: file_url (string)
Output: JSON containing vocals_url and instrumental_url

apply_reverbConsumes 1 Credit

When to use: Apply spatial audio effects. Use after extract_vocals to add studio feel to raw vocals.

Input: file_url (string), preset (enum: "studio", "hall", "room")
Output: JSON containing processed_audio_url

3Chaining the Workflow

You don't need to write complex state machines. Just instruct your Agent in the system prompt, and the SDK will automatically pass the outputs to the next tool.

System Prompt Example
"You are a podcast editing assistant. When given a raw recording:
1. First, call `denoise_audio` to remove background noise.
2. Then, take the `clean_audio_url` and call `extract_vocals`.
3. Finally, take the `vocals_url` and call `apply_reverb` with the 'studio' preset.
Return the final URL to the user."

4Troubleshooting & Limits

Issue / ErrorHow your Agent should handle it
401 UnauthorizedAPI Key is invalid or missing. Stop execution and prompt the user to check their SONICAURA_API_KEY.
402 Payment RequiredOut of credits. Inform the user to top up their account.
413 File Too LargeAudio exceeds the 100MB limit. Ask the user to provide a shorter clip.
Timeout (Long audio)Processing takes >60s. The Agent should retry after a 10-second delay (max 3 retries).

Need help with your integration?

Whether you're building a complex audio agent or need custom API limits for your enterprise workflow, our engineering team is here to help.