-
Notifications
You must be signed in to change notification settings - Fork 132
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
Conversation
… without a change to type deserialization of agent responses
|
||
|
||
@contextmanager | ||
def set_open_ai_agent_temporal_overrides(**kwargs): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM!
* Added openai_agents. * added tools and trace interceptor. * Lint error fixes * Lint error fixes * Missing docstrings added. * Fixed tool serialization. * Initial test implementation * Intercept test calls to LLM * Move to optional dependency * Linting * Fixing build errors * Fixing build errors * Fixing typo * Fake API key for test, skip below 3.11 * Tools test * Move activity to a method to allow model customization without monkey patch * Change overrides to context manager * Research workflow test * Customer service and agents as tools tests. These will currently fail without a change to type deserialization of agent responses * Fix up some imports * Remove unneeded print * Doc string improvement * Execute inside sandbox * 3.9 lint error * Add activity configuration to openai overrides and activity_as_tool * Update docstrings * Updating tests * Add experimental warnings * Remove runtime warnings * Test required import for build error * Fix import * Update open_ai_data_converter.py * Remove required import * Simplify custom data converter * Replace rebuild * Add passthrough type namespaces to data converter * Check activity count in customer_service test * cleanup dataconverter imports + doc build errors * add documentation * Fix model rebuild * update for OpenAI Agents SDK release 0.0.19 * lint fixes * fixed and elaborated on README * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Spencer Judge <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Spencer Judge <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * readme updates * Addressing PR feedback, mostly some new test validation * PR cleanup from feedback * Remove change from irrelevant file * PR cleanup * Add custom message for tool output failure * Remove commented code and unneeded sandbox statement --------- Co-authored-by: Maxim Fateev <[email protected]> Co-authored-by: Johann Schleier-Smith <[email protected]> Co-authored-by: Johann Schleier-Smith <[email protected]> Co-authored-by: Spencer Judge <[email protected]> Co-authored-by: Dan Davison <[email protected]>
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
Closes
How was this tested:
Tests provided in
tests/contrib/test_openai.py
Any docs updates needed?
README provided. Further updates to the documentation are on hold while this code remains experimental.