Merge pull request #1745 from Aman030304/fix/runner-logging

Refactor: Replace print with logging in AgentRunner
This commit is contained in:
RichardTang-Aden
2026-01-28 18:00:28 -08:00
committed by GitHub
2 changed files with 12 additions and 5 deletions
+4 -1
View File
@@ -41,7 +41,10 @@ jobs:
test:
name: Test Python Framework
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
+8 -4
View File
@@ -1,6 +1,7 @@
"""Agent Runner - loads and runs exported agents."""
import json
import logging
import os
from collections.abc import Callable
from dataclasses import dataclass, field
@@ -23,6 +24,9 @@ if TYPE_CHECKING:
from framework.runner.protocol import AgentMessage, CapabilityResponse
logger = logging.getLogger(__name__)
@dataclass
class AgentInfo:
"""Information about an exported agent."""
@@ -388,9 +392,9 @@ class AgentRunner:
self._tool_registry.register_mcp_server(server_config)
except Exception as e:
server_name = server_config.get("name", "unknown")
print(f"Warning: Failed to register MCP server '{server_name}': {e}")
logger.warning(f"Failed to register MCP server '{server_name}': {e}")
except Exception as e:
print(f"Warning: Failed to load MCP servers config from {config_path}: {e}")
logger.warning(f"Failed to load MCP servers config from {config_path}: {e}")
def set_approval_callback(self, callback: Callable) -> None:
"""
@@ -433,8 +437,8 @@ class AgentRunner:
self._llm = LiteLLMProvider(model=self.model)
elif api_key_env:
print(f"Warning: {api_key_env} not set. LLM calls will fail.")
print(f"Set it with: export {api_key_env}=your-api-key")
logger.warning(f"{api_key_env} not set. LLM calls will fail.")
logger.warning(f"Set it with: export {api_key_env}=your-api-key")
# Get tools for executor/runtime
tools = list(self._tool_registry.get_tools().values())