Skip to content

Conversation

@jssmith
Copy link
Contributor

@jssmith jssmith commented Jun 13, 2025

What was changed

Added samples for using Temporal with the OpenAI Agents SDK

Why?

To demonstrate how Temporal provides durable execution for applications built with the OpenAI Agents SDK

Checklist

  1. Closes

  2. How was this tested:
    Tests derived from these samples are in the Temporal Python SDK under tests/contrib/test_openai.py

  3. Any docs updates needed?
    No.

@jssmith jssmith marked this pull request as ready for review June 17, 2025 02:33
@jssmith jssmith requested a review from a team as a code owner June 17, 2025 02:33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I know some samples don't and we've been burned by this in the past, is there any way for us to add any kind of tests? The testing story with the OpenAI agents is a bit rough I understand, and can also understand if it should be a separate issue because it requires design/thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see integration tests. Unit tests would basically just duplicate what's in the Python SDK.

I've been testing manually and it's getting old.


These samples are adapted from the code in the OpenAI Agents SDK:

https://github.com/openai/openai-agents-python/tree/main/examples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic, but wonder if we want to link a certain tag here instead of main if users want to compare with the exact version we took them from (especially as they diverge in the future)

### TOOLS


@function_tool(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is mimicking an OpenAI sample it may be fine, but in general with newer samples, we're trying not to put non-deterministic things like activities inside of workflow files. This whole set of code is reloaded every workflow run/replay which means these decorators are run every workflow run/replay. We encourage workflows to be in their own files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and split it off.

Copy link
Contributor Author

@jssmith jssmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed most of the comments.

Remaining issues are:

  • Would like to have integration tests
  • May be able to to customer service example with start_update_with_start_workflow

### TOOLS


@function_tool(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and split it off.

Comment on lines +37 to +38
# Query the workflow for the chat history
# If the workflow is not open, start a new one
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some work on this but it's not 100% of the way there. I'm going to leave it alone for now.

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add tests as a follow up. It's good to have this out so people can refer to it for the recent release.

@jssmith jssmith merged commit 14d1e61 into main Jun 21, 2025
12 of 20 checks passed
@jssmith jssmith deleted the openai-agents branch June 21, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants