Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri Logo

Swarmauri Text-to-Speech Agent

swarmauri_agent_texttospeech provides a stateless agent that converts each text prompt into an audio file through any Swarmauri TTSBase provider.

PyPI Downloads Hits Python Versions License PyPI Version

Features

  • Converts one fresh text input into one audio file.
  • Uses any provider implementing Swarmauri's TTSBase contract.
  • Keeps no conversation history, memory, or system context.
  • Supports synchronous, asynchronous, and batch agent execution.
  • Generates distinct default paths for batch outputs.

Installation

uv add swarmauri_agent_texttospeech
pip install swarmauri_agent_texttospeech

Install a TTS provider package alongside the agent. For the alpha OpenAI provider:

uv add --prerelease allow swarmauri_tts_openai

Or with pip:

pip install --pre swarmauri_tts_openai

Usage

import os

from swarmauri_agent_texttospeech import TextToSpeechAgent
from swarmauri_tts_openai import OpenaiTTS

tts = OpenaiTTS(
    api_key=os.environ["OPENAI_API_KEY"],
    name="gpt-4o-mini-tts",
    voice="alloy",
)
agent = TextToSpeechAgent(tts=tts, output_path="greeting.mp3")

audio_path = agent.exec("Welcome to Swarmauri.")
print(audio_path)

Each call is independent. The agent passes only that call's text to the TTS provider and never constructs a conversation or system message.

Structured dialogue and bounded batches

The agent also forwards a nonempty tuple of typed dialogue turns unchanged:

import os

from swarmauri_agent_texttospeech import TextToSpeechAgent
from swarmauri_tts_gemini_dialogue import (
    GeminiDialogueTTS, GeminiDialogueTurn,
)

provider = GeminiDialogueTTS(
    api_key=os.environ["GEMINI_API_KEY"],
    speaker_voices={"A": "Puck", "B": "Kore"},
)
agent = TextToSpeechAgent(tts=provider, output_path="dialogue.wav")
turns = (
    GeminiDialogueTurn(text="Hello", speaker="A"),
    GeminiDialogueTurn(text="Hello back", speaker="B"),
)
agent.exec(turns)
# await agent.abatch([turns], max_concurrent=2)

Speaker and voice validation belongs to the selected provider. A JSON string is not parsed into turns. Set filenames to match the codec; Gemini/native DeepInfra WAV defaults require .wav paths. Async batches default to at most five concurrent calls, with a positive integer max_concurrent override.

The OpenAI Speech example above is temporary compatibility: its models have a scheduled 2027-01-06 shutdown. All new provider packages remain alpha and live verification is pending; see the SDK migration and verification guides.

Contributing

This package is part of the Swarmauri SDK. Contributions should follow the repository contribution and style guides.

License

Apache-2.0

Provider instances are validated against TTSBase at call-time construction, so providers imported after the agent class remain usable. Serialized providers retain their concrete fields; import that provider before deserialization.

Metadata

Release files for swarmauri_agent_texttospeech 0.11.0.dev7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swarmauri_agent_texttospeech 0.11.0.dev7
File Size Uploaded Provenance Actions
swarmauri_agent_texttospeech-0.11.0.dev7.tar.gz 8.6 kB Without provenance Details for swarmauri_agent_texttospeech-0.11.0.dev7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_agent_texttospeech 0.11.0.dev7
File Interpreter ABI Platform Actions
swarmauri_agent_texttospeech-0.11.0.dev7-py3-none-any.whl Python 3 none any Details for swarmauri_agent_texttospeech-0.11.0.dev7-py3-none-any.whl

Total release size: 18.5 kB

Release files / swarmauri_agent_texttospeech-0.11.0.dev7.tar.gz

Download URL swarmauri_agent_texttospeech-0.11.0.dev7.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f11a945dd3380ed7208dcebd3a4c3919029b06f52bc1d63d9e3f7764efd0005
BLAKE2b-256 checksum
How to use checksums
d05df4e2ec9660b7c7277ec94bd76ba0c25151728e0a5caeb761e1a0f12e31da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / swarmauri_agent_texttospeech-0.11.0.dev7-py3-none-any.whl

Download URL swarmauri_agent_texttospeech-0.11.0.dev7-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
206d16dfe4b6f74994d91150baa4885955ef9199611604ceec5f93514c2692ee
BLAKE2b-256 checksum
How to use checksums
5fca3001560c2eb7d93bb79843c5baf0b4182745dfbcc20c0779004bb6b149dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for swarmauri_agent_texttospeech 0.11.0.dev7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page