Repository navigation
Move the AI integration samples to the GA packages #429
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?
Changes from all commits
9efa6c8
522c78c
a063813
c45333e
01d5d3c
0a011f8
e1a5b53
f2e004f
73a8ec3
4a9a36a
0c1ee61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ | |
| }, | ||
| { | ||
| "name": "TEMPORAL_BUILD_ID", | ||
| "value": "1.0.0" | ||
| "value": "1.1.0" | ||
| }, | ||
| { | ||
| "name": "AWS_REGION", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| """Register the external-storage tool before the Worker starts.""" | ||
|
|
||
| from datetime import timedelta | ||
|
|
||
| from langchain_core.tools import tool | ||
| from temporalio.common import RetryPolicy | ||
| from temporalio.deepagents import tool_as_activity | ||
|
|
||
| PAYLOAD_BYTES = 6 * 1024 * 1024 | ||
|
|
||
|
|
||
| @tool | ||
| async def read_file(file_path: str) -> str: | ||
| """Read a mock document containing exactly 6 MiB of text.""" | ||
| del file_path | ||
| return "x" * PAYLOAD_BYTES | ||
|
|
||
|
|
||
| reader = tool_as_activity( | ||
| read_file, | ||
| start_to_close_timeout=timedelta(seconds=30), | ||
| activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """Tools for the human-in-the-loop sample. | ||
|
|
||
| ``tool_as_activity(...)`` registers the tool in the worker process, so call it | ||
| here at module level and import this module in the workflow file under | ||
| ``workflow.unsafe.imports_passed_through()``. | ||
|
|
||
| Options are resolved when the tool is wrapped, before this sample creates | ||
| the plugin. | ||
| """ | ||
|
|
||
| from datetime import timedelta | ||
|
|
||
| from temporalio.deepagents import tool_as_activity | ||
|
|
||
|
|
||
| def book_trip(city: str) -> str: | ||
| """Book a trip to a city (requires human approval).""" | ||
| return f"Booked a trip to {city}." | ||
|
|
||
|
|
||
| trip_tool = tool_as_activity(book_trip, start_to_close_timeout=timedelta(seconds=30)) | ||
|
Comment on lines
+16
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this get a SNIPSTART block like react_agent/tools.py? With the docs follow-up, the HITL page imports |
||
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.
How would someone keep 1.0.0 available with this setup? The sample has one runtime with one
temporalendpoint, and step 3 says to re-run create-runtime.sh to roll out changes. Could this say what to deploy for the new Build ID?