Skip to content

Commit ce8f5ab

Browse files
Fix CLI handler typing and add tutorial type ignores for readability
1 parent eb03f71 commit ce8f5ab

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

examples/tutorials/10_agentic/00_base/020_streaming/project/acp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ async def handle_event_send(params: SendEventParams):
119119

120120
# Safely extract content from the task message
121121
response_text = ""
122-
if task_message.content and hasattr(task_message.content, 'content'):
123-
content_val = getattr(task_message.content, 'content', '')
122+
if task_message.content and hasattr(task_message.content, 'content'): # type: ignore[union-attr]
123+
content_val = getattr(task_message.content, 'content', '') # type: ignore[union-attr]
124124
if isinstance(content_val, str):
125125
response_text = content_val
126126
state.messages.append(AssistantMessage(content=response_text))

examples/tutorials/10_agentic/00_base/030_tracing/project/acp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ async def handle_event_send(params: SendEventParams):
132132

133133
# Safely extract content from the task message
134134
response_text = ""
135-
if task_message.content and hasattr(task_message.content, 'content'):
136-
content_val = getattr(task_message.content, 'content', '')
135+
if task_message.content and hasattr(task_message.content, 'content'): # type: ignore[union-attr]
136+
content_val = getattr(task_message.content, 'content', '') # type: ignore[union-attr]
137137
if isinstance(content_val, str):
138138
response_text = content_val
139139
state.messages.append(AssistantMessage(content=response_text))
@@ -159,7 +159,7 @@ async def handle_event_send(params: SendEventParams):
159159
# (👋) You can store an arbitrary pydantic model or dictionary in the span output. The idea of a span is that it easily allows you to compare the input and output of a span to see what the wrapped function did.
160160
# In this case, the state is comprehensive and expressive, so we just store the change in state that occured.
161161
if span:
162-
span.output = state
162+
span.output = state # type: ignore[misc]
163163

164164
@acp.on_task_cancel
165165
async def handle_task_cancel(params: CancelTaskParams):

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ async def start_temporal_worker(
237237
async def stream_process_output(process: asyncio.subprocess.Process, prefix: str):
238238
"""Stream process output with prefix"""
239239
try:
240+
if process.stdout is None:
241+
return
240242
while True:
241243
line = await process.stdout.readline()
242244
if not line:
@@ -292,11 +294,11 @@ async def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = Non
292294
manifest_dir = Path(manifest_path).parent
293295
if debug_config and debug_config.should_debug_acp():
294296
acp_process = await start_acp_server_debug(
295-
file_paths["acp"], manifest.local_development.agent.port, agent_env, debug_config
297+
file_paths["acp"], manifest.local_development.agent.port, agent_env, debug_config # type: ignore[union-attr]
296298
)
297299
else:
298300
acp_process = await start_acp_server(
299-
file_paths["acp"], manifest.local_development.agent.port, agent_env, manifest_dir
301+
file_paths["acp"], manifest.local_development.agent.port, agent_env, manifest_dir # type: ignore[union-attr]
300302
)
301303
process_manager.add_process(acp_process)
302304

@@ -320,7 +322,7 @@ async def run_agent(manifest_path: str, debug_config: "DebugConfig | None" = Non
320322
tasks.append(worker_task)
321323

322324
console.print(
323-
f"\n[green]✓ Agent running at: http://localhost:{manifest.local_development.agent.port}[/green]"
325+
f"\n[green]✓ Agent running at: http://localhost:{manifest.local_development.agent.port}[/green]" # type: ignore[union-attr]
324326
)
325327
console.print("[dim]Press Ctrl+C to stop[/dim]\n")
326328

@@ -364,8 +366,8 @@ def create_agent_environment(manifest: AgentManifest) -> dict[str, str]:
364366
"REDIS_URL": "redis://localhost:6379",
365367
"AGENT_NAME": manifest.agent.name,
366368
"ACP_TYPE": manifest.agent.acp_type,
367-
"ACP_URL": f"http://{manifest.local_development.agent.host_address}",
368-
"ACP_PORT": str(manifest.local_development.agent.port),
369+
"ACP_URL": f"http://{manifest.local_development.agent.host_address}", # type: ignore[union-attr]
370+
"ACP_PORT": str(manifest.local_development.agent.port), # type: ignore[union-attr]
369371
}
370372

371373
# Add authorization principal if set - for local development, auth is optional

0 commit comments

Comments
 (0)