llama-stack-mirror/src/llama_stack
Shabana Baig 433438cfc0
feat: Implement the 'max_tool_calls' parameter for the Responses API (#4062)
# Problem
Responses API uses max_tool_calls parameter to limit the number of tool
calls that can be generated in a response. Currently, LLS implementation
of the Responses API does not support this parameter.

# What does this PR do?
This pull request adds the max_tool_calls field to the response object
definition and updates the inline provider. it also ensures that:

- the total number of calls to built-in and mcp tools do not exceed
max_tool_calls
- an error is thrown if max_tool_calls < 1 (behavior seen with the
OpenAI Responses API, but we can change this if needed)

Closes #[3563](https://github.com/llamastack/llama-stack/issues/3563)

## Test Plan
- Tested manually for change in model response w.r.t supplied
max_tool_calls field.
- Added integration tests to test invalid max_tool_calls parameter.
- Added integration tests to check max_tool_calls parameter with
built-in and function tools.
- Added integration tests to check max_tool_calls parameter in the
returned response object.
- Recorded OpenAI Responses API behavior using a sample script:
https://github.com/s-akhtar-baig/llama-stack-examples/blob/main/responses/src/max_tool_calls.py

Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-11-10 13:21:27 -08:00
..
apis feat: Implement the 'max_tool_calls' parameter for the Responses API (#4062) 2025-11-10 13:21:27 -08:00
cli fix: print help for list-deps if no args (#4078) 2025-11-05 11:34:08 -08:00
core fix(vector store)!: fix file content API (#4105) 2025-11-10 10:16:35 -08:00
distributions feat: add oci genai service as chat inference provider (#3876) 2025-11-10 16:16:24 -05:00
models fix(mypy): resolve provider utility and testing type issues (#3935) 2025-10-28 10:37:27 -07:00
providers feat: Implement the 'max_tool_calls' parameter for the Responses API (#4062) 2025-11-10 13:21:27 -08:00
strong_typing fix(mypy): part-03 completely resolve meta reference responses impl typing issues (#3951) 2025-10-29 08:07:15 -07:00
testing fix: update tests for OpenAI-style models endpoint (#4053) 2025-11-03 17:30:08 -08:00
__init__.py chore: Stack server no longer depends on llama-stack-client (#4094) 2025-11-07 09:54:09 -08:00
env.py chore(package): migrate to src/ layout (#3920) 2025-10-27 12:02:21 -07:00
log.py chore(package): migrate to src/ layout (#3920) 2025-10-27 12:02:21 -07:00
schema_utils.py chore(package): migrate to src/ layout (#3920) 2025-10-27 12:02:21 -07:00