High severity intermediate · Fix: 5-10 min

TypeError

builtins.TypeError

What this error means
LangSmith's traceable decorator raises a TypeError when applied to async functions without proper async support.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 42, in <module>
    @traceable
  File "/usr/local/lib/python3.10/site-packages/langsmith/decorators.py", line 58, in traceable
    def wrapper(*args, **kwargs):
TypeError: 'coroutine' object is not callable
QUICK FIX
Replace the traceable decorator with its async-compatible variant or rewrite the decorator to support async functions by awaiting the wrapped coroutine.

Why it happens

The LangSmith traceable decorator is designed for synchronous functions by default. When applied to async functions without using an async-compatible wrapper, it attempts to call the coroutine object directly, causing a TypeError because coroutines must be awaited.

Detection

Monitor for TypeError exceptions mentioning 'coroutine object is not callable' in logs when using LangSmith decorators on async functions, and add logging around decorated async functions to catch this early.

Causes & fixes

1

Applying the synchronous traceable decorator to an async function without async support

✓ Fix

Use the async-compatible version of the traceable decorator or wrap the decorator logic inside an async wrapper function that awaits the coroutine.

2

Forgetting to await the decorated async function inside the decorator implementation

✓ Fix

Modify the decorator to await the async function call inside the wrapper to properly handle coroutine execution.

3

Using an outdated LangSmith version that lacks async decorator support

✓ Fix

Upgrade LangSmith to the latest version that includes async-compatible traceable decorators.

Code: broken vs fixed

Broken - triggers the error
python
from langsmith import traceable

@traceable
async def fetch_data():
    return await some_async_call()

result = fetch_data()  # TypeError: 'coroutine' object is not callable
Fixed - works correctly
python
import os
from langsmith import traceable_async

os.environ['LANGSMITH_API_KEY'] = os.getenv('LANGSMITH_API_KEY')  # Ensure API key is set

@traceable_async  # Changed to async-compatible decorator
async def fetch_data():
    return await some_async_call()

import asyncio
result = asyncio.run(fetch_data())  # Works correctly with async decorator
print(result)
Switched to the async-compatible traceable_async decorator and used asyncio.run to properly execute the async function, preventing TypeError from calling coroutine objects.

Workaround

Wrap the async function call inside a synchronous wrapper that runs the coroutine with asyncio.run or loop.run_until_complete, allowing use of the synchronous decorator temporarily.

Prevention

Always use async-compatible decorators for async functions and verify decorator support for async before applying; prefer LangSmith's official async traceable decorators to avoid coroutine call errors.

Python 3.9+ · langsmith >=0.1.0 · tested on 0.2.x
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.