Skip to content

Commit 7d6d3e6

Browse files
committed
fix: include_thought set to false in case of missing run_config
1 parent a5abf68 commit 7d6d3e6

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/google/adk/flows/llm_flows/contents.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ async def run_async(
6666
# Preserve all contents that were added by instruction processor
6767
# (since llm_request.contents will be completely reassigned below)
6868
instruction_related_contents = llm_request.contents
69+
run_config = invocation_context.run_config
6970
include_thoughts_from_other_agents = (
70-
invocation_context.run_config.include_thoughts_from_other_agents
71+
run_config.include_thoughts_from_other_agents
72+
if run_config is not None
73+
else False
7174
)
7275

7376
is_single_turn = getattr(agent, 'mode', None) == 'single_turn'
@@ -568,11 +571,13 @@ def _get_contents(
568571
e
569572
for e in rewind_filtered_events
570573
if _should_include_event_in_context(
571-
current_branch, e, isolation_scope=isolation_scope,
574+
current_branch,
575+
e,
576+
isolation_scope=isolation_scope,
572577
include_thoughts=(
573578
include_thoughts_from_other_agents
574579
and _is_other_agent_reply(agent_name, e)
575-
)
580+
),
576581
)
577582
]
578583

@@ -647,7 +652,9 @@ def _get_contents(
647652
break
648653

649654
if is_other_reply:
650-
if converted_event := _present_other_agent_message(event, include_thoughts=include_thoughts_from_other_agents):
655+
if converted_event := _present_other_agent_message(
656+
event, include_thoughts=include_thoughts_from_other_agents
657+
):
651658
filtered_events.append(converted_event)
652659
else:
653660
filtered_events.append(event)
@@ -726,7 +733,9 @@ def _get_current_turn_contents(
726733
for i in range(len(events) - 1, -1, -1):
727734
event = events[i]
728735
if _should_include_event_in_context(
729-
current_branch, event, isolation_scope=isolation_scope,
736+
current_branch,
737+
event,
738+
isolation_scope=isolation_scope,
730739
include_thoughts=(
731740
include_thoughts_from_other_agents
732741
and _is_other_agent_reply(agent_name, event)

0 commit comments

Comments
 (0)