Skip to content

Commit a4fed4f

Browse files
committed
fix review comment
1 parent 276eb29 commit a4fed4f

File tree

1 file changed

+2
-1
lines changed
  • packages/agents-core/src

1 file changed

+2
-1
lines changed

packages/agents-core/src/run.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,12 @@ export class Runner extends RunHooks<any, AgentOutputType<unknown>> {
11641164
}
11651165

11661166
if (result.state._currentStep.type === 'next_step_final_output') {
1167-
await saveStreamResultToSession(options.session, result);
11681167
await this.#runOutputGuardrails(
11691168
result.state,
11701169
result.state._currentStep.output,
11711170
);
1171+
// Guardrails must succeed before persisting session memory to avoid storing blocked outputs.
1172+
await saveStreamResultToSession(options.session, result);
11721173
this.emit(
11731174
'agent_end',
11741175
result.state._context,

0 commit comments

Comments
 (0)