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.dev6

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.dev6
File Size Uploaded Provenance Actions
swarmauri_agent_texttospeech-0.11.0.dev6.tar.gz 8.5 kB Without provenance Details for swarmauri_agent_texttospeech-0.11.0.dev6.tar.gz

Built distribution (wheel)

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

Total release size: 18.5 kB

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

Download URL swarmauri_agent_texttospeech-0.11.0.dev6.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2518d44e6df8ee348e08b8b1fdeaa63d86b14cfb49a92b2365b9cf59fec9dd9c
BLAKE2b-256 checksum
How to use checksums
547b6ed4ef49487832ae6991dad037621d90ce4ef56d9a124b5a15c7a8d25a3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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":"26.04","id":"resolute","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.dev6-py3-none-any.whl

Download URL swarmauri_agent_texttospeech-0.11.0.dev6-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
300c32000b6698b4418b2f35b2d07ed0133020ec38293177a94ef83847047474
BLAKE2b-256 checksum
How to use checksums
53ca8d940d3f8700077c851b4b2069a7b04d02cd606c1f4b3f0d470139faeab8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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":"26.04","id":"resolute","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.dev6

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