diff --git a/sdks/python/oss/tests/pytest/acceptance/workflows/test_new_uri_handlers.py b/sdks/python/oss/tests/pytest/acceptance/workflows/test_new_uri_handlers.py index 027ca2b11d..adfae03ef8 100644 --- a/sdks/python/oss/tests/pytest/acceptance/workflows/test_new_uri_handlers.py +++ b/sdks/python/oss/tests/pytest/acceptance/workflows/test_new_uri_handlers.py @@ -502,6 +502,10 @@ def test_prompt_alias_is_not_registered(self): assert retrieve_handler("agenta:builtin:prompt:v0") is None assert retrieve_interface("agenta:builtin:prompt:v0") is None - def test_agent_alias_is_not_registered(self): + def test_agent_interface_is_registered_without_handler(self): + # The agent builtin ships an interface (schemas) but no in-process handler: + # the agent runs in the sidecar, not via a registered SDK callable. assert retrieve_handler("agenta:builtin:agent:v0") is None - assert retrieve_interface("agenta:builtin:agent:v0") is None + revision = retrieve_interface("agenta:builtin:agent:v0") + assert isinstance(revision, WorkflowRevisionData) + assert revision.uri == "agenta:builtin:agent:v0" diff --git a/services/oss/tests/pytest/integration/agent/conftest.py b/services/oss/tests/pytest/integration/agent/conftest.py index dfc223343c..ba8821a017 100644 --- a/services/oss/tests/pytest/integration/agent/conftest.py +++ b/services/oss/tests/pytest/integration/agent/conftest.py @@ -1,9 +1,10 @@ """Integration fixtures: a fake httpx client for the tool/secret resolvers. These tests wire the real resolver code against a mocked HTTP boundary (no live backend, no -respx/pytest-httpx dependency). ``install_http`` patches, in a given resolver module, the two -``client`` helpers (``agenta_api_base`` / ``request_authorization``) plus ``httpx.AsyncClient``, -and returns a ``capture`` dict the test can assert the outgoing request against. +respx/pytest-httpx dependency). ``install_http`` patches the two ``PlatformConnection`` helpers +(``_derive_base_url`` / ``_derive_authorization`` in the SDK platform connection module) plus +``httpx.AsyncClient`` in the given SDK platform module that performs the HTTP, and returns a +``capture`` dict the test can assert the outgoing request against. """ from __future__ import annotations @@ -13,6 +14,8 @@ import pytest +from agenta.sdk.agents.platform import connection as platform_connection + class _FakeResponse: def __init__(self, status_code: int, payload: Any, text: Optional[str]) -> None: @@ -63,8 +66,10 @@ def _install( authorization: Optional[str] = "Access tok", ) -> Dict[str, Any]: capture: Dict[str, Any] = {} - monkeypatch.setattr(module, "agenta_api_base", lambda: api_base) - monkeypatch.setattr(module, "request_authorization", lambda: authorization) + monkeypatch.setattr(platform_connection, "_derive_base_url", lambda: api_base) + monkeypatch.setattr( + platform_connection, "_derive_authorization", lambda: authorization + ) response = _FakeResponse(status, payload, text) monkeypatch.setattr( module.httpx, diff --git a/services/oss/tests/pytest/integration/agent/test_resolve_secrets_http.py b/services/oss/tests/pytest/integration/agent/test_resolve_secrets_http.py index 8eb4f45a01..ec9f405d31 100644 --- a/services/oss/tests/pytest/integration/agent/test_resolve_secrets_http.py +++ b/services/oss/tests/pytest/integration/agent/test_resolve_secrets_http.py @@ -8,20 +8,20 @@ import pytest -from oss.src.agent import secrets from oss.src.agent.secrets import resolve_harness_secrets +from agenta.sdk.agents.platform import secrets as platform_secrets pytestmark = pytest.mark.integration async def test_no_api_base_returns_empty(install_http): - install_http(secrets, api_base=None) + install_http(platform_secrets, api_base=None) assert await resolve_harness_secrets() == {} async def test_maps_only_provider_keys_with_dedupe(install_http): install_http( - secrets, + platform_secrets, status=200, payload=[ { @@ -55,10 +55,10 @@ async def test_maps_only_provider_keys_with_dedupe(install_http): async def test_http_error_returns_empty(install_http): - install_http(secrets, status=400) + install_http(platform_secrets, status=400) assert await resolve_harness_secrets() == {} async def test_network_exception_returns_empty(install_http): - install_http(secrets, raises=RuntimeError("network down")) + install_http(platform_secrets, raises=RuntimeError("network down")) assert await resolve_harness_secrets() == {} diff --git a/services/oss/tests/pytest/integration/agent/tools/test_gateway_http.py b/services/oss/tests/pytest/integration/agent/tools/test_gateway_http.py index 1664e8fcfe..72641add84 100644 --- a/services/oss/tests/pytest/integration/agent/tools/test_gateway_http.py +++ b/services/oss/tests/pytest/integration/agent/tools/test_gateway_http.py @@ -9,7 +9,7 @@ ) from oss.src.agent.tools import resolve_tools -from oss.src.agent.tools import gateway +from agenta.sdk.agents.platform import gateway pytestmark = pytest.mark.integration diff --git a/services/oss/tests/pytest/integration/agent/tools/test_secrets_http.py b/services/oss/tests/pytest/integration/agent/tools/test_secrets_http.py index 2aea5678fb..a599e360d7 100644 --- a/services/oss/tests/pytest/integration/agent/tools/test_secrets_http.py +++ b/services/oss/tests/pytest/integration/agent/tools/test_secrets_http.py @@ -3,13 +3,14 @@ import pytest from oss.src.agent.tools import secrets +from agenta.sdk.agents.platform import secrets as platform_secrets pytestmark = pytest.mark.integration async def test_named_secrets_are_resolved_by_tools_adapter(install_http): capture = install_http( - secrets, + platform_secrets, payload={"secrets": {"TOKEN": "value", "EMPTY": None}}, ) @@ -28,12 +29,12 @@ async def test_named_secrets_are_resolved_by_tools_adapter(install_http): async def test_named_secrets_without_api_base_return_empty(install_http): - install_http(secrets, api_base=None) + install_http(platform_secrets, api_base=None) assert await secrets.resolve_named_secrets(["TOKEN"]) == {} async def test_named_secret_http_failure_returns_empty(install_http): - install_http(secrets, status=500) + install_http(platform_secrets, status=500) assert await secrets.resolve_named_secrets(["TOKEN"]) == {}