---
title: 5 SDK anti-patterns I keep fixing in voice AI
description: Maintaining SDKs across five languages taught me the same mistakes appear every time. Here are the five patterns I'd redesign first, and why they matter for voice
canonical: https://lukeocodes.dev/5-sdk-anti-patterns-voice-ai
type: article
locale: en_GB
published: 2026-05-16T00:00:00.000Z
modified: 2026-05-16T00:00:00.000Z
authors:
  - Luke Oliff
section: Developer Experience
tags:
  - Developer Experience
  - API Design
  - Voice AI
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/5-sdk-anti-patterns-voice-ai#article
        headline: 5 SDK anti-patterns I keep fixing in voice AI
        alternativeHeadline: 5 SDK anti-patterns I keep fixing in voice AI
        description: Maintaining SDKs across five languages taught me the same mistakes appear every time. Here are the five patterns I'd redesign first, and why they matter for voice
        datePublished: 2026-05-16T00:00:00.000Z
        dateModified: 2026-05-16T00:00:00.000Z
        url: https://lukeocodes.dev/5-sdk-anti-patterns-voice-ai
        mainEntityOfPage: https://lukeocodes.dev/5-sdk-anti-patterns-voice-ai
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: Developer Experience, API Design, Voice AI
        articleSection: Developer Experience
        about:
          - "@type": Thing
            name: Developer Experience
          - "@type": Thing
            name: API Design
          - "@type": Thing
            name: Voice AI
        abstract: I spent a chunk of my time at Deepgram maintaining SDKs. Five of them at one point, across Node.js, Python, Go, .NET, and Rust. That many languages means you see the same design decisions made five different ways by five different maintainers, and you start noticing which patterns cause friction every time and which
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/blog/5-sdk-anti-patterns-voice-ai/hero.png
        wordCount: 1428
        timeRequired: PT8M
        publisher:
          "@id": https://ably.com/#organization
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: 5 SDK anti-patterns I keep fixing in voice AI
            item: https://lukeocodes.dev/5-sdk-anti-patterns-voice-ai
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# 5 SDK anti-patterns I keep fixing in voice AI

May 2026 · [Developer Experience](/blog/category/developer-experience) · 8 min read · [Luke Oliff](/authors/luke)

I spent a chunk of my time at Deepgram maintaining SDKs. Five of them at one point, across Node.js, Python, Go, .NET, and Rust. That many languages means you see the same design decisions made five different ways by five different maintainers, and you start noticing which patterns cause friction every time and which ones just work.

Here are the five patterns I keep fixing. They're not Deepgram-specific. They show up in every API SDK I've touched, but voice AI makes them hurt more because streaming audio compounds every small design mistake into a real developer experience problem.

## 1. Hardcoded timeouts in streaming clients

The most common SDK bug I fixed across every language was a timeout value that made sense for REST but not for streaming. A 30-second HTTP timeout looks reasonable when you're sending a short request. But a streaming speech-to-text session can run for ten minutes, an hour, or longer. The SDK would kill the connection before the transcription finished, and the developer would blame the API.

The fix is simple: make the timeout configurable per-connection, not per-client. Better yet, separate the connection timeout from the idle timeout. The first one matters for initial handshake. The second one should be generous or absent for streaming. Most SDKs lump them into one value because the underlying HTTP client does the same, and nobody thinks about it until a production pipeline drops every session at 30 seconds.

```python
# The pattern I kept finding
client = VoiceClient(api_key="...", timeout=30)

# What streaming actually needs
client = VoiceClient(api_key="...", connect_timeout=10, stream_timeout=None)
```

I also learned to never set a default idle timeout on streaming endpoints. Let the server control that. If the server closes an idle connection, surface the server's reason. Don't add a second timeout on top that fires first and masks the real issue.

## 2. Wrapping the raw stream into something developers can't inspect

Every SDK I worked on had a convenience layer that wrapped the raw WebSocket or HTTP2 stream into a high-level object. That layer is useful, but most versions also made the underlying stream inaccessible. Developers could not measure time-to-first-audio, inspect raw frames, or see when the connection dropped, because the wrapper swallowed all that detail.

The pattern that worked better was a layered API. Give developers the convenience wrapper for the 80% case, but expose the raw stream as a property they can attach to. A developer who needs to measure latency should not have to fork the SDK to do it.

```javascript
// What most SDKs give you
const transcription = await client.transcribe(audioStream)
console.log(transcription) // just the result

// What developers actually need
const session = client.createSession(audioStream)
session.on('first-audio', () => console.log('TTFA:', Date.now() - start))
session.on('raw-frame', (frame) => buffer.push(frame))
const result = await session.result
```

I started pushing for this pattern across all five SDKs after watching a user spend three days trying to benchmark latency with a stopwatch and the server logs. Three days because the SDK did not expose a single timestamp.

## 3. Error handling that assumes the audio is fine

Most SDK error handlers catch HTTP-level errors. 4xx, 5xx, network timeouts. They almost never catch the failure modes that are specific to voice AI: empty audio, silent audio, single-channel audio sent to a multi-channel endpoint, audio that the API accepts but produces garbage transcripts from.

The silent failure is the worst. The API returns a 200 with a transcript that says nothing useful, or worse, a transcript that looks plausible but is wrong. The SDK surfaces a success and the developer spends hours debugging the model before anyone checks the audio.

The fix is not in the API. It's in the SDK. Add a validation step that runs before the request is sent. Check sample rate, channel count, duration, and amplitude. If the audio is silent or too short, surface a clear error before the API call, not after.

```go
// Before: send and hope
resp, err := client.Transcribe(ctx, audio)
if err != nil {
    // handle API error
}

// After: validate first
if err := ValidateAudio(audio); err != nil {
    return nil, fmt.Errorf("audio validation failed: %w", err)
}
resp, err := client.Transcribe(ctx, audio)
```

I built a version of this for the Deepgram Go SDK and it cut Discord support tickets about "broken transcription" by roughly a third. The model was never broken. The audio was always wrong.

## 4. Sync-first API in a domain that is fundamentally async

Streaming audio is asynchronous. The connection opens, data flows in both directions, events fire, and at some point the connection closes. But several of the SDKs I inherited started with synchronous method signatures because that is what the first version shipped, and async was added as a second-class wrapper later.

The result was a confusing API surface. The sync method blocked the calling thread for the entire duration of a stream. The async method was hidden behind a different import path or a different class name. Developers who grabbed the first example from the README got the sync version and wondered why their UI froze during transcription.

The right design is async-first from day one. The sync blocker becomes a thin convenience wrapper around the async core.

```python
# What I inherited in one SDK (pseudocode)
result = client.transcribe(audio_file)  # blocks for minutes

# What it should have been
async for event in client.transcribe_stream(audio_file):
    if event.is_final:
        print(event.transcript)
```

I redid the Python and Node SDKs to be async-first and the sync-to-async migration took about three months across both. The developer feedback was uniformly positive. Nobody complained about losing the blocking call. Several people thanked us for making the async path the default, because it forced them to think about streaming correctly from the start.

## 5. Retry strategies that fight the streaming endpoint

Retry logic in HTTP SDKs is straightforward. Request fails, wait, retry. Streaming retry is a different problem, because the stream had state. If the connection drops mid-transcription, you cannot just replay the same request. You need to reconnect, tell the server what audio has already been processed, and resume from where you left off.

Most SDKs I saw treated streaming retry like HTTP retry. They wrapped the whole connect-and-stream loop in a retry block and sent the full audio again every time. That worked, barely, but it meant every reconnect cost the full audio processing time and duplicated work on the server side.

The better approach is reconnect with sequence numbers. Each audio chunk gets a sequence number. When the connection drops, the SDK reconnects and sends the last known sequence number. The server picks up from there.

```javascript
// Pattern that wastes time
async function transcribeWithRetry(audio) {
    for (let attempt = 0; attempt < 3; attempt++) {
        try {
            return await transcribe(audio) // resends everything
        } catch (e) {
            await backoff(attempt)
        }
    }
}

// Pattern that works
let sequence = 0
stream.on('disconnect', () => {
    reconnect({ resumeFrom: sequence })
})
stream.on('chunk-sent', (seq) => { sequence = seq })
```

I only got this right in two of the five SDKs before I moved on. The other three kept the naive retry. In production, the difference was measurable: the smart-retry SDKs recovered from disconnects in under a second with zero duplicate processing. The naive ones took as long as the original transcription.

### FAQ

#### Why do SDKs hardcode timeouts for streaming?

Most SDKs start as REST wrappers, where short timeouts make sense. When streaming support is added later, the existing timeout value carries over because nobody considers that a streaming session might outlast the default. The fix is to separate connection timeout from idle timeout and make both configurable.

#### What is the most common voice AI integration failure that is not model accuracy?

Audio format mismatch. Silent or empty audio. Mono versus stereo confusion. Sample rate mismatches that the API accepts silently but transcribes poorly. These failures are invisible to the developer because the API returns success, and the SDK surfaces no warning about the audio quality.

#### Should voice AI SDKs be async-first or sync-first?

Async-first. Streaming audio is inherently asynchronous. A sync-first API forces developers into thread management and blocking calls that fight the real-time nature of the domain. Async-first defaults make the correct usage pattern the obvious one.

#### How should streaming SDKs handle reconnection?

Use sequence numbers or byte offsets so the server can resume from where the connection dropped. Naive retry that resends all audio duplicates processing time and can cause out-of-order transcription. Smart reconnect is harder to implement but produces a dramatically better developer experience.

[← Newer: Sunday roundup: four posts on audio debugging and work culture](/sunday-roundup-may-11-16-2026)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
