-
Notifications
You must be signed in to change notification settings - Fork 104
Support for more activity tool inputs #923
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
base: main
Are you sure you want to change the base?
Conversation
except Exception: | ||
json_data = json.loads(input) | ||
except Exception as e: | ||
raise ApplicationError( |
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 know some of this is from old code/approaches, and I know we seem to have assumed all activity exceptions were bad input type exceptions before (incorrectly), but in general I would like to understand our exception expectations here. We usually don't fail the workflow for serialization failures by default.
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.
Good question. I'm not sure what else we could do in such a scenario.
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 just don't wrap in ApplicationError
. But may be worth asking team/internally if we think a failure in this situation should fail the workflow or fail the task.
from temporalio.workflow import ActivityCancellationType, VersioningIntent, unsafe | ||
|
||
with unsafe.imports_passed_through(): | ||
from agents import FunctionTool, RunContextWrapper, Tool | ||
from agents.function_schema import function_schema | ||
|
||
class ToolSerializationError(FailureError): |
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.
This should extend TemporalError
IMO. Only errors with proto representations should extend FailureError
.
What was changed
Processing activity tool input through the function schema's pydantic model
Why?
End users should be able to use objects and multiple arguments
Checklist
Closes
How was this tested:
New unit ttests
Any docs updates needed?