Skip to content

Commit eb03f71

Browse files
Fix ACP factory typing and override method annotations
1 parent 7f9e8be commit eb03f71

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

agentex-server

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/prassanna.ravishankar/git/agentex

src/agentex/lib/adk/utils/_modules/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import httpx
2+
from typing import override
23

34
from agentex import AsyncAgentex
45
from agentex.lib.utils.logging import make_logger
@@ -11,6 +12,7 @@ class EnvAuth(httpx.Auth):
1112
def __init__(self, header_name="x-agent-api-key"):
1213
self.header_name = header_name
1314

15+
@override
1416
def auth_flow(self, request):
1517
# This gets called for every request
1618
env_vars = EnvironmentVariables.refresh()

src/agentex/lib/cli/commands/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def list_running(
5656
console.print(f"[green]Found {len(running_tasks)} running task(s) for agent '{agent_name}':[/green]")
5757

5858
# Convert to dict with proper datetime serialization
59-
serializable_tasks: list[dict[str, Any]] = []
59+
serializable_tasks: list[dict[str, Any]] = [] # type: ignore[misc]
6060
for task in running_tasks:
6161
try:
6262
# Use model_dump with mode='json' for proper datetime handling

src/agentex/lib/cli/handlers/agent_handlers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ def build_agent(
6565
# Log build context information for debugging
6666
logger.info(f"Build context path: {build_context.path}")
6767
logger.info(
68-
f"Dockerfile path: {build_context.path / build_context.dockerfile_path}"
68+
f"Dockerfile path: {build_context.path / build_context.dockerfile_path}" # type: ignore[operator]
6969
)
7070

7171
try:
7272
# Prepare build arguments
7373
docker_build_kwargs = {
7474
"context_path": str(build_context.path),
75-
"file": str(build_context.path / build_context.dockerfile_path),
75+
"file": str(build_context.path / build_context.dockerfile_path), # type: ignore[operator]
7676
"tags": [image_name],
7777
"platforms": platforms,
7878
}

src/agentex/lib/sdk/fastacp/fastacp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create_agentic_acp(config: AgenticACPConfig, **kwargs) -> BaseACPServer:
5252
# Extract temporal_address from config if it's a TemporalACPConfig
5353
temporal_config = kwargs.copy()
5454
if hasattr(config, "temporal_address"):
55-
temporal_config["temporal_address"] = config.temporal_address
55+
temporal_config["temporal_address"] = config.temporal_address # type: ignore[attr-defined]
5656
return implementation_class.create(**temporal_config)
5757
else:
5858
return implementation_class.create(**kwargs)

src/agentex/lib/sdk/fastacp/impl/temporal_acp.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable, AsyncGenerator
1+
from typing import Callable, AsyncGenerator, override
22
from contextlib import asynccontextmanager
33

44
from fastapi import FastAPI
@@ -31,6 +31,7 @@ def __init__(
3131
self._temporal_address = temporal_address
3232

3333
@classmethod
34+
@override
3435
def create(cls, temporal_address: str) -> "TemporalACP":
3536
logger.info("Initializing TemporalACP instance")
3637

@@ -40,7 +41,7 @@ def create(cls, temporal_address: str) -> "TemporalACP":
4041
logger.info("TemporalACP instance initialized now")
4142
return temporal_acp
4243

43-
# This is to override the lifespan function of the base
44+
@override
4445
def get_lifespan_function(self) -> Callable[[FastAPI], AsyncGenerator[None, None]]:
4546
@asynccontextmanager
4647
async def lifespan(app: FastAPI):
@@ -59,29 +60,32 @@ async def lifespan(app: FastAPI):
5960
)
6061

6162
# Call parent lifespan for agent registration
62-
async with super().get_lifespan_function()(app):
63+
async with super().get_lifespan_function()(app): # type: ignore[misc]
6364
yield
6465

6566
return lifespan
6667

68+
@override
6769
def _setup_handlers(self):
6870
"""Set up the handlers for temporal workflow operations"""
6971

7072
@self.on_task_create
7173
async def handle_task_create(params: CreateTaskParams) -> None:
7274
"""Default create task handler - logs the task"""
7375
logger.info(f"TemporalACP received task create rpc call for task {params.task.id}")
74-
await self._temporal_task_service.submit_task(agent=params.agent, task=params.task, params=params.params)
76+
if self._temporal_task_service is not None:
77+
await self._temporal_task_service.submit_task(agent=params.agent, task=params.task, params=params.params)
7578

7679
@self.on_task_event_send
7780
async def handle_event_send(params: SendEventParams) -> None:
7881
"""Forward messages to running workflows via TaskService"""
7982
try:
80-
await self._temporal_task_service.send_event(
81-
agent=params.agent,
82-
task=params.task,
83-
event=params.event,
84-
)
83+
if self._temporal_task_service is not None:
84+
await self._temporal_task_service.send_event(
85+
agent=params.agent,
86+
task=params.task,
87+
event=params.event,
88+
)
8589

8690
except Exception as e:
8791
logger.error(f"Failed to send message: {e}")

0 commit comments

Comments
 (0)