If we specify output_schema here for our agent and provide tools for it to call - you will notice that tool calling stops and other times it return default python model (using default values) :-
pipeline_runner = LlmAgent(
name="pipeline_runner",
model=MODEL,
description=(
"Runs and coordinates the delivery pipeline from dev to test to "
"pre-prod to prod, enforcing promotion gates between stages."
),
instruction=RUNNER_INSTRUCTION,
output_schema=PipelineRunReport,
tools=[run_pipeline_stage, get_stage_status, get_stage_logs],
output_key="pipeline_run_report",
)
And this is our agentic setup:-
pipeline_coordinator = SequentialAgent(
name="pipeline_coordinator",
description=(
"Coordinates a pipeline run: execute stages, log what happened, "
"then recommend optimizations."
),
sub_agents=[pipeline_runner],
)
And spits out the followings:-
And you might ask what will happened to the next agent who will be using this data?
In the most ideal case when output keys is configure or set - this is what it looks like. You can see that it will come out exactly as the format specified by your prompt - as we can see here:-
This is the situation when set st the output_schema and google adk no longer maintain the structure anymore and just use the default values in our schema.
Impact to subsequent agent - well pipeline issue logger just stop working.
And this is what we can use to output the keys used by our agents :-
# The hand-off values written by output_key are also in session state.
session = await runner.session_service.get_session(
app_name=APP_NAME, user_id=USER_ID, session_id=session.id
)
print("\n=== state keys written ===")
for key in ("pipeline_run_report", "pipeline_issue_log", "pipeline_optimizations"):
value = session.state.get(key)
print(f"\n----- {key} -----")
if value is None:
print("MISSING")
elif isinstance(value, (dict, list)):
print(json.dumps(value, indent=2, default=str))
else:
print(value)
print("\n=== final answer ===")
print(final_answer or "(no text from pipeline_optimizer, check the events above)")
Comments