Repository navigation
Python: Register declarative workflow types for checkpoint restore - #10076
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:36 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:36 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The duplicate test module basename causes pytest collection to fail with an import-file-mismatch error when both suites are collected, so the module needs a unique name.
1 open issue
What changed in this PR
This PR addresses #10074 by registering declarative workflow types for restricted checkpoint decoding, following the orchestration approach in #8258 without widening the core allowlist.
Changes:
- Registers 13 framework-owned message, request, response, and state types on import.
- Adds file-backed round-trip tests and a paused-workflow restore/resume test.
- Corrects the
FileCheckpointStorageconstructor call in the factory docstring.
| File | Description |
|---|---|
python/packages/declarative/tests/test_checkpoint_types.py |
Adds checkpoint round-trip and pause/resume regression tests. |
python/packages/declarative/agent_framework_declarative/_workflows/_factory.py |
Fixes the checkpointing documentation example. |
python/packages/declarative/agent_framework_declarative/_workflows/__init__.py |
Registers declarative types for restricted checkpoint decoding. |
Review effort: Balanced
| @@ -0,0 +1,164 @@ | |||
| # Copyright (c) Microsoft. All rights reserved. | |||
|
|
|||
| """Built-in declarative workflow types must survive a checkpoint round trip. | |||
This branch was previously deployed
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.

Motivation & Context
A declarative workflow that uses
FileCheckpointStoragesaves only its first checkpoint. Every later save logsCheckpoint deserialization blocked for type 'agent_framework_declarative._workflows._declarative_base:ActionComplete'and is skipped. The run continues, so nothing raises. But the checkpoint taken while the workflow waits for input is never stored, so a paused workflow can't be resumed from storage. Restoring the latest checkpoint returns the iteration-0 one, and the response then fails withResponse provided for unknown request ID.This is the same gap #8258 closed for orchestrations. The restricted unpickler trusts
agent_framework.andagent_framework_orchestrations., but not this package, so users have had to list framework-internal module paths inallowed_checkpoint_types. Details and a repro are in #10074.Description & Review Guide
agent_framework_declarative._workflowsregisters its checkpoint-crossing types with the publicregister_checkpoint_typeon import, the same wayagent_framework_orchestrationsdoes. Each type is listed for a stated reason:ActionTrigger,ActionComplete,ConditionResult,LoopIterationResult,LoopControlrequest_infopayloads and responses:ExternalInputRequest/Response,AgentExternalInputRequest/Response,ToolApprovalRequest/Response,MCPToolApprovalRequestExternalLoopState, which is kept in workflow state while an agent's external input loop is pausedWorkflowFactorydocstring's checkpointing example calledFileCheckpointStorage(path=...), which raisesTypeError. It now passes the path positionally.FileCheckpointStorage(and other restricted-decoding storages) without a user-maintained allowlist. Existing allowlists keep working.send_message,request_infoorctx.state.set. Types that only travel as coreMessage/Contentvalues are already trusted.Tests (
packages/declarative/tests/test_checkpoint_types.py), all using aFileCheckpointStoragewith noallowed_checkpoint_types:RequestExternalInput. The test checks that every checkpoint file on disk decodes, restores the latest checkpoint into a fresh workflow, answers the request, and checks the output ("Hello - approved").All 14 fail on
mainand pass here. The full declarative suite passes (1682 tests), and pyright reports no errors. Separately, I ran aQuestionfollowed by anInvokeFunctionToolwithrequireApproval: true, restoring from storage at each pause. Both resumes work and the workflow completes.Related Issue
Fixes #10074
AI Assistance
AI assistance details: Claude Code helped find the failure while running the docstring example, trace it to the unpickler allowlist, write the registration and tests, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code