Add LiteLLM activity sample - #343
Merged
brianstrauch merged 3 commits intoAug 11, 2026
Merged
Conversation
brianstrauch
reviewed
Aug 3, 2026
brianstrauch
reviewed
Aug 3, 2026
There was a problem hiding this comment.
Pull request overview
Adds a new litellm_activity sample that demonstrates the Temporal best practice of performing nondeterministic LLM/provider network calls inside an Activity (not Workflow code), along with dependency wiring and deterministic tests to validate behavior without live provider calls.
Changes:
- Introduces the
litellm_activitysample (Workflow + Activity + worker/starter) with Activity timeouts and Temporal-managed retries. - Adds deterministic unit tests for both the Activity wrapper and the Workflow-to-Activity boundary.
- Registers the new sample in packaging metadata and documentation, and adds a
litellmdependency group plus lockfile entries.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds lockfile entries for the new litellm dependency group. |
| README.md | Adds the new litellm_activity sample to the repo’s sample index. |
| pyproject.toml | Registers the litellm dependency group and includes litellm_activity as a package. |
| litellm_activity/init.py | Declares the new sample package. |
| litellm_activity/activities.py | Implements the LiteLLM provider call as a Temporal Activity with a client timeout and LiteLLM retries disabled. |
| litellm_activity/shared.py | Adds a serializable request dataclass shared across starter/workflow/activity. |
| litellm_activity/workflow.py | Adds a Workflow that calls the Activity with timeouts and a bounded retry policy. |
| litellm_activity/worker.py | Adds a runnable Worker hosting the workflow and activity. |
| litellm_activity/starter.py | Adds a runnable starter to execute the workflow with CLI/env-provided inputs. |
| litellm_activity/README.md | Documents setup, provider configuration, running, and tests for the new sample. |
| tests/litellm_activity/init.py | Initializes the test package for the new sample. |
| tests/litellm_activity/activity_test.py | Unit-tests the Activity wrapper via monkeypatched LiteLLM call (no network). |
| tests/litellm_activity/workflow_test.py | Tests the Workflow execution path with a mocked Activity implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
brianstrauch
reviewed
Aug 3, 2026
brianstrauch
reviewed
Aug 3, 2026
brianstrauch
reviewed
Aug 3, 2026
brianstrauch
reviewed
Aug 3, 2026
Abhinav0905
force-pushed
the
litellm-workflow-sample
branch
from
August 8, 2026 20:44
7a2f3a7 to
d197583
Compare
Abhinav0905
force-pushed
the
litellm-workflow-sample
branch
from
August 8, 2026 20:45
d197583 to
cda04e0
Compare
Contributor
Author
|
Fixed and pushed to PR #343
<#343>.
- Addressed all seven actionable review comments.
- Rebased onto current main and resolved the conflict.
- Corrected commit identity; CLA now passes.
- PR is mergeable.
- Ruff, MyPy, lock validation, and both tests pass.
…On Mon, Aug 3, 2026 at 9:13 AM Brian Strauch ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In litellm_activity/README.md
<#343 (comment)>
:
> +# Terminal 1: run the Worker
+uv run --group litellm python -m litellm_activity.worker
+
+# Terminal 2: start a Workflow
+uv run --group litellm python -m litellm_activity.starter \
+ "Why should LLM calls run in Temporal Activities?"
⬇️ Suggested change
-# Terminal 1: run the Worker
-uv run --group litellm python -m litellm_activity.worker
-
-# Terminal 2: start a Workflow
-uv run --group litellm python -m litellm_activity.starter \
- "Why should LLM calls run in Temporal Activities?"
+# Terminal 1: run the Worker
+uv run --group litellm litellm_activity.worker
+
+# Terminal 2: start a Workflow
+uv run --group litellm litellm_activity.starter \
+ "Why should LLM calls run in Temporal Activities?"
—
Reply to this email directly, view it on GitHub
<#343?email_source=notifications&email_token=A745GZJA2TVFQUT4GQLKRW35IC23TA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBUGYZDGMJRGE22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4846231115>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A745GZIJYNSU3KFIBYGMAXD5IC23TAVCNFSNUABFKJSXA33TNF2G64TZHM2DKNBVGU3TQOBUHNEXG43VMU5TKMBUGQYDSOJTGY32C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/A745GZNBO6OPGRNVJNPLOJL5IC23TA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBUGYZDGMJRGE22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/A745GZPLM7MM3CG2NSFTU5L5IC23TA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBUGYZDGMJRGE22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Member
|
Looks good @Abhinav0905. Are you still working on this PR? It's still marked as draft, but it feels complete to me. |
Contributor
Author
|
Thanks! The implementation is complete and all checks are passing. I left it in draft by mistake; it’s ready for review. |
Abhinav0905
marked this pull request as ready for review
August 10, 2026 21:38
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
brianstrauch
approved these changes
Aug 10, 2026
tconley1428
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
litellm_activitysample with serializable Workflow inputs.Why
LLM provider calls are nondeterministic network operations and must run outside Workflow code. This sample demonstrates the Activity boundary directly while making timeouts and retry behavior visible in Temporal Event History.
Closes #239.
User impact
Users can run the sample against any LiteLLM-supported provider by setting provider credentials on the Worker and selecting a model with
LITELLM_MODEL. Credentials are not passed through the Workflow or stored in Event History.Validation
pytest tests/litellm_activity(2 passed)cc @brianstrauch