Closed
Conversation
- Add langgraph_samples/basic/hello_world/ demonstrating basic Temporal + LangGraph integration with a single-node graph - Add langgraph dependency group to pyproject.toml - Update langchain dependency group to 0.3.x for compatibility with langgraph (requires langchain-core>=0.2.27)
Document the ReAct agent sample showing durable tool execution with temporal_tool() and the think-act-observe pattern.
Update all run_worker.py and run_workflow.py files to use the ClientConfig.load_client_connect_config() pattern for environment-based configuration support. Also simplify react_agent run_workflow.py to run a single query with clean output. Add CLAUDE.md documenting the client initialization pattern.
Add remaining sample files: - react_agent: graph, tools, workflow definitions - approval_workflow: graph, workflow with human-in-the-loop pattern
…ADME - Add comprehensive README for human_in_loop/approval_workflow sample - Update react_agent README to reflect simplified single-query output
…l_workflow - Add notify_approver activity that prints approval instructions with workflow ID - Add run_respond.py CLI tool for approvers to approve/reject workflows - Update workflow to call notification activity when hitting interrupt - Simplify run_workflow.py to start one workflow and wait for result - Update README with 3-terminal workflow instructions
…act_agent The react_agent sample was using ChatOpenAI directly without wrapping it with temporal_model(), meaning LLM calls were not durable. Now both LLM calls and tool invocations run as Temporal activities.
Use the new Temporal-provided create_durable_react_agent which: - Automatically wraps model and tools for durable execution - Runs agent nodes inline in workflow with model/tool calls as activities
Use the new model_activity_options and tool_activity_options parameters with activity_options() instead of the old individual timeout parameters.
Update react_agent sample to use LangGraph's native create_react_agent instead of the removed create_durable_react_agent wrapper. The Temporal integration now works directly with native LangGraph APIs - each node runs as a Temporal activity, providing durability without special wrappers.
…c loop - Change query to require multiple tool calls (weather + temperature conversion) - Remove unused search_knowledge tool, keep only get_weather and calculate - Update README to document multi-step reasoning behavior
- Add agentic_rag sample with document grading and query rewriting - Add README files for human_in_loop and RAG sample categories - Update main README to link to all sample categories - Add langchain and langchain-openai dependencies for RAG sample
Update installation instructions to reflect that the LangGraph integration is currently available as a preview feature in branch repositories: - SDK: mfateev/sdk-python@langgraph-plugin - Samples: mfateev/samples-python@langgraph_plugin
create_agent always returns a compiled graph, so no need for defensive compile() call with hasattr check.
…t_agent - Update imports from langgraph.prebuilt to langchain.agents - Change prompt parameter to system_prompt - Add multi_agent/supervisor sample - Document the correct API in CLAUDE.md
- Deep Research Agent: Multi-step research with parallel search execution using Send API, result evaluation, and report synthesis - Plan-and-Execute Agent: Structured planning with sequential step execution, dynamic replanning, and tool integration - Reflection Agent: Generate-critique-revise loop with quality scoring and iterative improvement until criteria met
- Update all README files to use `uv run` format for running scripts - Remove redundant Usage sections from run_*.py files - Keep usage documentation centralized in README files only
- Replace mock search results with real DuckDuckGo web search - Add langchain-community and duckduckgo-search dependencies - Update README to reflect real search functionality - Add error handling for failed searches
Move all samples from nested category directories to top level: - basic/hello_world -> hello_world - basic/react_agent -> react_agent - human_in_loop/approval_workflow -> approval_workflow - multi_agent/supervisor -> supervisor - rag/agentic_rag -> agentic_rag - rag/deep_research -> deep_research - planning/plan_and_execute -> plan_and_execute - advanced/reflection -> reflection Update all import paths accordingly and refresh README.md with a table listing all samples.
- Fix import sorting (I001) across all sample modules - Apply ruff formatting to 11 files - Add type annotations for mypy (executor_agent, critique, plan) - Use cast() for structured output return types
- Test basic workflow execution with query processing - Test empty query handling - Add fixture to clear global registry between tests
Tests: - Added tests for all LangGraph samples (hello_world, approval_workflow, react_agent, supervisor, agentic_rag, deep_research, plan_and_execute, reflection) - Added conftest.py with shared fixtures (clear_registry, requires_openai) - Tests requiring OpenAI API are skipped when OPENAI_API_KEY is not set Bug fixes: - Fixed serialization bugs in reflection and plan_and_execute samples - After Temporal serialization, Pydantic models become dicts - Added helper functions to handle both object and dict access for: - Critique objects in reflection sample - Plan, PlanStep, StepResult objects in plan_and_execute sample
Shows how to call Temporal activities directly from a LangGraph node using the run_in_workflow=True metadata option.
…oaches - approval_workflow_interrupt: Uses LangGraph interrupt() with workflow signal handling - approval_workflow_signal: Uses run_in_workflow=True to handle signals in graph node
- Renamed approval_workflow_signal to approval_workflow_condition - Both samples now in langgraph_samples/human_in_the_loop/ - Updated all import paths and documentation
Update design to run @entrypoint functions directly in Temporal workflow sandbox instead of activities. This works because: - LangGraph modules passed through sandbox (langgraph, langchain_core, etc.) - @task calls routed to activities via CONFIG_KEY_CALL injection - Sandbox enforces determinism (time, random rejected) - Aligns with LangGraph checkpoint/replay model
Restructure LangGraph samples based on official LangGraph API terminology: - graph_api/: StateGraph-based examples using nodes and edges - hello_world, react_agent, reflection, supervisor - agentic_rag, deep_research, plan_and_execute - activity_from_node, human_in_the_loop - functional_api/: @task/@entrypoint decorator-based examples - Document creation workflow demonstrating tasks and entrypoints Updated all imports in sample files and tests to reflect new paths. Added comparison table in README explaining Graph API vs Functional API.
Replace the single functional API proposal with 8 individual samples that mirror the graph API structure: - hello_world: Basic @task and @entrypoint usage - react_agent: ReAct pattern with tool calling - human_in_the_loop: Approval workflow using interrupt() - supervisor: Multi-agent coordination - agentic_rag: RAG with document grading - deep_research: Parallel search execution - plan_and_execute: Step-by-step task execution - reflection: Iterative content improvement Each sample follows a consistent structure with tasks.py, entrypoint.py, workflow.py, run_worker.py, and run_workflow.py. Also add pre-commit check reminder to CLAUDE.md.
Updated test assertions to use the actual keys returned by entrypoints: - deep_research: sources_count -> relevant_results - plan_and_execute: response -> final_response, steps_completed -> step_results - reflection: content -> final_content - supervisor: final_report -> final_answer, agents_used -> agent_outputs Also added design decision guideline to CLAUDE.md: never jump to implementation when presenting multiple design options.
- Graph API usage with StateGraph, nodes, edges, and plugin setup - Functional API usage with @task, @entrypoint, and plugin setup - Key differences table comparing both approaches - Configuration options for per-node/per-task activity settings
Documents key changes required: - Use await instead of .result() for task calls - Entrypoints must be async functions - Tasks must be at module level (importable) - Complete before/after migration example - Summary table of changes
Each sample now has its own README explaining: - Overview and architecture diagram - Key code patterns with examples - Why Temporal adds value - Running instructions - Customization examples Samples documented: - hello_world: Basic @entrypoint and @task usage - react_agent: Tool-calling agent with observation loop - reflection: Generate-critique-revise iteration - agentic_rag: Adaptive retrieval with query rewriting - deep_research: Parallel search and synthesis - plan_and_execute: Structured plan execution - supervisor: Multi-agent coordination - human_in_the_loop: interrupt() for approval workflows
| graphs={"my_graph": graph}, | ||
| default_start_to_close_timeout=timedelta(minutes=5), | ||
| node_options={ | ||
| "expensive_node": {"start_to_close_timeout": timedelta(minutes=30)} |
Contributor
There was a problem hiding this comment.
Worth adding a sample for this, or incorporating into a sample?
There was a problem hiding this comment.
Is the suggestion here to add a sample for an "expensive node"? What's the significance of an expensive node?
- Use `activity_options()` helper for node metadata - Fix `node_options` -> `per_node_activity_options` - Fix `default_start_to_close_timeout` -> `default_activity_timeout` - Show proper import and usage patterns
Demonstrates per-node activity configuration using activity_options(): Direct node metadata (graphs using add_node directly): - hello_world: Simple 30s timeout for process node - reflection: 2min timeouts for LLM nodes, 30s for finalize - deep_research: Varied timeouts (plan 2min, search 1min, synthesize 3min) - agentic_rag: 1-2min timeouts for grading/generation nodes - plan_and_execute: 2min for planning, 30s for evaluation - activity_from_node: 30s for finalize activity node - human_in_the_loop: 30s timeouts for approval nodes Documentation for pre-built graphs (create_agent/create_supervisor): - react_agent: Docstring shows per_node_activity_options usage - supervisor: Docstring shows multi-agent configuration
- Add activity_options() to plugin registration in all run_worker.py files
- Demonstrate workflow-level override in human_in_the_loop sample
- Update README with activity_options() examples for Functional API
activity_options() can be specified at two levels:
1. Plugin level: LangGraphFunctionalPlugin(task_options={...})
2. Workflow level: compile_functional(task_options={...}) - overrides plugin
- Replace LangGraphFunctionalPlugin with unified LangGraphPlugin - Change entrypoints= to graphs= parameter - Change task_options= to activity_options= parameter - Use activity_options() helper for default_activity_options - Update compile_functional() to compile() in workflows - Update all tests to use unified API
Demonstrates task result caching across continue-as-new boundaries: - Phase 1: Execute tasks 1-3, cache results, continue-as-new - Phase 2: Execute all 5 tasks (1-3 use cached results) Shows how get_state() and compile(checkpoint=...) preserve task results across workflow executions.
Aligns the Functional API sample with the Graph API pattern: - Use should_continue callback to control checkpointing - Check CHECKPOINT_KEY in result instead of manual phase tracking - Simplify entrypoint to have no knowledge of continue-as-new - Update run_workflow.py with new input parameters
Paths now correctly reference langgraph_plugin/graph_api/... instead of langgraph_plugin/... to match the reorganized sample directory structure.
- temporal_langgraph_architecture: Graph API (StateGraph) architecture - temporal_functional_architecture: Functional API (@task/@entrypoint) architecture Both provided as SVG and PNG formats for use in documentation and presentations.
|
Closing in favor of #289 |
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.
Summary
Add LangGraph samples demonstrating the Temporal LangGraph integration for durable AI agent workflows.
Samples Included
Key Features Demonstrated
Prerequisites
Running
Related PR