Guides
LangChain integration
LangChain
langchain-prosodyai gives a LangChain agent one standard tool for recorded
audio. The result is the complete structured ProsodyAI response: transcript,
recording-local speaker turns, ordered acoustic measurements, and same-speaker
deltas.
Install from the public main branch:
python -m pip install \
"langchain-prosodyai @ git+https://github.com/ProsodyAI/langchain.git@main"import os
from pathlib import Path
from langchain_prosodyai import ProsodyAnalyzeAudioTool
tool = ProsodyAnalyzeAudioTool(
api_key=os.environ["PROSODY_API_KEY"],
allowed_audio_root=Path("./recordings"),
)
analysis = tool.invoke({"audio_path": "recording.wav", "language": "en"})
print(analysis["text"])
for turn in analysis.get("turns") or []:
print(turn["speaker_id"], turn["start_ms"], turn["end_ms"], turn["text"])
for frame in analysis.get("prosody_timeline") or []:
print(frame["speaker_id"], frame.get("acoustic_state"))
print(frame.get("acoustic_change"))The model receives a path relative to allowed_audio_root; it never receives
unrestricted filesystem access. Supported extensions are .wav, .mp3,
.m4a, .flac, and .ogg.
The tool returns the recorded-audio API object unchanged, with every turn and
every measured frame intact. A speaker_id is scoped to a single recording.
Pass the same tool to create_agent when a model should be able to request an
analysis:
from langchain.agents import create_agent
agent = create_agent(
model="openai:gpt-5.4",
tools=[tool],
)See the public integration repository for the direct client, compatibility policy, and release status.