# required_args

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_openapi_client/_utils/_utils/required_args)

Decorator to enforce a given set of arguments or variants of arguments are passed to the decorated function.

Useful for enforcing runtime validation of overloaded functions.

Example usage:
```py
@overload
def foo(*, a: str) -> str: ...

@overload
def foo(*, b: bool) -> str: ...

# This enforces the same constraints that a static type checker would
# i.e. that either a or b must be passed to the function
@required_args(["a"], ["b"])
def foo(*, a: str | None = None, b: bool | None = None) -> str: ...
```

## Signature

```python
required_args(
    *variants: Sequence[str] = (),
) -> Callable[[CallableT], CallableT]
```

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/d6cd6082f09e7826a2d6afe444ae6119e61b82a6/python/langsmith/_openapi_client/_utils/_utils.py#L226)