---
type: email
from: Shubham Lohiya <notifications@github.com>
subject: [openai/openai-agents-python] Support adding function tool parameters

 descriptions using Annotated types instead of just through docstrings (Issue

 #1731)
received: 2026-03-06 07:30:25
date_header: Fri, 12 Sep 2025 14:55:01 -0700
priority: normal
status: awaiting_approval
uid: 30302
---

## Email Content

**From:** Shubham Lohiya <notifications@github.com>
**Subject:** [openai/openai-agents-python] Support adding function tool parameters

 descriptions using Annotated types instead of just through docstrings (Issue

 #1731)
**Date:** Fri, 12 Sep 2025 14:55:01 -0700

### Body (preview)

shubhlohiya created an issue (openai/openai-agents-python#1731)



Currently, [the only way to add parameter descriptions](https://github.com/openai/openai-agents-python/blob/581111c8914c5befe701bf083d96915e2e1c1d36/src/agents/function_schema.py#L222) for function tools when using the `function_tool` decorator is using the function docstring. However, I think it would be very developer friendly if parsing descriptions from Annotated types was also supported. 



Here is an example of how these can be supported: 



```

from typing import Annotated, Callable, get_origin

import inspect

from pydantic import ValidationError



def sum_two_numbers(

    a: Annotated[int, "First number to add"],

    b: Annotated[int, "Second number to add"]

) -> int:

    return a + b





def get_annotated_description(param_type: type) -> str:

    if get_origin(param_type) is Annotated:

        metadata = getattr(param_type, "__metadata__", ())

        for annotation in metadata:

            if isinstance(annotation, str):

                return annotation

    return None





def get_annotated_descriptions(func: Callable) -> dict:

    sig = inspect.signature(func)

    param_descs = {}

    for name, param in sig.parameters.items():

        param_type = param.annotation

        if param_type is inspect.Parameter.empty:

            raise ValidationError(f"Parameter {name} has no type hint. Type hints are required for all func input parameters.")

        param_descs[name] = get_annotated_description(param_type)

    return param_descs



param_descs = get_annotated_descriptions(sum_two_numbers)

print(param_descs)

```



Outputs: 

```

{'a': 'First number to add', 'b': 'Second number to add'}

```



and can directly be used in [function_schema.py](https://github.com/openai/openai-agents-python/blob/581111c8914c5befe701bf083d96915e2e1c1d36/src/agents/function_schema.py). 





--- 

This will allow developers to decorate functions as function tools with `name_override`,

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
