Skip to content

fix(agents): update deprecated pydantic-ai parameter#908

Closed
steveant wants to merge 1 commit intocoleam00:mainfrom
AeyeOps:fix/pydantic-ai-output-type
Closed

fix(agents): update deprecated pydantic-ai parameter#908
steveant wants to merge 1 commit intocoleam00:mainfrom
AeyeOps:fix/pydantic-ai-output-type

Conversation

@steveant
Copy link
Copy Markdown

@steveant steveant commented Dec 20, 2025

Summary

Updates result_type to output_type in DocumentAgent for compatibility with pydantic-ai 1.0.x.

Problem

The Agent class in pydantic-ai renamed the result_type parameter to output_type in version 1.0. This causes the document agent to fail initialization:

ERROR:src.agents.server:Failed to initialize document agent: Unknown keyword arguments: `result_type`

Solution

Single-line fix renaming the parameter.

Summary by CodeRabbit

  • Refactor
    • Updated Agent API parameter naming in DocumentAgent for consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

Rename `result_type` to `output_type` in DocumentAgent to fix
compatibility with pydantic-ai 1.0.x.

The Agent class renamed this parameter in the 1.0 release.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 20, 2025

Walkthrough

A parameter name in the Agent instantiation within DocumentAgent is updated from result_type to output_type. The change reflects a public API adjustment with no functional or behavioral modifications.

Changes

Cohort / File(s) Summary
Agent parameter rename
python/src/agents/document_agent.py
Agent instantiation parameter updated from result_type=DocumentOperation to output_type=DocumentOperation in _create_agent method

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Single-file parameter rename with no logic changes
  • No control flow or behavioral impact
  • Mechanical update only

Poem

🐰 A parameter skipped, a name rearranged,
From result to output—the Agent's been changed!
No logic was harmed in this tidbit small,
Just nomenclature dancing through agent-y hall. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear summary, explains the problem, and outlines the solution, but does not follow the repository's required PR template structure with sections like Changes Made, Type of Change, Affected Services, Testing, and Checklist. Restructure the description to follow the repository template, including explicit Type of Change selection, Affected Services, Testing evidence, and completion of the provided checklist items.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix as updating a deprecated pydantic-ai parameter, which matches the core change of renaming result_type to output_type.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecaece4 and 74e2bb3.

📒 Files selected for processing (1)
  • python/src/agents/document_agent.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
python/src/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/src/**/*.py: Complete batch processing, background tasks, and external API calls but log detailed errors for each failure instead of crashing
Include context about what was being attempted, preserve full stack traces with exc_info=True in Python logging, use specific exception types, include relevant IDs/URLs, never return None to indicate failure, and report both success count and detailed failure list for batch operations
Use Ruff for linting and MyPy for type checking with 120 character line length in Python backend
Use Python 3.12 with 120 character line length in backend code
Import GITHUB_REPO_OWNER and GITHUB_REPO_NAME constants from python/src/server/config/version.py as the single source of truth for repository configuration

python/src/**/*.py: Python backend code should use 120 character line length
Use Ruff for linting Python code to check for errors, warnings, and unused imports
Use Mypy for type checking in Python to ensure type safety

Files:

  • python/src/agents/document_agent.py
python/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Error messages must include context about what was being attempted, preserve full stack traces, use specific exception types, include relevant IDs/URLs, and report both success count and detailed failure list for batch operations

Files:

  • python/src/agents/document_agent.py
🔇 Additional comments (1)
python/src/agents/document_agent.py (1)

79-79: Use output_type parameter for pydantic-ai 1.0.x compatibility.

The pydantic-ai Agent class constructor uses output_type as the parameter for specifying structured output types, replacing the deprecated result_type parameter. The result_type parameter was removed from the Agent class in v0.6.0, with output_type being the designated replacement. This change is necessary and correct.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 76 to +79
agent = Agent(
model=self.model,
deps_type=DocumentDependencies,
result_type=DocumentOperation,
output_type=DocumentOperation,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document agent ctor incompatible with pinned pydantic-ai

The document agent now calls Agent(..., output_type=DocumentOperation, ...), but python/uv.lock still pins pydantic-ai at 0.0.55 (python/uv.lock lines 2125-2133). In that version the Agent constructor expects result_type; output_type is not a recognized keyword, so _create_agent will raise TypeError and the document agent cannot start unless the dependency is upgraded to ≥1.0 or the old parameter is kept.

Useful? React with 👍 / 👎.

@steveant
Copy link
Copy Markdown
Author

Superseded by #928 which consolidates this fix along with other improvements.

@steveant steveant closed this Jan 15, 2026
coleam00 added a commit that referenced this pull request Apr 7, 2026
…#908)

* Fix: graph nodes not clickable and logs not filtered by selected node (#897)

Graph nodes had no selection infrastructure — elementsSelectable was false,
WorkflowDagViewer had no onNodeClick/selectedNodeId props, and WorkflowLogs
showed unfiltered tool events regardless of the selected node. Tool call
cards also remained spinning after workflow completion when the lock_changed
SSE event was missed.

Changes:
- ExecutionDagNode: add `selected` prop with ring-2 ring-accent-bright highlight
- WorkflowDagViewer: add onNodeClick/selectedNodeId props, enable elementsSelectable,
  pass selected flag to node data, wire onNodeClick to ReactFlow
- WorkflowExecution: pass selectedDagNode and setSelectedDagNode to WorkflowDagViewer;
  pass selectedNodeId to WorkflowLogs
- WorkflowLogs: add selectedNodeId prop, filter toolEvents by stepName when a node
  is selected, update query key to re-run on node change, add safety-net finalization
  of in-flight SSE tool calls on isRunning → false transition

Fixes #897

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add clarifying comment for partial-key query invalidation in WorkflowLogs

Documents that the 2-segment prefix key in queryClient.invalidateQueries
intentionally covers all node-filtered variants (prefix match in React Query v5
covers 'all' + per-node keys), making the behavior clear to future developers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
coleam00 added a commit that referenced this pull request Apr 7, 2026
The previous approach (PR #908) included selectedNodeId in the React
Query key, causing a cache miss flash on every node click, and only
filtered tool events (not messages) — so the log view never actually
changed. Replace with scroll-to-timestamp: compute each node's start
time from workflow events, then smoothly scroll the message list to
the first message at or after that timestamp when the user clicks a
node in either the Graph or Logs tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…coleam00#908)

* Fix: graph nodes not clickable and logs not filtered by selected node (coleam00#897)

Graph nodes had no selection infrastructure — elementsSelectable was false,
WorkflowDagViewer had no onNodeClick/selectedNodeId props, and WorkflowLogs
showed unfiltered tool events regardless of the selected node. Tool call
cards also remained spinning after workflow completion when the lock_changed
SSE event was missed.

Changes:
- ExecutionDagNode: add `selected` prop with ring-2 ring-accent-bright highlight
- WorkflowDagViewer: add onNodeClick/selectedNodeId props, enable elementsSelectable,
  pass selected flag to node data, wire onNodeClick to ReactFlow
- WorkflowExecution: pass selectedDagNode and setSelectedDagNode to WorkflowDagViewer;
  pass selectedNodeId to WorkflowLogs
- WorkflowLogs: add selectedNodeId prop, filter toolEvents by stepName when a node
  is selected, update query key to re-run on node change, add safety-net finalization
  of in-flight SSE tool calls on isRunning → false transition

Fixes coleam00#897

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add clarifying comment for partial-key query invalidation in WorkflowLogs

Documents that the 2-segment prefix key in queryClient.invalidateQueries
intentionally covers all node-filtered variants (prefix match in React Query v5
covers 'all' + per-node keys), making the behavior clear to future developers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
The previous approach (PR coleam00#908) included selectedNodeId in the React
Query key, causing a cache miss flash on every node click, and only
filtered tool events (not messages) — so the log view never actually
changed. Replace with scroll-to-timestamp: compute each node's start
time from workflow events, then smoothly scroll the message list to
the first message at or after that timestamp when the user clicks a
node in either the Graph or Logs tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…coleam00#908)

* Fix: graph nodes not clickable and logs not filtered by selected node (coleam00#897)

Graph nodes had no selection infrastructure — elementsSelectable was false,
WorkflowDagViewer had no onNodeClick/selectedNodeId props, and WorkflowLogs
showed unfiltered tool events regardless of the selected node. Tool call
cards also remained spinning after workflow completion when the lock_changed
SSE event was missed.

Changes:
- ExecutionDagNode: add `selected` prop with ring-2 ring-accent-bright highlight
- WorkflowDagViewer: add onNodeClick/selectedNodeId props, enable elementsSelectable,
  pass selected flag to node data, wire onNodeClick to ReactFlow
- WorkflowExecution: pass selectedDagNode and setSelectedDagNode to WorkflowDagViewer;
  pass selectedNodeId to WorkflowLogs
- WorkflowLogs: add selectedNodeId prop, filter toolEvents by stepName when a node
  is selected, update query key to re-run on node change, add safety-net finalization
  of in-flight SSE tool calls on isRunning → false transition

Fixes coleam00#897

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add clarifying comment for partial-key query invalidation in WorkflowLogs

Documents that the 2-segment prefix key in queryClient.invalidateQueries
intentionally covers all node-filtered variants (prefix match in React Query v5
covers 'all' + per-node keys), making the behavior clear to future developers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
The previous approach (PR coleam00#908) included selectedNodeId in the React
Query key, causing a cache miss flash on every node click, and only
filtered tool events (not messages) — so the log view never actually
changed. Replace with scroll-to-timestamp: compute each node's start
time from workflow events, then smoothly scroll the message list to
the first message at or after that timestamp when the user clicks a
node in either the Graph or Logs tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant