# traceable

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/javascript/langsmith/traceable/traceable)

Higher-order function that takes function as input and returns a
"TraceableFunction" - a wrapped version of the input that
automatically handles tracing. If the returned traceable function calls any
traceable functions, those are automatically traced as well.

The returned TraceableFunction can accept a run tree or run tree config as
its first argument. If omitted, it will default to the caller's run tree,
or will be treated as a root run.

## Signature

```javascript
traceable<Func extends (args: any[]) => any>(wrappedFunc: Func, config?: TraceableConfig<Func>): TraceableFunction<Func>
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `wrappedFunc` | `Func` | Yes | Targeted function to be traced |
| `config` | `TraceableConfig<Func>` | No | Additional metadata such as name, tags or providing     a custom LangSmith client instance |

## Returns

`TraceableFunction<Func>`

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-javascript/blob/64f7b824728860d8ffa32068b4b5c8f479d1ee1c/src/lib/traceable.ts#L753)