Skip to content

Commit d0fb164

Browse files
committed
support pydantic-ai<=1.92.0
1 parent ad3bee7 commit d0fb164

36 files changed

Lines changed: 1108 additions & 38 deletions

.agents/skills/acpkit-sdk/resources/intro.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Use these seams intentionally:
6969
advertise image, audio, or embedded context unless the runtime can honor them
7070
- only one `PrepareToolsMode(..., plan_mode=True)` is allowed
7171
- `plan_tools=True` is how a non-plan execution mode keeps plan progress tools visible
72+
- `PrepareOutputToolsBridge` is the separate seam for structured-output tool preparation in
73+
current Pydantic AI
74+
- `HookBridge` covers output-tool preparation, output validation, output processing, and
75+
deferred tool-call observation
7276
- `/thinking` only exists when `ThinkingBridge()` is configured
7377
- native ACP plan state and `PlanProvider` are separate ownership paths
7478
- permission card rendering is `NativeApprovalBridge.tool_call_builder`, not an `AdapterConfig`

.agents/skills/pydantic-acp/SKILL.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ High-value public seams:
116116
- `NativeApprovalBridge`
117117
- `PermissionToolCallBuilder`
118118
- `ApprovalPolicyStore`
119+
- `PrepareToolsBridge`
120+
- `PrepareToolsMode`
121+
- `PrepareOutputToolsBridge`
122+
- `PrepareOutputToolsMode`
123+
- `ThinkingBridge`
124+
- `HookBridge`
119125
- `SlashCommandProvider`
120126
- `StaticSlashCommandProvider`
121127
- `ExternalHookEventBridge`
@@ -128,6 +134,19 @@ Package entrypoint:
128134

129135
- [Package entrypoint](https://github.com/vcoderun/acpkit/blob/main/packages/adapters/pydantic-acp/src/pydantic_acp/__init__.py)
130136

137+
## Current Pydantic AI Compatibility
138+
139+
`pydantic-acp` currently targets `pydantic-ai-slim==1.92.0`.
140+
141+
When working on this surface, remember:
142+
143+
- `PrepareToolsBridge` owns function-tool preparation and mode-specific plan tool visibility
144+
- `PrepareOutputToolsBridge` owns structured-output tool preparation and session metadata for output-tool modes
145+
- `HookBridge` covers output-tool preparation, output validation, output processing, and deferred tool-call observation
146+
- prompt runtime passes ACP session identity through Pydantic AI `conversation_id` and run `metadata`
147+
- `run_stream_events()` returns an async context manager in current Pydantic AI; keep direct async-iterable fallback only for tests and compatibility fakes
148+
- `OpenAICompactionBridge` must not pass deprecated `instructions=` into upstream `OpenAICompaction`
149+
131150
## Module Guide
132151

133152
| Subsystem | Key files | Use them for |
@@ -190,7 +209,7 @@ It supports:
190209
- mode switching
191210
- config options
192211
- ACP-native plans
193-
- tool-based or structured plan generation
212+
- `Tool Plans` or `Structured Plans` plan generation
194213
- custom slash command providers
195214
- session replay and fork/resume/load/close/list lifecycle
196215
- slash command discovery and rendering
@@ -205,6 +224,10 @@ This package should be the reference answer whenever the question is:
205224

206225
High-value bridges include:
207226

227+
- `PrepareToolsBridge`
228+
- `PrepareOutputToolsBridge`
229+
- `ThinkingBridge`
230+
- `HookBridge`
208231
- `ThreadExecutorBridge`
209232
- `SetToolMetadataBridge`
210233
- `IncludeToolReturnSchemasBridge`

COVERAGE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Line coverage: 100.00% (8781 / 8781)
2-
Branch coverage: 100.00% (2942 / 2942)
1+
Line coverage: 100.00% (8957 / 8957)
2+
Branch coverage: 100.00% (2998 / 2998)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.3
1+
0.9.4

docs/api/pydantic_acp.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ This page documents the public surface re-exported by `pydantic_acp`.
7878

7979
::: pydantic_acp.PrepareToolsMode
8080

81+
::: pydantic_acp.PrepareOutputToolsBridge
82+
83+
::: pydantic_acp.PrepareOutputToolsMode
84+
8185
::: pydantic_acp.ThinkingBridge
8286

8387
::: pydantic_acp.HookBridge

docs/bridges.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,19 @@ Use it for:
260260

261261
It is the bridge most real coding-agent setups start with.
262262

263+
### `PrepareOutputToolsBridge`
264+
265+
Shapes output-tool availability per mode.
266+
267+
Use it when:
268+
269+
- structured-output tools should be filtered separately from normal function tools
270+
- ACP session metadata should expose the active output-tool mode
271+
- output-tool preparation should emit ACP-visible progress and failure updates
272+
273+
This mirrors `PrepareToolsBridge`, but targets Pydantic AI's
274+
`PrepareOutputTools` capability.
275+
263276
### `ThinkingBridge`
264277

265278
Exposes Pydantic AI’s `Thinking` capability through ACP session config.
@@ -275,6 +288,10 @@ Adds a `Hooks` capability into the active agent.
275288

276289
Useful when you want ACP-visible hook updates that come from bridge-owned hooks rather than only from hooks already attached to the source agent.
277290

291+
The bridge covers the current Pydantic AI hook surface, including tool
292+
preparation, output-tool preparation, output validation, output processing, and
293+
deferred tool-call observation.
294+
278295
You can also suppress noisy default hook rendering with:
279296

280297
```python

docs/llms-full.txt

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,21 +1362,25 @@ If you are integrating `pydantic-acp` in a real product:
13621362

13631363
## Version Compatibility And Private Upstream APIs
13641364

1365-
`pydantic-acp` currently pins `pydantic-ai-slim==1.83.0`.
1365+
`pydantic-acp` currently pins `pydantic-ai-slim==1.92.0`.
13661366

13671367
That is not accidental. The adapter relies on a specific, tested Pydantic AI
13681368
surface and should still be upgraded deliberately.
13691369

1370-
However, ACP Kit no longer imports Pydantic AI private history-processor
1371-
modules directly. History processor support is expressed through ACP Kit's own
1372-
callable aliases and passed into the public
1373-
`Agent(..., history_processors=...)` interface.
1370+
The current compatibility surface includes function-tool preparation,
1371+
output-tool preparation, output validation/processing hooks,
1372+
deferred-tool-call hooks, run metadata, and conversation IDs.
1373+
1374+
ACP Kit also no longer imports Pydantic AI private history-processor modules
1375+
directly. History processor support is expressed through ACP Kit's own callable
1376+
aliases and passed into the public `Agent(..., history_processors=...)`
1377+
interface.
13741378

13751379
What this means in practice:
13761380

13771381
- the adapter is less exposed to private upstream type-module churn
1378-
- upgrades are still compatibility work, but the history-processor integration
1379-
is no longer a direct private-import dependency
1382+
- upgrades are still compatibility work, but Pydantic AI integration points stay
1383+
isolated behind ACP Kit bridge and runtime seams
13801384

13811385
### LangChain ACP Overview
13821386
URL: https://vcoderun.github.io/acpkit/langchain-acp/
@@ -1464,10 +1468,13 @@ called inside `graph_factory=...`.
14641468
- `AdapterConfig`
14651469
- explicit session stores and transcript replay
14661470
- provider-owned models, modes, and config options
1471+
- prompt capability advertisement
14671472
- native ACP plan state with `TaskPlan`
1468-
- approval bridging
1473+
- approval bridging with projection-aware permission cards
14691474
- capability bridges
1475+
- built-in and host-defined slash commands
14701476
- projection maps and event projection maps
1477+
- external hook event projection
14711478
- ACP-facing type exports in `langchain_acp.types`
14721479

14731480
The important difference is upstream shape, not ACP Kit architecture. On the LangChain side the adapter deals in graphs and middleware instead of model profiles and tool preparers.
@@ -1513,6 +1520,51 @@ The point is not to make the adapter magical. The point is to keep the host,
15131520
the graph, and the ACP surface aligned without inventing runtime state the graph
15141521
cannot really honor.
15151522

1523+
## Prompt Capabilities And Slash Commands
1524+
1525+
Prompt capability advertisement is configurable instead of hardcoded:
1526+
1527+
```python
1528+
from langchain_acp import AdapterConfig, AdapterPromptCapabilities
1529+
1530+
config = AdapterConfig(
1531+
prompt_capabilities=AdapterPromptCapabilities(
1532+
audio=False,
1533+
image=False,
1534+
embedded_context=True,
1535+
)
1536+
)
1537+
```
1538+
1539+
The adapter also owns an ACP-native slash-command layer:
1540+
1541+
- mode commands such as `/ask`
1542+
- `/model`
1543+
- `/tools`
1544+
- `/mcp-servers`
1545+
- custom host commands through `slash_command_provider`
1546+
1547+
```python
1548+
from acp.schema import AvailableCommand
1549+
from langchain_acp import (
1550+
AdapterConfig,
1551+
SlashCommandResult,
1552+
StaticSlashCommand,
1553+
StaticSlashCommandProvider,
1554+
)
1555+
1556+
config = AdapterConfig(
1557+
slash_command_provider=StaticSlashCommandProvider(
1558+
commands=[
1559+
StaticSlashCommand(
1560+
command=AvailableCommand(name="ping", description="Return pong."),
1561+
handler=lambda _request: SlashCommandResult(text="pong"),
1562+
)
1563+
]
1564+
)
1565+
)
1566+
```
1567+
15161568
## Session Lifecycle And Replay
15171569

15181570
Session lifecycle is first-class:
@@ -1589,10 +1641,23 @@ The adapter surface is:
15891641

15901642
- `ApprovalBridge`
15911643
- `NativeApprovalBridge`
1644+
- `ProjectionAwareApprovalBridge`
1645+
- `PermissionToolCallBuilder`
1646+
- `ApprovalPolicyStore`
15921647
- ACP permission requests and resume flow
15931648

15941649
When the runtime really pauses for approval, the ACP session pauses for approval too.
15951650

1651+
Remembered approval choices and permission card rendering live on `NativeApprovalBridge`:
1652+
1653+
```python
1654+
from langchain_acp import NativeApprovalBridge
1655+
1656+
config = AdapterConfig(
1657+
approval_bridge=NativeApprovalBridge(enable_persistent_choices=True),
1658+
)
1659+
```
1660+
15961661
## Capability Bridges And Graph Build Contributions
15971662

15981663
ACP Kit's bridge architecture remains intact in the LangChain adapter.
@@ -1604,6 +1669,7 @@ Built-in bridges:
16041669
- `ConfigOptionsBridge`
16051670
- `ToolSurfaceBridge`
16061671
- `DeepAgentsCompatibilityBridge`
1672+
- `ExternalHookEventBridge`
16071673

16081674
Graph-build contributions are aggregated through:
16091675

@@ -3432,6 +3498,19 @@ Use it for:
34323498

34333499
It is the bridge most real coding-agent setups start with.
34343500

3501+
### `PrepareOutputToolsBridge`
3502+
3503+
Shapes output-tool availability per mode.
3504+
3505+
Use it when:
3506+
3507+
- structured-output tools should be filtered separately from normal function tools
3508+
- ACP session metadata should expose the active output-tool mode
3509+
- output-tool preparation should emit ACP-visible progress and failure updates
3510+
3511+
This mirrors `PrepareToolsBridge`, but targets Pydantic AI's
3512+
`PrepareOutputTools` capability.
3513+
34353514
### `ThinkingBridge`
34363515

34373516
Exposes Pydantic AI’s `Thinking` capability through ACP session config.
@@ -3447,6 +3526,10 @@ Adds a `Hooks` capability into the active agent.
34473526

34483527
Useful when you want ACP-visible hook updates that come from bridge-owned hooks rather than only from hooks already attached to the source agent.
34493528

3529+
The bridge covers the current Pydantic AI hook surface, including tool
3530+
preparation, output-tool preparation, output validation, output processing, and
3531+
deferred tool-call observation.
3532+
34503533
You can also suppress noisy default hook rendering with:
34513534

34523535
```python
@@ -6169,6 +6252,10 @@ This page documents the public surface re-exported by `pydantic_acp`.
61696252

61706253
::: pydantic_acp.PrepareToolsMode
61716254

6255+
::: pydantic_acp.PrepareOutputToolsBridge
6256+
6257+
::: pydantic_acp.PrepareOutputToolsMode
6258+
61726259
::: pydantic_acp.ThinkingBridge
61736260

61746261
::: pydantic_acp.HookBridge

docs/pydantic-acp.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,22 @@ If you are integrating `pydantic-acp` in a real product:
270270

271271
## Version Compatibility And Private Upstream APIs
272272

273-
`pydantic-acp` currently pins `pydantic-ai-slim==1.83.0`.
273+
`pydantic-acp` currently pins `pydantic-ai-slim==1.92.0`.
274274

275275
That is not accidental. The adapter relies on a specific, tested Pydantic AI
276276
surface and should still be upgraded deliberately.
277277

278-
However, ACP Kit no longer imports Pydantic AI private history-processor
279-
modules directly. History processor support is expressed through ACP Kit's own
280-
callable aliases and passed into the public
281-
`Agent(..., history_processors=...)` interface.
278+
The current compatibility surface includes function-tool preparation,
279+
output-tool preparation, output validation/processing hooks,
280+
deferred-tool-call hooks, run metadata, and conversation IDs.
281+
282+
ACP Kit also no longer imports Pydantic AI private history-processor modules
283+
directly. History processor support is expressed through ACP Kit's own callable
284+
aliases and passed into the public `Agent(..., history_processors=...)`
285+
interface.
282286

283287
What this means in practice:
284288

285289
- the adapter is less exposed to private upstream type-module churn
286-
- upgrades are still compatibility work, but the history-processor integration
287-
is no longer a direct private-import dependency
290+
- upgrades are still compatibility work, but Pydantic AI integration points stay
291+
isolated behind ACP Kit bridge and runtime seams
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.3
1+
0.9.4

packages/adapters/langchain-acp/src/langchain_acp/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__all__ = ("__version__",)
44

5-
__version__ = "0.9.3"
5+
__version__ = "0.9.4"

0 commit comments

Comments
 (0)