Workflow utilities for Google ADK agents integration with Temporal.
| Class | |
Serializable snapshot of the ADK ToolContext for activity-backed tools. |
| Function | activity |
Decorator/Wrapper to wrap a Temporal Activity as an ADK Tool. |
| Function | _adk |
Builds the error for a parameter annotated with a live ADK context. |
| Function | _annotation |
Renders annotation members for error messages. |
| Function | _annotation |
Returns a union annotation's members, or the annotation itself. |
| Function | _snapshot |
Builds the serializable snapshot from a live ADK ToolContext. |
| Function | _tool |
Validates context-related parameters and returns the tool_context one. |
| Function | _validated |
Returns the tool_context parameter after validating its annotation. |
| Constant | _TOOL |
Undocumented |
Decorator/Wrapper to wrap a Temporal Activity as an ADK Tool.
Warning
This function is experimental and may change in future versions. Use with caution in production environments.
This ensures the activity's signature is preserved for ADK's tool schema generation while marking it as a tool that executes via 'workflow.execute_activity'.
If the activity declares a parameter named tool_context, it must be
annotated with ToolContextSnapshot (or ToolContextSnapshot |
None). ADK excludes the parameter from the tool schema and injects the
live ToolContext into the wrapper, which passes the activity a
serializable snapshot of it (session state and function-call id) in that
parameter's position. Annotating any parameter with a live ADK context
type raises ValueError at wrap time, since ADK would inject the
non-serializable context into it regardless of its name.
Callable, name: str, annotation_name: str) -> ValueError:
(source)
¶
Builds the error for a parameter annotated with a live ADK context.
Validates context-related parameters and returns the tool_context one.
ADK injects the live context into the first parameter annotated with an
ADK context type (regardless of name), or failing that into one named
tool_context, and excludes that parameter from the LLM-facing tool
schema. Live context objects cannot cross the activity boundary, so the
only supported declaration is a parameter named tool_context annotated
with ToolContextSnapshot (or ToolContextSnapshot | None);
anything else ADK would treat as a context parameter is rejected at wrap
time, as is a misplaced ToolContextSnapshot annotation that would leak
into the tool schema.
Callable, parameter: inspect.Parameter, members: tuple[ Any, ...]) -> inspect.Parameter:
(source)
¶
Returns the tool_context parameter after validating its annotation.
The parameter must be annotated with ToolContextSnapshot or
ToolContextSnapshot | None.