Repository navigation
Python: Defer experimental AgentFactory creation in WorkflowFactory - #10114
Open
ZedingZhang (ZedingZhang) wants to merge 3 commits into
Open
ZedingZhang (ZedingZhang) wants to merge 3 commits into
ZedingZhang (ZedingZhang) wants to merge 3 commits into
Conversation
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 5, 2026 14:11 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 5, 2026 14:11 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues requiring changes.
No open issues 🎉
What changed in this PR
This PR addresses #10092 by deferring experimental agent-factory creation until a workflow loads an agent definition. Action-only workflows and workflows using pre-registered agents can therefore avoid the experimental warning.
Changes:
- Lazily create and cache the default
AgentFactory, deferring environment-file loading until first use. - Document the warning boundary and how pre-registered agents bypass declarative-agent loading.
- Add six regression cases covering warning behavior, registration precedence, factory reuse, and explicit factories.
| File | Description |
|---|---|
python/packages/declarative/tests/test_workflow_factory.py |
Adds regression coverage for lazy initialization and warning behavior. |
python/packages/declarative/tests/conftest.py |
Adds a fixture isolating once-per-feature warning state. |
python/packages/declarative/README.md |
Explains deferred loading and the pre-registered-agent option. |
python/packages/declarative/agent_framework_declarative/_workflows/_factory.py |
Defers default factory creation and documents initialization timing. |
Review effort: Balanced
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 5, 2026 14:13 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 5, 2026 14:14 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
marked this pull request as ready for review
November 5, 2026 14:14
ZedingZhang (ZedingZhang)
temporarily deployed
to
github-app-auth
November 5, 2026 14:14 — with
GitHub Actions
Inactive
ZedingZhang (ZedingZhang)
deployed
to
github-app-auth
November 6, 2026 03:27 — with
GitHub Actions
Active
Member
|
ZedingZhang (@ZedingZhang), I found one material issue on the current head:
|
ZedingZhang (ZedingZhang)
deployed
to
github-app-auth
November 6, 2026 16:07 — with
GitHub Actions
Active
ZedingZhang (ZedingZhang)
deployed
to
github-app-auth
November 6, 2026 16:07 — with
GitHub Actions
Active
Contributor
Author
|
Thanks, Eduard van Valkenburg (@eavanvalkenburg) ! Fixed in 5254e80: environment loading now happens independently of lazy AgentFactory creation. Added regression coverage for action-only workflows and both agent registration paths. All declarative tests pass. |
This branch was successfully 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
Constructing
WorkflowFactory()eagerly creates an experimentalAgentFactory, so even a workflow containing onlySendActivityemits aDECLARATIVE_AGENTSwarning. Applications using the stable workflow APIs should enter the declarative-agent loading path only when their workflow requires it.Description & Review Guide
WorkflowFactoryloadsenv_fileduring initialization independently of agent creation, preserving=Env.NAMEvalues for workflows that enable process-environment fallback withrestrict_env_to_configuration=False. Subsequent agent definitions reuse the default agent factory.Related Issue
Fixes #10092.
The issue has the
ready-for-implementationlabel. No competing open PR referencing #10092 was found before submission.AI Assistance
Codex assisted with issue analysis, implementation, regression tests, documentation, and this PR description. I have reviewed all submitted content and take resonsibility for it.
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.