Skip to content

Python: Generated declarative executor IDs collide with authored action IDs #9086

Description

@ktz03

Description

Python's declarative WorkflowFactory can reject a valid action definition when a generated executor ID matches an explicit action ID. An unnamed first SendActivity generates SendActivity_0; an explicitly named later action can legitimately have that ID. The builder then raises Duplicate executor ID 'SendActivity_0' detected in workflow instead of creating the workflow.

The same construction failure occurs when authored action IDs match internal If/ConditionGroup evaluator or passthrough IDs, or Foreach init/next/exit IDs.

Reproduction

import asyncio
from agent_framework_declarative import WorkflowFactory

async def main():
    workflow = WorkflowFactory().create_workflow_from_definition({
        "actions": [
            {"kind": "SendActivity", "activity": "first"},
            {"kind": "SendActivity", "id": "SendActivity_0", "activity": "second"},
        ]
    })
    print((await workflow.run({})).get_outputs())

asyncio.run(main())

Expected: the workflow builds, preserves the authored SendActivity_0 action ID, and outputs ['first', 'second'].

Actual on main b9d24c8fb484c8330abe8bb9e7500ca3c3bbf46c: DeclarativeWorkflowError: Failed to build graph-based workflow: Duplicate executor ID 'SendActivity_0' detected in workflow.

Verified locally on Windows with Python 3.12.14 through the public factory and workflow execution API. Normal definitions without an actual collision build and execute successfully.

Related design discussion: #8161. This report concerns graph construction for valid explicit action IDs, rather than changing agent names, workflow identity contracts, or generated IDs for definitions that already build successfully. The existing reserved _workflow_entry rule and duplicate explicit-ID rejection remain applicable. Mermaid export is a separate path from this factory failure.

I plan to address this with a focused internal-ID allocation fix and regression tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Python

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions