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

Improve error trace for user errors that happen inside capture_run_messages #2218

Closed
Assignees
DouweM
@alonme

Description

@alonme

Description

When using thecapture_run_messages context manager - user errors also show an internal error from the library.

Exceptions occur inside an internal exception handler in pydanticAI and will include something like..

...LookupError: <ContextVar name='var' at 0x10635a020>During handling of the above exception, another exception occurred:...<user exception>

Which is confusing and unnecessary

example for reproduction

frompydantic_aiimport (Agent,capture_run_messages,)agent=Agent('openai:gpt-4o')withcapture_run_messages()asmessages:result=agent.run_sync('How are you?')1/0print(messages)

References

From the docs -https://ai.pydantic.dev/agents/#model-errors

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp