Skip to content

Conversation

@cdoern
Copy link
Collaborator

@cdoern cdoern commented Jan 27, 2026

What does this PR do?

Add OpenAI-compatible background mode for the Responses API, allowing responses to be queued for asynchronous processing.

  • Added background parameter (bool, default: false)

  • When true, returns immediately with status "queued"

  • Added background field to OpenAIResponseObject

  • New status values: "queued", "in_progress", "cancelled"

  • OpenAI-compatible endpoint for cancelling background responses

  • Only works for responses created with background=true

  • Only cancellable when status is "queued" or "in_progress"

  • agents/models.py: Added background to CreateResponseRequest, new CancelResponseRequest

  • agents/api.py: Added cancel_openai_response to Agents protocol

  • agents/fastapi_routes.py: Added cancel route

  • openai_responses.py: Added background field to response object

  • openai_responses.py: Background processing with _create_background_response and _process_background_response

  • responses_store.py: Added update_response_object for status updates

closes #4701

Test Plan

new unit and integration tests (with stainless builds) should pass. The integration tests represent the testing for the new API changes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 27, 2026
@cdoern cdoern changed the title feat: add support for /responses background parameter feat: add support for /responses background parameter Jan 27, 2026
@cdoern cdoern force-pushed the responses-background branch from 851633d to b531423 Compare January 27, 2026 18:36
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

feat: add support for /responses background parameter

Edit this comment to update it. It will appear in the SDK's changelogs.

⚠️ llama-stack-client-node studio · code · diff

There was a regression in your SDK.
generate ⚠️build ✅lint ✅test ❗

npm install https://pkg.stainless.com/s/llama-stack-client-node/5c506feaa699016cc2448f0247df20fc5467e240/dist.tar.gz
New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `post /v1/responses/{response_id}/cancel` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
⚠️ llama-stack-client-openapi studio · code · diff

There was a regression in your SDK.
generate ⚠️lint ⏳test ⏳

New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `post /v1/responses/{response_id}/cancel` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
llama-stack-client-kotlin studio

Code was not generated because there was a fatal error.

⚠️ llama-stack-client-python studio · conflict

There was a regression in your SDK.

New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `post /v1/responses/{response_id}/cancel` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
⚠️ llama-stack-client-go studio · conflict

There was a regression in your SDK.

New diagnostics (1 warning)
⚠️ Endpoint/NotConfigured: `post /v1/responses/{response_id}/cancel` exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
Last updated: 2026-01-27 18:47:19 UTC

@cdoern cdoern force-pushed the responses-background branch from b531423 to fb4b986 Compare January 27, 2026 19:14
Add OpenAI-compatible background mode for the Responses API, allowing
responses to be queued for asynchronous processing.

- Added `background` parameter (bool, default: false)
- When true, returns immediately with status "queued"

- Added `background` field to `OpenAIResponseObject`
- New status values: "queued", "in_progress", "cancelled"

- OpenAI-compatible endpoint for cancelling background responses
- Only works for responses created with background=true
- Only cancellable when status is "queued" or "in_progress"

- `agents/models.py`: Added `background` to `CreateResponseRequest`, new `CancelResponseRequest`
- `agents/api.py`: Added `cancel_openai_response` to Agents protocol
- `agents/fastapi_routes.py`: Added cancel route
- `openai_responses.py`: Added `background` field to response object

- `openai_responses.py`: Background processing with `_create_background_response` and `_process_background_response`
- `responses_store.py`: Added `update_response_object` for status updates

- Issue: llamastack#4701
- OpenAI docs: https://platform.openai.com/docs/guides/background

Signed-off-by: Charlie Doern <cdoern@redhat.com>
@cdoern cdoern force-pushed the responses-background branch from fb4b986 to 1d39612 Compare January 28, 2026 14:05
@mergify
Copy link

mergify bot commented Jan 30, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @cdoern please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Responses API: Add background parameter support

1 participant