Skip to content

Conversation

@Cyb3rWard0g
Copy link
Collaborator

Overview:

This PR eliminates unsafe user-facing schema customization by auto-injecting the correct state model bundle based on agent/orchestrator type. Users now provide only storage configuration, and the framework automatically selects the appropriate schemas (AgentWorkflowState for agents, LLMWorkflowState for orchestrators), preventing runtime AttributeError crashes from incompatible custom schemas.

Key Changes:

  • Introduced StateModelBundle abstraction to encapsulate state schemas and hook functions with validation guards
  • Auto-injection pattern where agent/orchestrator classes inject their required schema bundle during initialization without user intervention
  • Simplified AgentStateConfig API by removing exposed state_model_cls and message_model_cls fields that allowed unsafe customization
  • Three-tier fallback resolution for state hooks: config overrides → default bundle → hardcoded defaults
  • Added type hints for default_bundle parameter using TYPE_CHECKING to prevent circular imports
  • Fixed incorrect import paths in LLM orchestrator compensation logic (dapr_agents.workflow.orchestratorsdapr_agents.agents.orchestrators)
  • Updated all quickstarts to use simplified configuration syntax (removed pubsub_config=, state_config= prefixes)
  • Added test coverage for bundle injection and conflict detection

@Cyb3rWard0g Cyb3rWard0g requested a review from yaron2 as a code owner November 2, 2025 06:48
@Cyb3rWard0g Cyb3rWard0g requested review from sicoyle and removed request for yaron2 November 2, 2025 06:48
Copy link
Collaborator

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your efforts on this! I love the idea of having the state implementation unified for agents and orchestrators and make things easier on us to maintain 🙌 🌟

few comments so far, but yeah I'm curious for your thoughts on. What are the benefits of the factory/coercer setup vs just having a static state class for agents and another for orchestrators that are slightly diff but use the same underlying storage base class? Would that be easier than this approach?

… import and clarify bundle override logic

Signed-off-by: Roberto Rodriguez <[email protected]>
Copy link
Collaborator

@sicoyle sicoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add the inline comment on the github comment above and then i am good with this one. Thank youuuu!!

@Cyb3rWard0g Cyb3rWard0g merged commit efb9c93 into main Nov 5, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants