Skip to content

Refactor workflow signatures to typed Pydantic outputs#159

Open
Dan-StrategicAutomation wants to merge 1 commit into
devfrom
codex/add-pydantic-models-and-update-signatures
Open

Refactor workflow signatures to typed Pydantic outputs#159
Dan-StrategicAutomation wants to merge 1 commit into
devfrom
codex/add-pydantic-models-and-update-signatures

Conversation

@Dan-StrategicAutomation

Copy link
Copy Markdown
Collaborator

Motivation

  • Consolidate multiple raw DSPy output fields into single, typed Pydantic result models to improve schema clarity and DSPy introspection for workflow agents and tools.
  • Make compression inputs/outputs structured so KB compression and callers use explicit models instead of loosely-typed primitives.

Description

  • Added shared workflow schemas in agents/schema/base.py: WorkflowResult, MarkdownCompressionRequest, and MarkdownCompressionResult.
  • Added typed workflow result models in agents/schema/workflow.py: PlanExecutionResult, TodoResolutionResult, TriagePresentation, and GeneratedAgentSpec, and exported them via agents/schema/__init__.py.
  • Replaced multi-field outputs on signatures with single nested model outputs in agents/workflow/work_plan_executor.py, agents/workflow/work_todo_executor.py, agents/workflow/triage_agent.py, and agents/workflow/agent_generator.py (now use execution_result, resolution_result, triage_presentation, and generated_agent).
  • Wrapped KB compression signature in utils/knowledge/compression.py to accept MarkdownCompressionRequest and return MarkdownCompressionResult, and updated call sites and callers in workflows to read nested model attributes.
  • Added tests/test_workflow_signature_models.py asserting the modified signatures use the new structured Pydantic models and that the models behave as expected.

Testing

  • Ran python -m compileall on the touched modules which succeeded and confirmed there are no syntax errors in the modified files.
  • Ran ruff check for the modified files (agents/schema/base.py, agents/schema/workflow.py, agents/schema/__init__.py, agents/workflow/*, utils/knowledge/compression.py, workflows/*, and the new test) and fixed line-length/formatting issues; those checks for the changed files passed.
  • Added unit tests in tests/test_workflow_signature_models.py and compiled them, but full pytest could not be executed in this environment due to missing project dependencies (e.g., pydantic) and network failures when attempting dependency installation.
  • Note: a repository-wide lint run flagged pre-existing issues outside the touched files; the changes in this PR are self-consistent and lint-clean after targeted fixes.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant