Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add RunContext support to history processors#2002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Kludex merged 8 commits intopydantic:mainfromWh1isper:feat-ctx-histroy-processor
Jun 17, 2025

Conversation

Wh1isper
Copy link
Contributor

Following:#1970

Now we can do message processing dynamically based onContext

@hyperlint-aiHyperlint AI
Copy link
Contributor

PR Change Summary

Added support for RunContext in history processors to enable dynamic message processing based on the current run context.

  • Introduced RunContext parameter in history processors for enhanced message processing.
  • Implemented context-aware message filtering based on token usage.
  • Updated documentation to reflect the new RunContext functionality.

Modified Files

  • docs/message-history.md

How can I customize these reviews?

Check out theHyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add thehyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to addhyperlint-ignore to the PR to ignore the link check for this PR.

@@ -12,6 +12,7 @@
from opentelemetry.trace import Tracer
from typing_extensions import TypeGuard, TypeVar, assert_never

from pydantic_ai._function_schema import _takes_ctx as is_takes_ctx # type: ignore
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Since there is notakes_ctx parameter, here's an attempt to probe it

Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds RunContext support to history processors, enabling dynamic message processing based on contextual dependencies.

  • Added tests in tests/test_history_processor.py to validate context-aware processors.
  • Updated _agent_graph.py to support new processor signatures by passing a RunContext instance.
  • Enhanced documentation in docs/message-history.md with examples on using RunContext in history processors.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
tests/test_history_processor.pyAdded tests for synchronous, asynchronous, and mixed signature processors.
pydantic_ai_slim/pydantic_ai/_agent_graph.pyUpdated history processing to support RunContext in processors.
docs/message-history.mdDocumented the usage of RunContext in history processors.

Copy link
Member

@KludexKludex left a comment

Choose a reason for hiding this comment

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

Thanks! :)

I added a bit more type safety in the PR. 🙏

Wh1isper reacted with thumbs up emoji
@KludexKludexenabled auto-merge (squash)June 17, 2025 22:43
@KludexKludex merged commit7fdd745 intopydantic:mainJun 17, 2025
17 checks passed
@Wh1isper
Copy link
ContributorAuthor

Thanks

@Wh1isperWh1isper deleted the feat-ctx-histroy-processor branchJune 18, 2025 07:20
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@KludexKludexKludex approved these changes

Assignees

@KludexKludex

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Wh1isper@Kludex

[8]ページ先頭

©2009-2025 Movatter.jp