Python: support checkpoints for workflow orchestrations and sub-workflows (#863)

* Magentic checkpoint wip

* Magentic checkpoint updates

* Support checkpointing for magentic orchestration.

* Checkpointing for sub-workflows

* Use _execute_contexts instead of _pending_requests

* Remove unnecessary type ignores

* Support checkpoints for other orchestrations, refactor some code.

* Regenerate uv.lock
This commit is contained in:
Evan Mattson
2025-09-26 11:21:06 +09:00
committed by GitHub
Unverified
parent 4b743ea62a
commit 2cd7ab342b
22 changed files with 2005 additions and 277 deletions
@@ -4,8 +4,6 @@ import asyncio
from dataclasses import dataclass
from typing import Any
from typing_extensions import Never
from agent_framework import (
Executor,
WorkflowBuilder,
@@ -14,6 +12,7 @@ from agent_framework import (
WorkflowExecutor,
handler,
)
from typing_extensions import Never
"""
Sample: Sub-Workflows (Basics)
@@ -4,8 +4,6 @@ import asyncio
from dataclasses import dataclass
from typing import Any
from typing_extensions import Never
from agent_framework import (
Executor,
RequestInfoExecutor,
@@ -16,6 +14,7 @@ from agent_framework import (
WorkflowExecutor,
handler,
)
from typing_extensions import Never
"""
Sample: Sub-workflow with parallel request handling by specialized interceptors
@@ -170,7 +169,9 @@ class ResourceRequester(Executor):
@handler
async def handle_policy_response(
self, response: RequestResponse[PolicyCheckRequest, PolicyResponse], ctx: WorkflowContext[Never, RequestFinished]
self,
response: RequestResponse[PolicyCheckRequest, PolicyResponse],
ctx: WorkflowContext[Never, RequestFinished],
) -> None:
"""Handle policy check response."""
if response.data: