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
147 changes: 15 additions & 132 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

jobs:
test:
name: Release tests (Python ${{ matrix.python-version }})
name: Security tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -52,11 +52,7 @@ jobs:
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[identity-runtime]" \
-e packages/agentkit-harness-sidecar-integration \
pytest \
"setuptools>=77" \
wheel
python -m pip install ".[identity-runtime]" pytest

- name: Run identity and Agent Server security tests
run: |
Expand All @@ -66,14 +62,6 @@ jobs:
tests/apps/test_agent_server_invoke.py \
tests/apps/test_agent_server_loader.py

- name: Run Harness Sidecar integration tests
run: |
python -m pytest -q \
packages/agentkit-harness-sidecar-integration/tests \
tests/test_optional_sidecar_packaging.py \
tests/toolkit/cli/test_plugin_loader.py \
tests/toolkit/test_harness_extension_hooks.py

publish:
name: Build and publish
needs: test
Expand Down Expand Up @@ -165,17 +153,13 @@ jobs:
PY

- name: Build release artifacts
run: |
python -m build --outdir dist/sdk
python -m build \
--outdir dist/integration \
packages/agentkit-harness-sidecar-integration
run: python -m build --outdir dist

- name: Verify artifacts
shell: bash
run: |
set -euo pipefail
python -m twine check dist/sdk/* dist/integration/*
python -m twine check dist/*
python - <<'PY'
from __future__ import annotations

Expand All @@ -185,17 +169,9 @@ jobs:
from pathlib import Path

expected = "${{ steps.version.outputs.version }}"
integration_version = "0.1.0"
sdk_dist = Path("dist/sdk")
integration_dist = Path("dist/integration")
wheel = next(sdk_dist.glob("agentkit_sdk_python-*.whl"))
sdist = next(sdk_dist.glob("agentkit_sdk_python-*.tar.gz"))
integration_wheel = next(
integration_dist.glob("agentkit_harness_sidecar_integration-*.whl")
)
integration_sdist = next(
integration_dist.glob("agentkit_harness_sidecar_integration-*.tar.gz")
)
dist = Path("dist")
wheel = next(dist.glob("agentkit_sdk_python-*.whl"))
sdist = next(dist.glob("agentkit_sdk_python-*.tar.gz"))

with zipfile.ZipFile(wheel) as archive:
names = archive.namelist()
Expand All @@ -205,61 +181,18 @@ jobs:
)
metadata = archive.read(metadata_name).decode()

with zipfile.ZipFile(integration_wheel) as archive:
integration_names = archive.namelist()
integration_metadata_name = next(
name for name in integration_names
if name.endswith(".dist-info/METADATA")
)
integration_metadata = archive.read(
integration_metadata_name
).decode()

with tarfile.open(sdist) as archive:
root = archive.getnames()[0].split("/", 1)[0]
pyproject = archive.extractfile(f"{root}/pyproject.toml").read().decode()
sdist_version_py = (
archive.extractfile(f"{root}/agentkit/version.py").read().decode()
)

with tarfile.open(integration_sdist) as archive:
integration_root = archive.getnames()[0].split("/", 1)[0]
integration_pyproject = archive.extractfile(
f"{integration_root}/pyproject.toml"
).read().decode()

normalized_sdk_metadata = metadata.lower().replace("_", "-")
normalized_integration_metadata = (
integration_metadata.lower().replace("_", "-")
)
module_prefix = "agentkit/extensions/harness_sidecar/"

checks = {
"wheel metadata": f"Version: {expected}" in metadata,
"wheel version.py": f'VERSION = "{expected}"' in version_py,
"sdist pyproject": f'version = "{expected}"' in pyproject,
"sdist version.py": f'VERSION = "{expected}"' in sdist_version_py,
"SDK excludes optional integration modules": not any(
name.startswith(module_prefix) for name in names
),
"SDK declares the Sidecar extra": (
"provides-extra: harness-sidecar" in normalized_sdk_metadata
and "agentkit-harness-sidecar-integration" in normalized_sdk_metadata
),
"integration wheel version": (
f"version: {integration_version}"
in normalized_integration_metadata
),
"integration depends on SDK 0.8.2": (
"agentkit-sdk-python<0.9.0,>=0.8.2"
in normalized_integration_metadata
),
"integration wheel contains public modules": any(
name.startswith(module_prefix) for name in integration_names
),
"integration sdist version": (
f'version = "{integration_version}"' in integration_pyproject
),
}
failed = [name for name, ok in checks.items() if not ok]
if failed:
Expand All @@ -279,79 +212,29 @@ jobs:
import venv
from pathlib import Path

base_smoke = Path("/tmp/agentkit-base-wheel-smoke")
sidecar_smoke = Path("/tmp/agentkit-sidecar-wheel-smoke")
venv.EnvBuilder(with_pip=True, clear=True).create(base_smoke)
venv.EnvBuilder(with_pip=True, clear=True).create(sidecar_smoke)
base_python = base_smoke / "bin" / "python"
sidecar_python = sidecar_smoke / "bin" / "python"
sdk_dist = Path("dist/sdk")
integration_dist = Path("dist/integration")
wheel = next(sdk_dist.glob("agentkit_sdk_python-*.whl"))

smoke = Path("/tmp/agentkit-wheel-smoke")
venv.EnvBuilder(with_pip=True, clear=True).create(smoke)
python = smoke / "bin" / "python"
wheel = next(Path("dist").glob("agentkit_sdk_python-*.whl"))
subprocess.check_call(
[
str(base_python),
"-m",
"pip",
"install",
f"{wheel}[identity-runtime]",
]
[str(python), "-m", "pip", "install", f"{wheel}[identity-runtime]"]
)
subprocess.check_call(
[
str(base_python),
str(python),
"-I",
"-c",
(
"import importlib.util; "
"from agentkit.identity import IdentityRuntimeConfig, "
"RuntimeIdentity; "
"from agentkit.apps import AgentkitAgentServerApp; "
"assert importlib.util.find_spec("
"'agentkit.extensions.harness_sidecar') is None"
),
]
)

subprocess.check_call(
[
str(sidecar_python),
"-m",
"pip",
"install",
"--find-links",
str(integration_dist),
f"{wheel}[identity-runtime,harness-sidecar]",
]
)
subprocess.check_call(
[
str(sidecar_python),
"-I",
"-c",
(
"from agentkit.identity import IdentityRuntimeConfig, "
"RuntimeIdentity; "
"from agentkit.apps import AgentkitAgentServerApp; "
"from agentkit.extensions.harness_sidecar import "
"HarnessSidecarConfig, resolve_harness_sidecar_selection"
"from agentkit.apps import AgentkitAgentServerApp"
),
]
)
PY

- name: Publish Harness Sidecar integration to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_SIDECAR_INTEGRATION_API_TOKEN }}
packages-dir: dist/integration
skip-existing: true

- name: Publish AgentKit SDK to PyPI
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist/sdk
17 changes: 0 additions & 17 deletions agentkit/extensions/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions agentkit/toolkit/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from agentkit.toolkit.cli.cli_list import list_app
from agentkit.toolkit.cli.cli_delete import delete_app
from agentkit.toolkit.cli.cli_logs import logs_command
from agentkit.toolkit.cli.plugin_loader import load_cli_plugins

# Note: Avoid importing heavy packages at the top to keep CLI startup fast

Expand Down Expand Up @@ -135,7 +134,6 @@ def main(
app.add_typer(add_app, name="add")
app.add_typer(list_app, name="list")
app.add_typer(delete_app, name="delete")
load_cli_plugins(app)


if __name__ == "__main__":
Expand Down
72 changes: 0 additions & 72 deletions agentkit/toolkit/cli/plugin_loader.py

This file was deleted.

3 changes: 0 additions & 3 deletions agentkit/toolkit/harness/config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def build_agentkit_config(
envs: Dict[str, str],
auth: Optional[Dict[str, Any]] = None,
runtime_id: str = "Auto",
cloud_config_overrides: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
"""Build the cloud AgentKit launch config dict (auto-provision).

Expand Down Expand Up @@ -65,8 +64,6 @@ def build_agentkit_config(
cloud["runtime_apikey_name"] = "Auto"
cloud["runtime_apikey"] = "Auto"
cloud["runtime_jwt_allowed_clients"] = []
if cloud_config_overrides:
cloud.update(cloud_config_overrides)
return {
"common": {
"agent_name": runtime_name,
Expand Down
7 changes: 1 addition & 6 deletions agentkit/toolkit/harness/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ def deploy_harness(
secret_key: Optional[str] = None,
discovery_url: Optional[str] = None,
allowed_id: Optional[str] = None,
runtime_env_builder: Optional[Callable[[Dict[str, Any]], Dict[str, str]]] = None,
cloud_config_overrides: Optional[Dict[str, Any]] = None,
reporter: Optional[Reporter] = None,
on_conflict: Optional[Callable[[Dict[str, Any]], bool]] = None,
) -> LifecycleResult:
Expand Down Expand Up @@ -230,8 +228,6 @@ def deploy_harness(
region: AgentKit region (default ``cn-beijing`` or ``VOLCENGINE_REGION``).
access_key / secret_key: Volcengine credentials (default: ``VOLCENGINE_*`` env).
discovery_url / allowed_id: OAuth2/JWT overrides for the spec ``auth`` block.
runtime_env_builder: Optional environment builder used by extensions.
cloud_config_overrides: Optional cloud launch configuration overrides.
reporter: Progress reporter forwarded to the launch (default: silent).
on_conflict: Callback consulted when a single same-name harness exists;
returns True to update it, False to abort.
Expand Down Expand Up @@ -263,7 +259,7 @@ def deploy_harness(
os.environ.setdefault(key, value)

spec = _load_harness_spec(proj_dir / f"{name}.harness.json")
runtime_envs = (runtime_env_builder or to_runtime_env)(spec)
runtime_envs = to_runtime_env(spec)
runtime_name = name
auth = _resolve_auth(spec.get("auth"), discovery_url, allowed_id)

Expand Down Expand Up @@ -332,7 +328,6 @@ def deploy_harness(
runtime_envs,
auth,
runtime_id=update_runtime_id or "Auto",
cloud_config_overrides=cloud_config_overrides,
)

# AgentKit's launch path exposes no hook for runtime tags, so tag the runtime
Expand Down
Loading