Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ak-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ authors = [
{ name = "Yaala Labs", email = "[email protected]" }
]
dependencies = [
"deprecated>=1.3.1",
"pydantic>=2.11.7",
"pydantic-settings>=2.10.1",
"pyyaml>=6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions ak-py/src/agentkernel/a2a/a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from a2a.utils import new_agent_text_message
from a2a.utils.errors import ServerError

from ..core import Agent, AgentService, Runtime
from ..core import Agent, AgentService, GlobalRuntime
from ..core.config import AKConfig


Expand Down Expand Up @@ -69,7 +69,7 @@ def _build(cls):
return
if not AKConfig.get().a2a.enabled:
return
agents: dict[str, Agent] = Runtime.instance().agents()
agents: dict[str, Agent] = GlobalRuntime.instance().agents()
for name, agent in agents.items():
whitelisted = AKConfig.get().a2a.agents == ["*"] or name in AKConfig.get().a2a.agents
if not whitelisted:
Expand Down
4 changes: 2 additions & 2 deletions ak-py/src/agentkernel/api/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pydantic import BaseModel

from ..api.rest_request_handler import RESTRequestHandler
from ..core import AgentService, Runtime
from ..core import AgentService, GlobalRuntime


class AgentRESTRequestHandler(RESTRequestHandler):
Expand Down Expand Up @@ -41,7 +41,7 @@ def health():

@router.get("/agents")
def list_agents():
return {"agents": list(Runtime.instance().agents().keys())}
return {"agents": list(GlobalRuntime.instance().agents().keys())}

@router.post("/run")
async def run(req: AgentRESTRequestHandler.RunRequest):
Expand Down
2 changes: 1 addition & 1 deletion ak-py/src/agentkernel/api/rest_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def health():

@router.get("/agents")
def list_agents():
return {"agents": list(Runtime.instance().agents().keys())}
return {"agents": list(GlobalRuntime.instance().agents().keys())}

"""
pass
2 changes: 1 addition & 1 deletion ak-py/src/agentkernel/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
from .base import Agent, Runner, Session
from .config import AKConfig as Config
from .module import Module
from .runtime import Runtime
from .runtime import GlobalRuntime, Runtime
from .service import AgentService
from .sessions.redis import RedisDriver, RedisSessionSerde
2 changes: 2 additions & 0 deletions ak-py/src/agentkernel/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from types import ModuleType
from typing import Any, Optional

from deprecated import deprecated
from singleton_type import Singleton

from .base import Agent, Session
Expand Down Expand Up @@ -48,6 +49,7 @@ def __exit__(self, exc_type, exc_val, exc_tb) -> None:
"""
ModuleLoader.detach(self)

@deprecated(version="0.2.4", reason="Use GlobalRuntime.instance() instead")
@staticmethod
def instance() -> "Runtime":
"""
Expand Down
4 changes: 2 additions & 2 deletions ak-py/src/agentkernel/core/service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import uuid

from ..core import Agent, Runtime, Session
from ..core import Agent, GlobalRuntime, Runtime, Session


class AgentService:
Expand All @@ -14,7 +14,7 @@ def __init__(self):
self._log = logging.getLogger("ak.core.service.agentservice")
self._agent = None
self._session = None
self._runtime = Runtime.instance()
self._runtime = GlobalRuntime.instance()

@property
def runtime(self) -> Runtime:
Expand Down
4 changes: 2 additions & 2 deletions ak-py/src/agentkernel/mcp/akmcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from fastmcp import Context, FastMCP
from fastmcp.server.http import StarletteWithLifespan

from ..core import Agent, AgentService, Runtime
from ..core import Agent, AgentService, GlobalRuntime
from ..core.config import AKConfig


Expand Down Expand Up @@ -60,7 +60,7 @@ def _build(cls):
if cls._fastmcp is None:
cls._fastmcp = FastMCP("Agent Kernel FastMCP Instance")
if AKConfig.get().mcp.expose_agents:
agents: dict[str, Agent] = Runtime.instance().agents()
agents: dict[str, Agent] = GlobalRuntime.instance().agents()
for name, agent in agents.items():
whitelisted = AKConfig.get().mcp.agents == ["*"] or name in AKConfig.get().mcp.agents
if not whitelisted:
Expand Down
83 changes: 83 additions & 0 deletions ak-py/uv.lock

Large diffs are not rendered by default.

Loading