Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

tconley1428
Copy link
Contributor

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

  1. Closes

  2. How was this tested:
    New unit ttests

  3. Any docs updates needed?

@tconley1428 tconley1428 requested a review from a team as a code owner June 26, 2025 16:45
except Exception:
json_data = json.loads(input)
except Exception as e:
raise ApplicationError(
Copy link
Member

@cretz cretz Jun 26, 2025

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.

Copy link
Contributor Author

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.

Copy link
Member

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):
Copy link
Member

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.

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.

3 participants