feat(agents): add generation tool timeouts

This commit is contained in:
Peter Steinberger
2026-04-24 00:03:59 +01:00
parent bd49117a50
commit f0a7a85e7a
23 changed files with 141 additions and 7 deletions

View File

@@ -753,6 +753,7 @@ export async function textToSpeech(params: {
channel?: string;
overrides?: TtsDirectiveOverrides;
disableFallback?: boolean;
timeoutMs?: number;
}): Promise<TtsResult> {
const synthesis = await synthesizeSpeech(params);
if (!synthesis.success || !synthesis.audioBuffer || !synthesis.fileExtension) {
@@ -791,6 +792,7 @@ export async function synthesizeSpeech(params: {
channel?: string;
overrides?: TtsDirectiveOverrides;
disableFallback?: boolean;
timeoutMs?: number;
}): Promise<TtsSynthesisResult> {
const setup = resolveTtsRequestSetup({
text: params.text,
@@ -804,6 +806,7 @@ export async function synthesizeSpeech(params: {
}
const { config, providers } = setup;
const timeoutMs = params.timeoutMs ?? config.timeoutMs;
const target = supportsNativeVoiceNoteTts(params.channel) ? "voice-note" : "audio-file";
const errors: string[] = [];
@@ -840,7 +843,7 @@ export async function synthesizeSpeech(params: {
providerConfig: resolvedProvider.providerConfig,
target,
providerOverrides: params.overrides?.providerOverrides?.[resolvedProvider.provider.id],
timeoutMs: config.timeoutMs,
timeoutMs,
});
const latencyMs = Date.now() - providerStart;
attempts.push({