Skip to content

Commit 398719f

Browse files
authored
Merge pull request #19 from vstorm-co/fix/description
fix: add description field
2 parents 3d6351f + 1d9709b commit 398719f

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.4] - 2026-03-19
9+
10+
### Fixed
11+
12+
- **`MiddlewareAgent` missing `description` property** — pydantic-ai added `description` as an abstract property on `AbstractAgent`, causing `MiddlewareAgent` instantiation to fail with `reportAbstractUsage`. Delegates to the wrapped agent with a fallback for older pydantic-ai versions.
13+
814
## [0.2.3] - 2026-03-11
915

1016
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pydantic-ai-middleware"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
description = "Simple middleware library for Pydantic-AI - before/after hooks without imposed guardrails structure"
55
readme = "README.md"
66
license = "MIT"

src/pydantic_ai_middleware/agent.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def context(self) -> MiddlewareContext | None:
113113
def model(self) -> models.Model | models.KnownModelName | str | None:
114114
return self._wrapped.model
115115

116+
@property
117+
def description(self) -> str:
118+
return getattr(self._wrapped, "description", "")
119+
116120
@property
117121
def name(self) -> str | None:
118122
return self._wrapped.name

tests/test_agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ def test_model_property(self) -> None:
132132
middleware_agent = MiddlewareAgent(agent)
133133
assert middleware_agent.model is model
134134

135+
def test_description_property(self) -> None:
136+
"""Test description property delegates to wrapped."""
137+
agent = Agent(TestModel(), output_type=str)
138+
middleware_agent = MiddlewareAgent(agent)
139+
assert isinstance(middleware_agent.description, str)
140+
135141
def test_name_property(self) -> None:
136142
"""Test name property delegates to wrapped."""
137143
agent = Agent(TestModel(), output_type=str, name="test_agent")

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)