Skip to content

OpenAI agents support #898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 58 commits into from
Jun 19, 2025
Merged

OpenAI agents support #898

merged 58 commits into from
Jun 19, 2025

Conversation

tconley1428
Copy link
Contributor

@tconley1428 tconley1428 commented Jun 12, 2025

What was changed

Added an experimental contrib module to provide compatibility with the OpenAI Agents SDK.

Why?

To facilitate durable execution for applications built with the OpenAI Agents SDK

Checklist

  1. Closes

  2. How was this tested:
    Tests provided in tests/contrib/test_openai.py

  3. Any docs updates needed?
    README provided. Further updates to the documentation are on hold while this code remains experimental.



@contextmanager
def set_open_ai_agent_temporal_overrides(**kwargs):

Choose a reason for hiding this comment

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

If possible, let's just take typed, listed keyword args for type safety and self-documentability for any args we know about.

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 think you are right, but it will take some time. Given the urgency concerns, let's leave that for another version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also agree that it would be good to do this. The SDK does already have many overloads repeating large sets of arguments; would be good to do this in a future PR.

**kwargs: Additional arguments to pass to the TemporalOpenAIRunner constructor.
These arguments are forwarded to workflow.execute_activity_method when
executing model calls. Common options include:
- start_to_close_timeout: Maximum time for the activity to complete

Choose a reason for hiding this comment

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

nit: let's name this something like model_call_start_to_close_timeout so it's clear what these apply to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would get a bit unwieldy applying to all the different kwargs, I think we'd be better off documenting them as a set

Copy link

@drewhoskins-temporal drewhoskins-temporal Jun 19, 2025

Choose a reason for hiding this comment

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

The name is too ambiguous as-is. We definitely need to do something here, soon. Johann and I were brainstorming approaches.

search_results = await self._perform_searches(search_plan)
report = await self._write_report(query, search_results)

print("\n\n=====REPORT=====\n\n")
Copy link

@drewhoskins-temporal drewhoskins-temporal Jun 18, 2025

Choose a reason for hiding this comment

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

use workflow.logger.info() instead of print, to avoid redudant prints upon replay.

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 think the effort is more to generalize taking a class like this into temporal. While it is true that the prints might not show up if you are running the workflow on a worker elsewhere, I'm hesitant to pull in a temporal dependency in this file just for logging. The print isn't really important since the result is what matters

Copy link
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

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

Nice, LGTM!

@tconley1428 tconley1428 merged commit 53d9ace into main Jun 19, 2025
34 of 37 checks passed
@tconley1428 tconley1428 deleted the openai-agents-tests branch June 19, 2025 00:04
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