Skip to main content

voicematic

A phone voice agent, assembled from independent parts: a telephony transport brings the call in (Genesys Cloud AudioHook out of the box), a voice engine hears and speaks, a brain with tools does the thinking, and call control hands the call back to the platform for a transfer. Each AI role picks its vendor: OpenAI, Anthropic and Mistral are built in, and any vendor that speaks the OpenAI or Anthropic protocol is configuration.

pip install "voicematic[openai]"        # or [anthropic], [mistral], [mcp], [genesys], [testing], [all]

The core is standard library only. Each vendor's SDK is an extra and loads only when that provider is used.

from fastapi import FastAPI, WebSocket

from voicematic import DUTCH, AgentProfile, VoiceAgent
from voicematic.telephony import StarletteWebSocket
from voicematic.telephony.genesys import AudioHookTransport
from voicematic.voice import EchoEngine

agent = VoiceAgent(
    AgentProfile(
        name="Voorbeeld",
        persona="Je bent de telefonische assistent van Voorbeeld BV.",
        instructions="Beantwoord vragen kort en eerlijk.",
        greeting="Goedendag, waarmee kan ik u helpen?",
        language=DUTCH,
    ),
    engine=EchoEngine,
)

app = FastAPI()


@app.websocket("/audiohook")
async def audiohook(ws: WebSocket) -> None:
    await ws.accept()
    await agent.handle(AudioHookTransport(StarletteWebSocket(ws), languages=[agent.profile.language.tag]))

EchoEngine needs no model: two tones, then the caller's own audio back. Swap it for a speech-to-speech engine (voicematic.providers.openai.GPTLiveEngine) or a PipelineEngine of ears, brain and mouth from any vendor.

Packages

Package What it holds
voicematic VoiceAgent, CallSession, AgentProfile, Tool, drain_on_signals
voicematic.telephony TransportABC, CallControlABC; genesys/ for AudioHook, Architect flow and Platform API transfers
voicematic.voice VoiceEngineABC, PipelineEngine, EchoEngine
voicematic.reasoning ReasonerABC, ToolLoopReasoner, CallableReasoner
voicematic.llm / speech ChatModelABC, SpeechToTextABC, TextToSpeechABC and the neutral conversation types
voicematic.providers the PROVIDERS registry; openai/, anthropic/, mistral/
voicematic.tools tool registry, parallel tool calls, the transfer tool, MCP
voicematic.prompts AgentProfile, Language, prompt assembly
voicematic.audio formats, G.711, resampling, WAV
voicematic.testing an AudioHook simulator (python -m voicematic.testing) and a browser test phone

The library reads no environment and knows no application: settings, profile and tools come from the project. tests/test_boundary.py enforces that, and that each vendor SDK is imported only in its own providers/<vendor>/.

A complete application, with settings, a Dutch profile, tools, MCP, transfers, Docker images and the full documentation, is in ../project.

Development

./test.sh                # ruff, mypy and pytest in .venv, with voicematic[dev] installed editable
./publish.sh             # the checks, a build, and an upload to PyPI (PYPI_API_KEY in .env)

Metadata

Release files for voicematic 0.1.0

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

Source distribution (sdist)

Source distribution for voicematic 0.1.0
File Size Uploaded Provenance Actions
voicematic-0.1.0.tar.gz 87.5 kB Without provenance Details for voicematic-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 176.1 kB

Release files / voicematic-0.1.0.tar.gz

Download URL voicematic-0.1.0.tar.gz
Size 87.5 kB
Tags Source
SHA-256 checksum
How to use checksums
460b2831582b23857f5786a495a5713dfdb1cfe6c8e5b014a42bf82aacb7f6f7
BLAKE2b-256 checksum
How to use checksums
65339632e46799a6d894cc44b372f85741db63722b58eba80894a094cd32fac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / voicematic-0.1.0-py3-none-any.whl

Download URL voicematic-0.1.0-py3-none-any.whl
Size 88.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03c5649a2dd2a772f5b9e495f496eff4dd1141263ef15a020e645f152b2ac0b7
BLAKE2b-256 checksum
How to use checksums
54dc0b0d299bcf3e5c6a31b07f8990febfecf7f5b6aae779b647236cea63a7cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for voicematic 0.1.0

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