Skip to main content

Zrb extras

zrb-extras is a pypi package.

You can install zrb-extras by invoking the following command:

pip install zrb-extras
pip install "zrb-extras[pyttsx3]"  # or [youtube], [all]

Let your LLM task speak

create_speak_tool gives the agent a tool that says text aloud. The agent decides what to say and when, which suits an LLMTask that runs unattended ("the build finished") or a persona that should talk rather than print.

Talking to zrb is built into zrb itself since 3.10: /voice and /handsfree dictate, and hands-free can answer tool approvals. zrb can also read every reply aloud (ZRB_LLM_SPEECH_ENABLED=on). See zrb's Voice and Camera guide. The listen tool that used to live here was removed in zrb-extras 3.1.0 for that reason, and since 4.0.0 speak runs on zrb's speech backends instead of its own OpenAI, Gemini, Termux and pyttsx3 clients.

Use the speak tool or zrb's built-in speech, not both, or replies are said twice.

Or: a pyttsx3 voice for zrb's built-in speech

zrb reads replies aloud with Termux:API (on Android), say, espeak-ng, OpenAI or Gemini. zrb-extras adds Pyttsx3SpeechBackend: offline, in process, extra [pyttsx3]. If it fails, zrb's local engine speaks instead.

from zrb.builtin import llm_chat
from zrb.llm.speech import SpeechConfig, enable_speech
from zrb_extras.llm.speech import Pyttsx3SpeechBackend

enable_speech(
    llm_chat,
    SpeechConfig(backend=Pyttsx3SpeechBackend(rate=150), enabled=True),
)

Calling enable_speech again replaces the built-in call, so there is still one speaker and one /speech command.

Prerequisites

Termux

First of all, make sure termux has permission to access the speaker

pkg update && pkg upgrade -y
pkg install pulseaudio termux-api -y

Run the following script or add it to ~/.bashrc

# start PulseAudio daemon
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1

# Start proot-distro
proot-distro login ubuntu

Proot-distro (Ubuntu)

apt install libasound2-dev portaudio19-dev pulseaudio

Create zrb_init.py

create_speak_tool takes zrb's SpeechConfig, so it speaks through the same backends as zrb's built-in speech: auto (Termux:API, say or espeak-ng), openai, gemini, a Pipecat voice like kokoro (needs zrb[voice]), or a backend object such as Pyttsx3SpeechBackend. Fields left out are read from ZRB_LLM_SPEECH_*.

from zrb.builtin import llm_chat
from zrb.llm.speech import SpeechConfig
from zrb.llm.tool_call.tool_policy.auto_approve import auto_approve
from zrb_extras.llm.tool import create_speak_tool

llm_chat.append_tool(
    create_speak_tool(SpeechConfig(backend="openai", voice="alloy"))
)
llm_chat.prepend_tool_policy(auto_approve("speak"))

The agent can pick a voice_name and an instruction ("cheerful", "whisper") on each call. OpenAI's gpt-4o-mini-tts and Gemini follow the instruction; a backend passed as an object ignores both.

fetch_youtube_transcript (extra [youtube]) is another tool in the same package: llm_chat.append_tool(fetch_youtube_transcript).

pyttsx3 voices

pyttsx3 uses your system's TTS engine (espeak/espeak-ng on Linux; sudo apt install espeak-ng for better voices).

from zrb_extras.llm.speech import Pyttsx3SpeechBackend
from zrb_extras.llm.speech.backend.pyttsx3 import list_available_voices

for voice in list_available_voices():
    print(f"{voice['id']}: {voice['name']}")

create_speak_tool(
    SpeechConfig(backend=Pyttsx3SpeechBackend(voice_name="english-us+m3", rate=150, volume=0.9))
)

For maintainers

Publish to pypi

To publish zrb-extras, you need to have a Pypi account:

You can also create a TestPypi account:

Once you have your API token, you need to configure poetry:

poetry config pypi-token.pypi <your-api-token>

To publish zrb-extras, you can do the following command:

poetry publish --build

Updating version

You can update zrb-extras version by modifying the following section in pyproject.toml:

[project]
version = "0.0.2"

Adding dependencies

To add zrb-extras dependencies, you can edit the following section in pyproject.toml:

[project]
dependencies = [
    "Jinja2==3.1.2",
    "jsons==1.6.3"
]

Adding script

To make zrb-extras executable, you can edit the following section in pyproject.toml:

[project-scripts]
zrb-extras-hello = "zrb_extras.__main__:hello"

Now, whenever you run zrb-extras-hello, the main function on your __main__.py will be executed.

Metadata

Release files for zrb-extras 4.1.1

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

Source distribution (sdist)

Source distribution for zrb-extras 4.1.1
File Size Uploaded Provenance Actions
zrb_extras-4.1.1.tar.gz 6.2 kB With provenance Details for zrb_extras-4.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zrb-extras 4.1.1
File Interpreter ABI Platform Actions
zrb_extras-4.1.1-py3-none-any.whl Python 3 none any Details for zrb_extras-4.1.1-py3-none-any.whl

Total release size: 14.7 kB

Release files / zrb_extras-4.1.1.tar.gz

Download URL zrb_extras-4.1.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d7c4e2a49b8c47f857d66097f2775c54355a78702ab34d80f16082af5a38a678
BLAKE2b-256 checksum
How to use checksums
ac69da5f92bbb83c65577dbc487d9fd36d9004e3043f20efe2cc0bb001f61d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / zrb_extras-4.1.1-py3-none-any.whl

Download URL zrb_extras-4.1.1-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
935e1784c7962e41a38cfde8f059f39bf5be50e36d73568bd15b3d1993266f6c
BLAKE2b-256 checksum
How to use checksums
c26221077cdd108275573faccf25888fa8c809c11450c492744f1468f76050ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for zrb-extras 4.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zrb_extras-4.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

4.1.1 This release

2 release files Full provenance

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