Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: DABH/samples-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: temporalio/samples-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 5 commits
  • 33 files changed
  • 5 contributors

Commits on Apr 15, 2026

  1. AI-18: Move set_tracing_disabled from workflow to worker startup (tem…

    …poralio#288)
    
    * AI-18: Move set_tracing_disabled from workflow to worker startup
    
    set_tracing_disabled is a global side effect that shouldn't be called
    inside deterministic workflow code. Move it to the top of main() in the
    worker files where it runs once at process startup.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * AI-18: Add comment explaining why tracing is disabled at worker startup
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * linting
    
    ---------
    
    Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    xumaple and claude authored Apr 15, 2026
    Configuration menu
    Copy the full SHA
    29fc4af View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2026

  1. Update dependency version for temporalio 1.26.0 (temporalio#291)

    * Update dependency version for temporalio 1.26.0
    
    * Fix CI: bump pandas to 2.3.3 for Python 3.14, add opentelemetry extra for openai-agents
    
    * cleanup types in openai agents samples
    
    ---------
    
    Co-authored-by: Jason Steving <jasonmail99@gmail.com>
    tconley1428 and JasonSteving99 authored Apr 17, 2026
    Configuration menu
    Copy the full SHA
    26c1244 View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2026

  1. Configuration menu
    Copy the full SHA
    1161aa4 View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2026

  1. Add LangSmith tracing sample (temporalio#292)

    * Add LangSmith tracing sample with basic and chatbot examples
    
    Demonstrates the LangSmithPlugin for automatic LangSmith tracing in
    Temporal workflows. Includes two examples:
    - basic/: one-shot LLM workflow (prompt → OpenAI → result)
    - chatbot/: conversational loop with save_note/read_note tools,
      signals, queries, and dynamic trace names
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Enrich LangSmith tracing usage across basic and chatbot samples
    
    - Add @Traceable with metadata, tags, and run_type variety to workflows
    - Add client-side @Traceable on starters for end-to-end trace linking
    - Add --temporal-runs flag to workers and starters for add_temporal_runs toggle
    - Use run_type="llm" for OpenAI calls, "tool" for save_note, "chain" for orchestration
    - Add trace tree diagrams to README showing both add_temporal_runs modes
    - Add "Three Layers of Tracing" section to README (wrap_openai, @Traceable, Temporal plugin)
    - Skip all tests when temporalio.contrib.langsmith is unavailable (pending SDK release)
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Address review feedback: READMEs, comments, activity conventions
    
    - Split top-level README into per-sample READMEs (basic/ and chatbot/)
      with detailed trace structure diagrams and screenshot placeholders
    - Add replay safety comment on @workflow.run methods explaining why
      @Traceable must wrap an inner function
    - Make read_note a proper activity for LangSmith trace visibility
    - Change save_note/read_note to use NoteRequest dataclass (single arg)
    - Fix misplaced comments in activities (wrap_openai, run_type docs)
    - Add links to LangSmith docs and Temporal SDK plugin docs
    - Add add_temporal_runs explanation section to top-level README
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Address audit findings: types, comments, tests, consistency
    
    Audit findings addressed:
    - Remove max_cached_workflows=0 (debugging leftover, not needed)
    - Expand replay safety comment to explain why (I/O on replay)
    - Tighten type annotations: str|list[dict[str,Any]], dict[str,Any]
    - Clarify read_note docstring (passthrough for tracing visibility)
    - Clarify activity docstrings (retries handled by Temporal, not OpenAI)
    - Make trace tree annotations consistent across basic/chatbot READMEs
    - Extract shared test helpers (make_text_response, poll_last_response)
    - Add TimeoutError on poll failure instead of silent assertion
    - Fix "simplest possible" wording to "very simple"
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Rewrite replay safety comment to focus on outcome
    
    Changed from explaining internals (I/O on replay) to describing what
    the user would see: duplicate or orphaned traces. Also swept all other
    comments for outcome-focus — no further changes needed.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Move save_note/read_note from activities to workflow methods
    
    - save_note and read_note are now @Traceable methods on ChatbotWorkflow,
      not activities. Notes live in workflow state (durable via event history).
    - Remove NoteRequest dataclass and activity registrations
    - Fix wrap_openai comment placement (describes child span, not parent)
    - Remove retry policy from basic workflow (unnecessary for simple example)
    - Add comment highlighting that non-@workflow.run methods can use @Traceable
    - Update chatbot README trace trees to reflect workflow methods vs activities
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Remove screenshot placeholders, rename flag to --add-temporal-runs
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Clean up tests, naming, and dependencies
    
    - Remove skip markers from tests — CI should fail loudly if deps missing
    - Pin temporalio[pydantic,langsmith]>=1.26.0 (plugin is released)
    - Rename kwargs to response_args in chatbot activity
    - Remove notes CLI command from chatbot starter
    - Update chatbot README trace trees for accuracy
    - Change input prompt from "You: " to "> "
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Fix README trace trees to match actual integration test hierarchies
    
    - StartWorkflow/RunWorkflow are siblings, not parent-child
    - StartActivity/RunActivity are siblings under RunWorkflow
    - @Traceable activity spans nest under RunActivity
    - Signal/query traces are separate roots (or under client @Traceable)
    - Merge client-side and worker-side into unified trees
    - add_temporal_runs=False: only @Traceable spans, all under client root
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Add openai-agents to conflicting groups for langsmith-tracing
    
    temporalio>=1.26.0 requires openai-agents>=0.14.0 but the openai-agents
    group pins ==0.3.2, causing a resolution failure.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * Fix run commands to include --group langsmith-tracing
    
    Without the group flag, uv resolves the base temporalio dep (1.23.0)
    which doesn't have contrib.langsmith.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    
    * fix tracing project
    
    * Address PR review comments and refine chatbot architecture
    
    - Simplify basic/worker.py to use asyncio.run(main()) pattern
    - Basic activity now returns str instead of Response (drops pydantic dep)
    - Remove pydantic_data_converter from basic worker/starter
    - Replace chatbot signal+poll with update handler (message_from_user)
    - Wrap update handler body in @Traceable for input/output capture
    - Inline RetryPolicy in chatbot workflow (no separate RETRY constant)
    - Add comment about alternative traceable() function-call style
    - Make PROJECT_NAME a shared constant in starters, pass to client-side
      @Traceable so traces go to the right LangSmith project
    - Update READMEs with correct trace hierarchies based on real output
    - Fix wrap_openai span name (ChatOpenAI, not openai.responses.create)
    - Simplify tests (mocks match new str return type, use execute_update)
    - Remove poll_last_response helper
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    
    * Remove langchain sample, fix CI by relaxing openai version pin
    
    The langchain sample's langsmith<0.4 pin conflicts with langsmith-tracing's
    langsmith>=0.7.0. The langchain sample uses an older custom-interceptor
    approach that's superseded by the new LangSmithPlugin demonstrated in
    langsmith_tracing/. Removing it eliminates the dep conflict and the
    related [tool.uv] conflicts declaration.
    
    Also relax openai pin from <2 to no upper bound so it resolves alongside
    the openai-agents group (which now requires openai>=2.26.0).
    
    Add inline comment on max_retries=0 explaining Temporal handles retries.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    xumaple and claude authored Apr 22, 2026
    Configuration menu
    Copy the full SHA
    b199e50 View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2026

  1. LangSmith sample: starter cleanup, plugin on Worker, chatbot Response…

    … decoupling (temporalio#295)
    
    * Clean up LangSmith sample per PR temporalio#292 review
    
    - basic/starter.py: move `@traceable` decorator directly onto `main`,
      removing the nested `run_workflow` closure (addresses reviewer comment)
    - basic/worker.py, chatbot/worker.py: move `LangSmithPlugin` from the
      `Client` to the `Worker`, matching our recommended pattern (plugin on
      the worker in worker code; on the client in client code)
    
    * Return workflow result from basic starter's main
    
    @Traceable captures the decorated function's return value as the
    LangSmith trace output, so implicitly returning None left the trace's
    output field empty. Return `result` (and annotate the return type) so
    the trace shows the workflow response.
    
    * Return minimal ChatResponse from chatbot call_openai activity
    
    The activity previously returned `openai.types.responses.Response`
    directly. The OpenAI API currently returns
    `"prompt_cache_retention": "in_memory"` (underscore), but openai SDK
    v2.32.0 declares that field as `Literal["in-memory", "24h"]`. The openai
    client parses laxly so the activity succeeds, but Temporal's
    `pydantic_data_converter` uses strict `TypeAdapter(Response).validate_json`
    on the way into the workflow and rejects the underscore value, failing
    every workflow task.
    
    Define minimal `ChatResponse` and `ToolCall` pydantic models in
    `activities.py` exposing only the fields the workflow uses (id,
    output_text, tool_calls). The activity projects the openai Response
    down to this shape so the sample is no longer coupled to SDK drift in
    fields it doesn't use.
    
    Update the workflow loop to iterate `response.tool_calls` directly and
    the test mocks/helpers to build `ChatResponse` instead of constructing
    openai Response objects.
    xumaple authored Apr 23, 2026
    Configuration menu
    Copy the full SHA
    ba9e9a1 View commit details
    Browse the repository at this point in the history
Loading