Skip to content

Commit 3e7f91b

Browse files
committed
Fix import sorting and formatting
1 parent 042a51f commit 3e7f91b

6 files changed

Lines changed: 14 additions & 32 deletions

File tree

langgraph_plugin/functional_api/continue_as_new/workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ class PipelineFunctionalWorkflow:
6565

6666
@workflow.run
6767
async def run(self, input_data: PipelineInput) -> dict[str, Any]:
68-
result = await entrypoint(
69-
"pipeline", cache=input_data.cache
70-
).ainvoke(input_data.data)
68+
result = await entrypoint("pipeline", cache=input_data.cache).ainvoke(
69+
input_data.data
70+
)
7171

7272
if input_data.phase < 3:
7373
workflow.continue_as_new(

langgraph_plugin/functional_api/control_flow/workflow.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ def summarize(results: list[str]) -> str:
4444
urgent_count = sum(1 for r in results if r.startswith("[PRIORITY]"))
4545
normal_count = sum(1 for r in results if r.startswith("[STANDARD]"))
4646
return (
47-
f"Processed {len(results)} items "
48-
f"({urgent_count} urgent, {normal_count} normal)"
47+
f"Processed {len(results)} items ({urgent_count} urgent, {normal_count} normal)"
4948
)
5049

5150

@@ -58,9 +57,7 @@ async def control_flow_pipeline(items: list[str]) -> dict:
5857
# Creating task futures without awaiting launches them in parallel.
5958
validation_futures = [validate_item(item) for item in items]
6059
valid_flags = [await f for f in validation_futures]
61-
valid_items = [
62-
item for item, is_valid in zip(items, valid_flags) if is_valid
63-
]
60+
valid_items = [item for item, is_valid in zip(items, valid_flags) if is_valid]
6461

6562
# SEQUENTIAL + CONDITIONAL: Process each valid item
6663
results = []

langgraph_plugin/functional_api/human_in_the_loop/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from datetime import timedelta
77
from typing import Any
88

9+
from langchain_core.runnables import RunnableConfig
910
from langgraph.checkpoint.memory import InMemorySaver
1011
from langgraph.func import entrypoint as lg_entrypoint
1112
from langgraph.func import task
1213
from langgraph.types import Command, interrupt
13-
from langchain_core.runnables import RunnableConfig
1414
from temporalio import workflow
1515
from temporalio.contrib.langgraph import entrypoint
1616

langgraph_plugin/functional_api/react_agent/workflow.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def agent_think(query: str, history: list[str]) -> dict:
3737
facts = "; ".join(tool_results)
3838
return {
3939
"action": "final",
40-
"answer": (
41-
f"Here's what I found about San Francisco: {facts}"
42-
),
40+
"answer": (f"Here's what I found about San Francisco: {facts}"),
4341
}
4442

4543

@@ -48,9 +46,7 @@ def execute_tool(tool_name: str, tool_input: str) -> str:
4846
"""Execute a tool by name. In production, dispatch to real implementations."""
4947
tool_registry = {
5048
"get_weather": lambda inp: f"[Tool] Weather in {inp}: 72°F and sunny.",
51-
"get_population": lambda inp: (
52-
f"[Tool] {inp} population: ~870,000 residents."
53-
),
49+
"get_population": lambda inp: f"[Tool] {inp} population: ~870,000 residents.",
5450
}
5551
handler = tool_registry.get(tool_name)
5652
if handler:
@@ -69,9 +65,7 @@ async def react_agent_entrypoint(query: str) -> dict:
6965
if decision["action"] == "final":
7066
return {"answer": decision["answer"], "steps": len(history)}
7167

72-
result = await execute_tool(
73-
decision["tool_name"], decision["tool_input"]
74-
)
68+
result = await execute_tool(decision["tool_name"], decision["tool_input"])
7569
history.append(result)
7670

7771

langgraph_plugin/graph_api/human_in_the_loop/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
from datetime import timedelta
88

9+
from langchain_core.runnables import RunnableConfig
910
from langgraph.checkpoint.memory import InMemorySaver
1011
from langgraph.graph import START, StateGraph
1112
from langgraph.types import Command, interrupt
12-
from langchain_core.runnables import RunnableConfig
1313
from temporalio import workflow
1414
from temporalio.contrib.langgraph import graph
1515

langgraph_plugin/graph_api/react_agent/workflow.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ async def agent(state: AgentState) -> dict[str, Any]:
4141
if len(tool_results) == 0:
4242
return {
4343
"messages": [
44-
"[Agent] I need weather data. "
45-
"Calling get_weather for San Francisco."
44+
"[Agent] I need weather data. Calling get_weather for San Francisco."
4645
]
4746
}
4847
elif len(tool_results) == 1:
@@ -56,9 +55,7 @@ async def agent(state: AgentState) -> dict[str, Any]:
5655
facts = "; ".join(tool_results)
5756
return {
5857
"messages": ["[Agent] I have all the information I need."],
59-
"final_answer": (
60-
f"Here's what I found about San Francisco: {facts}"
61-
),
58+
"final_answer": (f"Here's what I found about San Francisco: {facts}"),
6259
}
6360

6461

@@ -67,15 +64,9 @@ async def tools(state: AgentState) -> dict[str, Any]:
6764
last_msg = state["messages"][-1]
6865

6966
if "get_weather" in last_msg:
70-
return {
71-
"messages": ["[Tool] Weather in San Francisco: 72°F and sunny."]
72-
}
67+
return {"messages": ["[Tool] Weather in San Francisco: 72°F and sunny."]}
7368
elif "get_population" in last_msg:
74-
return {
75-
"messages": [
76-
"[Tool] San Francisco population: ~870,000 residents."
77-
]
78-
}
69+
return {"messages": ["[Tool] San Francisco population: ~870,000 residents."]}
7970
else:
8071
return {"messages": ["[Tool] Unknown tool requested."]}
8172

0 commit comments

Comments
 (0)