#5372·PraisonAI

Inert `single_agent` parameter in auto.py generators: documented but never read (dead/unimplemented surface)

Author: MervinPraisonCreated Sep 29, 2026Updated Sep 29, 2026
Labelsdocumentationclaude

Summary

The single_agent constructor parameter on the wrapper's YAML scaffolding generators (AutoGenerator and WorkflowAutoGenerator in src/praisonai/praisonai/auto.py) is accepted, documented, and stored — but never read on any generation path. The paired SingleAgentStructure Pydantic model is registered but never drives generation. This is dead/unimplemented surface that can silently mislead users (setting single_agent=True still produces a team).

Current behaviour

python
# src/praisonai/praisonai/auto.py
class AutoGenerator:
    def __init__(self, ..., single_agent: bool = False, ...):
        # docstring: "single_agent: If True, generate a single agent instead of a team"
        self.single_agent = single_agent   # stored, then never used

class WorkflowAutoGenerator:
    def __init__(self, ..., single_agent: bool = False, ...):
        # docstring: "single_agent: If True, generate a single agent workflow"
        self.single_agent = single_agent   # stored, then never used

Verification (grep across src/praisonai/praisonai/):

  • self.single_agent is only ever assigned (self.single_agent = single_agent); there is no read anywhere.
  • Generation always builds TeamStructure / WorkflowStructure; SingleAgentStructure (defined at auto.py:987, registered in the model factory map, and exported at auto.py:1587) is never used to drive a generation path.

So the documented "generate a single agent" behaviour does not exist — the flag is inert.

Why it matters

User confusion / correctness of the public surface: the parameter is documented in the constructor docstrings, so a user who passes single_agent=True reasonably expects single-agent output and silently gets a team. It is also unnecessary maintenance surface (an exported model and factory entry with no consumer). No import or hot-path cost.

Category

Dead code

Capability preserved

  • All existing team/workflow YAML generation is unchanged.
  • No change to any CLI verb, YAML schema, or the run/arun Python entry points.
  • No public symbol is removed in the minimal (deprecate-only) option.

Proposed approach

Two conservative, non-breaking options — pick one:

  1. Deprecate the inert surface (safest, no behaviour change): keep the single_agent parameter for signature compatibility, but emit a DeprecationWarning when it is passed truthy, documenting that single-agent generation is not implemented; stop advertising the behaviour in the docstrings; drop the unused SingleAgentStructure export from the factory map (retain the class if any test imports it).
  2. Implement it (feature completion): wire single_agent=True to generate a single-agent SingleAgentStructure config end-to-end, with a real agentic test. This adds behaviour, so only if there is a live consumer/demand — otherwise prefer option 1 to keep the wrapper lightweight.

Do not simply delete the constructor parameter without a deprecation cycle (it is part of the public constructor signature).

Resolution sketch

python
# After (option 1 — honest surface, no silent no-op)
def __init__(self, ..., single_agent: bool = False, ...):
    if single_agent:
        warnings.warn(
            "single_agent generation is not implemented; a team structure "
            "is generated instead. This parameter is deprecated.",
            DeprecationWarning, stacklevel=2,
        )
    self.single_agent = single_agent

Layer placement

  • Primary layer: wrapper
  • Touches core/tools/plugins (optional): none
  • 3-way surface (CLI + YAML + Python): preserved yes (no surface added/removed under option 1)

Severity

Low — no runtime cost; fixes a silently-inert documented parameter (correctness/clarity of the public API).

Validation

Traced with grep: self.single_agent has assignments only and no reads; SingleAgentStructure has no generation-driving consumer. Not intentional robustness. Option 1 changes no existing behaviour (only warns on a flag that already did nothing).

Keep unchanged

  • Team/workflow structure generation, prompt building, tool allowlist enforcement, atomic writes, and merge logic in auto.py.
  • agents_generator.py YAML normalisation / CLI-merge / adapter delegation.
  • The run/arun entry points and the praisonai CLI generate paths.