Skip to content

Commit 6f1c14f

Browse files
refactor(types): promote protocol types to agentex.protocol.* (#371)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 38ed338 commit 6f1c14f

27 files changed

Lines changed: 355 additions & 187 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,27 @@ The package provides the `agentex` CLI with these main commands:
5555

5656
### Code Structure
5757
- `/src/agentex/` - Core SDK and generated API client code
58+
- `/src/agentex/protocol/` - **Canonical** location for wire-protocol shapes
59+
(JSON-RPC envelopes, ACP method-param types). Depends only on `pydantic`
60+
and the Stainless-generated `agentex.types.*` surface, so it is safe to
61+
import from a future slim REST-only install.
62+
- `acp.py` - `RPCMethod`, `CreateTaskParams`, `SendMessageParams`,
63+
`SendEventParams`, `CancelTaskParams`, `RPC_SYNC_METHODS`,
64+
`PARAMS_MODEL_BY_METHOD`
65+
- `json_rpc.py` - `JSONRPCRequest`, `JSONRPCResponse`, `JSONRPCError`
5866
- `/src/agentex/lib/` - Custom library code (not modified by code generator)
5967
- `/cli/` - Command-line interface implementation
6068
- `/core/` - Core services, adapters, and temporal workflows
6169
- `/sdk/` - SDK utilities and FastACP implementation
6270
- `/types/` - Custom type definitions
71+
- `acp.py`, `json_rpc.py` - **back-compat shims** re-exporting from
72+
`agentex.protocol.*`. Existing `from agentex.lib.types.{acp,json_rpc}
73+
import ...` keeps working; new code should import from the canonical
74+
`agentex.protocol.*` paths.
75+
- Other modules (`tracing`, `agent_card`, `credentials`, `fastacp`,
76+
`llm_messages`, `converters`, etc.) stay here — they have heavier
77+
transitive deps (temporal, openai-agents, model_utils/yaml) and
78+
aren't slim-safe.
6379
- `/utils/` - Utility functions
6480
- `/examples/` - Example implementations and tutorials
6581
- `/tests/` - Test suites

src/agentex/lib/cli/templates/default-langgraph/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import agentex.lib.adk as adk
1818
from agentex.lib.adk import create_langgraph_tracing_handler, stream_langgraph_events
1919
from agentex.lib.core.tracing.tracing_processor_manager import add_tracing_processor_config
2020
from agentex.lib.sdk.fastacp.fastacp import FastACP
21-
from agentex.lib.types.acp import SendEventParams, CancelTaskParams, CreateTaskParams
21+
from agentex.protocol.acp import SendEventParams, CancelTaskParams, CreateTaskParams
2222
from agentex.lib.types.fastacp import AsyncACPConfig
2323
from agentex.lib.types.tracing import SGPTracingProcessorConfig
2424
from agentex.lib.utils.logging import make_logger

src/agentex/lib/cli/templates/default-pydantic-ai/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ from agentex.lib.adk import (
2828
stream_pydantic_ai_events,
2929
create_pydantic_ai_tracing_handler,
3030
)
31-
from agentex.lib.types.acp import SendEventParams, CancelTaskParams, CreateTaskParams
31+
from agentex.protocol.acp import SendEventParams, CancelTaskParams, CreateTaskParams
3232
from agentex.lib.types.fastacp import AsyncACPConfig
3333
from agentex.lib.types.tracing import SGPTracingProcessorConfig
3434
from agentex.lib.utils.logging import make_logger

src/agentex/lib/cli/templates/default/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from agentex.lib.sdk.fastacp.fastacp import FastACP
22
from agentex.lib.types.fastacp import AsyncACPConfig
3-
from agentex.lib.types.acp import SendEventParams, CancelTaskParams, CreateTaskParams
3+
from agentex.protocol.acp import SendEventParams, CancelTaskParams, CreateTaskParams
44
from agentex.lib.utils.logging import make_logger
55
from agentex.types.text_content import TextContent
66
from agentex.lib import adk

src/agentex/lib/cli/templates/sync-langgraph/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import agentex.lib.adk as adk
1111
from agentex.lib.adk import create_langgraph_tracing_handler, convert_langgraph_to_agentex_events
1212
from agentex.lib.core.tracing.tracing_processor_manager import add_tracing_processor_config
1313
from agentex.lib.sdk.fastacp.fastacp import FastACP
14-
from agentex.lib.types.acp import SendMessageParams
14+
from agentex.protocol.acp import SendMessageParams
1515
from agentex.lib.types.tracing import SGPTracingProcessorConfig
1616
from agentex.lib.utils.logging import make_logger
1717
from agentex.types.task_message_content import TaskMessageContent

src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import AsyncGenerator, List
44
from agentex.lib import adk
55
from agentex.lib.adk.providers._modules.sync_provider import SyncStreamingProvider, convert_openai_to_agentex_events
66
from agentex.lib.sdk.fastacp.fastacp import FastACP
7-
from agentex.lib.types.acp import SendMessageParams
7+
from agentex.protocol.acp import SendMessageParams
88
from agentex.lib.core.tracing.tracing_processor_manager import add_tracing_processor_config
99
from agentex.lib.types.tracing import SGPTracingProcessorConfig
1010
from agentex.lib.utils.model_utils import BaseModel

src/agentex/lib/cli/templates/sync-pydantic-ai/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ from agentex.lib.adk import (
2222
create_pydantic_ai_tracing_handler,
2323
convert_pydantic_ai_to_agentex_events,
2424
)
25-
from agentex.lib.types.acp import SendMessageParams
25+
from agentex.protocol.acp import SendMessageParams
2626
from agentex.lib.types.tracing import SGPTracingProcessorConfig
2727
from agentex.lib.utils.logging import make_logger
2828
from agentex.lib.sdk.fastacp.fastacp import FastACP

src/agentex/lib/cli/templates/sync/project/acp.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import AsyncGenerator, Union
22
from agentex.lib.sdk.fastacp.fastacp import FastACP
3-
from agentex.lib.types.acp import SendMessageParams
3+
from agentex.protocol.acp import SendMessageParams
44

55
from agentex.types.task_message_update import TaskMessageUpdate
66
from agentex.types.task_message_content import TaskMessageContent

src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import os
44
from temporalio import workflow
55

66
from agentex.lib import adk
7-
from agentex.lib.types.acp import CreateTaskParams, SendEventParams
7+
from agentex.protocol.acp import CreateTaskParams, SendEventParams
88
from agentex.lib.core.temporal.workflows.workflow import BaseWorkflow
99
from agentex.lib.core.temporal.types.workflow import SignalName
1010
from agentex.lib.utils.logging import make_logger

src/agentex/lib/cli/templates/temporal-pydantic-ai/project/workflow.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ from temporalio import workflow
2323
from project.agent import TaskDeps, temporal_agent
2424

2525
from agentex.lib import adk
26-
from agentex.lib.types.acp import SendEventParams, CreateTaskParams
26+
from agentex.protocol.acp import SendEventParams, CreateTaskParams
2727
from agentex.lib.types.tracing import SGPTracingProcessorConfig
2828
from agentex.lib.utils.logging import make_logger
2929
from agentex.types.text_content import TextContent

0 commit comments

Comments
 (0)