agentsystems-sdk 0.3.4__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
agentsystems_sdk/cli.py CHANGED
@@ -23,6 +23,9 @@ from agentsystems_sdk.commands import (
23
23
  run_command,
24
24
  artifacts_path_command,
25
25
  clean_command,
26
+ update_command,
27
+ version_command,
28
+ versions_command,
26
29
  )
27
30
 
28
31
  # Load .env before Typer parses env-var options
@@ -85,6 +88,9 @@ app.command(name="status")(status_command)
85
88
  app.command(name="run")(run_command)
86
89
  app.command(name="artifacts-path")(artifacts_path_command)
87
90
  app.command(name="clean")(clean_command)
91
+ app.command(name="update")(update_command)
92
+ app.command(name="version")(version_command)
93
+ app.command(name="versions")(versions_command)
88
94
 
89
95
 
90
96
  if __name__ == "__main__":
@@ -9,6 +9,8 @@ from .status import status_command
9
9
  from .run import run_command
10
10
  from .artifacts import artifacts_path_command
11
11
  from .clean import clean_command
12
+ from .update import update_command
13
+ from .version import version_command, versions_command
12
14
 
13
15
  __all__ = [
14
16
  "init_command",
@@ -20,4 +22,7 @@ __all__ = [
20
22
  "run_command",
21
23
  "artifacts_path_command",
22
24
  "clean_command",
25
+ "update_command",
26
+ "version_command",
27
+ "versions_command",
23
28
  ]
@@ -116,6 +116,18 @@ def setup_agents_from_config(
116
116
  if not reg or not reg.enabled:
117
117
  continue # skip disabled registries
118
118
 
119
+ # Check if all images for this registry are already present
120
+ env_base = os.environ.copy()
121
+ missing_images = [
122
+ a.image for a in agents_list if not _image_exists(a.image, env_base)
123
+ ]
124
+
125
+ if not missing_images:
126
+ console.print(
127
+ f"[green]✓ All images from {reg.url} already present, skipping login.[/green]"
128
+ )
129
+ continue
130
+
119
131
  # Create a fresh Docker config dir so credentials don't clobber
120
132
  with tempfile.TemporaryDirectory(
121
133
  prefix="agentsystems-docker-config-"
@@ -346,6 +358,18 @@ def up_command(
346
358
  dir_okay=False,
347
359
  resolve_path=True,
348
360
  ),
361
+ agent_control_plane_version: Optional[str] = typer.Option(
362
+ None,
363
+ "--agent-control-plane",
364
+ "--acp",
365
+ help="Pin agent-control-plane to specific version (e.g., 0.3.17)",
366
+ ),
367
+ agentsystems_ui_version: Optional[str] = typer.Option(
368
+ None,
369
+ "--agentsystems-ui",
370
+ "--ui",
371
+ help="Pin agentsystems-ui to specific version (e.g., 0.1.5)",
372
+ ),
349
373
  ) -> None:
350
374
  """Start the full AgentSystems platform via docker compose.
351
375
 
@@ -366,6 +390,64 @@ def up_command(
366
390
  env_base = os.environ.copy()
367
391
  env_base["DOCKER_CONFIG"] = isolated_cfg.name
368
392
 
393
+ # Validate and set version tags from CLI flags if provided
394
+ def _validate_version(version_str: str, min_version: str, component: str) -> bool:
395
+ """Validate that version meets minimum requirements for version management features."""
396
+ import re
397
+
398
+ # Skip validation for special tags
399
+ if version_str in ["latest", "main", "development"]:
400
+ return True
401
+
402
+ # Validate semantic version format
403
+ if not re.match(r"^\d+\.\d+\.\d+$", version_str):
404
+ console.print(
405
+ f"[red]❌ Error: {component} version must be semantic version (x.y.z format)[/red]"
406
+ )
407
+ console.print(f"[red] You provided: {version_str}[/red]")
408
+ console.print("[red] Valid examples: 0.4.0, 1.2.3[/red]")
409
+ return False
410
+
411
+ # Simple version comparison (works for our use case)
412
+ def version_tuple(v):
413
+ return tuple(map(int, v.split(".")))
414
+
415
+ try:
416
+ if version_tuple(version_str) < version_tuple(min_version):
417
+ console.print(
418
+ f"[red]❌ Error: {component} version {version_str} does not support version management[/red]"
419
+ )
420
+ console.print(
421
+ f"[red] Minimum required {component}: {min_version}[/red]"
422
+ )
423
+ console.print(
424
+ "[red] This version introduced /version and /component-versions endpoints[/red]"
425
+ )
426
+ return False
427
+ except Exception:
428
+ console.print(f"[red]❌ Error: Invalid version format: {version_str}[/red]")
429
+ return False
430
+
431
+ return True
432
+
433
+ if agent_control_plane_version:
434
+ if not _validate_version(
435
+ agent_control_plane_version, "0.4.0", "agent-control-plane"
436
+ ):
437
+ raise typer.Exit(1)
438
+ env_base["ACP_TAG"] = agent_control_plane_version
439
+ console.print(
440
+ f"[yellow]📌 Pinning agent-control-plane to version: {agent_control_plane_version}[/yellow]"
441
+ )
442
+
443
+ if agentsystems_ui_version:
444
+ if not _validate_version(agentsystems_ui_version, "0.2.0", "agentsystems-ui"):
445
+ raise typer.Exit(1)
446
+ env_base["UI_TAG"] = agentsystems_ui_version
447
+ console.print(
448
+ f"[yellow]📌 Pinning agentsystems-ui to version: {agentsystems_ui_version}[/yellow]"
449
+ )
450
+
369
451
  # .env gets loaded later – keep env_base in sync
370
452
  def _sync_env_base() -> None:
371
453
  env_base.update(os.environ)
@@ -0,0 +1,88 @@
1
+ """Update core platform images."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import pathlib
6
+ from typing import Optional
7
+
8
+ import typer
9
+ from rich.console import Console
10
+ from rich.progress import Progress, SpinnerColumn, TextColumn
11
+
12
+ from ..utils import ensure_docker_installed, run_command
13
+
14
+ console = Console()
15
+
16
+
17
+ def update_command(
18
+ project_dir: Optional[pathlib.Path] = typer.Argument(
19
+ None,
20
+ exists=True,
21
+ file_okay=False,
22
+ dir_okay=True,
23
+ readable=True,
24
+ resolve_path=True,
25
+ help="Project directory (defaults to current directory)",
26
+ ),
27
+ ) -> None:
28
+ """Update core AgentSystems platform images to latest versions.
29
+
30
+ Pulls the latest versions of:
31
+ - agent-control-plane (gateway)
32
+ - agentsystems-ui (web interface)
33
+
34
+ This is faster than re-running 'agentsystems up' when you only need
35
+ to update the core platform components.
36
+ """
37
+ if project_dir is None:
38
+ project_dir = pathlib.Path.cwd()
39
+
40
+ project_dir = project_dir.expanduser().resolve()
41
+
42
+ # Verify this is an AgentSystems project
43
+ config_file = project_dir / "agentsystems-config.yml"
44
+ if not config_file.exists():
45
+ console.print(f"[red]✗ No agentsystems-config.yml found in {project_dir}[/red]")
46
+ console.print("This doesn't appear to be an AgentSystems project directory.")
47
+ raise typer.Exit(code=1)
48
+
49
+ ensure_docker_installed()
50
+
51
+ # Core platform images to update
52
+ core_images = [
53
+ "ghcr.io/agentsystems/agent-control-plane:latest",
54
+ "ghcr.io/agentsystems/agentsystems-ui:latest",
55
+ ]
56
+
57
+ console.print("\n[bold cyan]Updating AgentSystems core platform images[/bold cyan]")
58
+
59
+ with Progress(
60
+ SpinnerColumn(style="cyan"),
61
+ TextColumn("[bold]{task.description}"),
62
+ console=console,
63
+ ) as progress:
64
+
65
+ for image in core_images:
66
+ task = progress.add_task(f"Updating {image.split('/')[-1]}", total=None)
67
+
68
+ try:
69
+ progress.stop() # Stop to show docker output
70
+ run_command(["docker", "pull", image])
71
+ progress.start() # Restart progress
72
+ progress.update(task, description=f"✓ Updated {image.split('/')[-1]}")
73
+ except typer.Exit:
74
+ progress.start() # Ensure progress is restarted
75
+ progress.update(
76
+ task, description=f"✗ Failed to update {image.split('/')[-1]}"
77
+ )
78
+ console.print(f"[red]Failed to pull {image}[/red]")
79
+ raise
80
+ finally:
81
+ progress.start() # Always ensure progress is running
82
+
83
+ console.print("\n[green]✅ Core platform images updated successfully![/green]")
84
+ console.print("\n[bold]Next steps:[/bold]")
85
+ console.print(" • Run [cyan]agentsystems restart[/cyan] to use the updated images")
86
+ console.print(
87
+ " • Or [cyan]agentsystems down && agentsystems up[/cyan] for a full restart"
88
+ )
@@ -0,0 +1,86 @@
1
+ """Version information command for AgentSystems SDK."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib.metadata
6
+ from rich.console import Console
7
+ from rich.table import Table
8
+
9
+ console = Console()
10
+
11
+
12
+ def version_command() -> None:
13
+ """Display SDK version information only.
14
+
15
+ For all component versions, use 'agentsystems versions'.
16
+ """
17
+ # Just show SDK version
18
+ try:
19
+ sdk_version = importlib.metadata.version("agentsystems-sdk")
20
+ except importlib.metadata.PackageNotFoundError:
21
+ sdk_version = "unknown (development mode)"
22
+ console.print(f"AgentSystems SDK: {sdk_version}")
23
+
24
+
25
+ def versions_command() -> None:
26
+ """Display version information for all AgentSystems components.
27
+
28
+ Queries the running deployment to show current versions and update status.
29
+ Only works when a deployment is running.
30
+ """
31
+ table = Table(title="AgentSystems Component Versions")
32
+ table.add_column("Component", style="cyan")
33
+ table.add_column("Version", style="green")
34
+ table.add_column("Status", style="yellow")
35
+
36
+ # SDK version
37
+ try:
38
+ sdk_version = importlib.metadata.version("agentsystems-sdk")
39
+ table.add_row("AgentSystems SDK", sdk_version, "✓ Installed")
40
+ except importlib.metadata.PackageNotFoundError:
41
+ table.add_row("AgentSystems SDK", "unknown", "⚠ Development mode")
42
+
43
+ # Try to query running deployment for gateway and UI versions
44
+ try:
45
+ import requests
46
+
47
+ resp = requests.get("http://localhost:18080/component-versions", timeout=5)
48
+ if resp.status_code == 200:
49
+ data = resp.json()
50
+ components = data.get("components", {})
51
+
52
+ # Agent Control Plane
53
+ acp = components.get("agent-control-plane", {})
54
+ acp_version = acp.get("current_version", "unknown")
55
+ acp_update = acp.get("update_available", False)
56
+ acp_status = "✓ Running" + (
57
+ " (update available)" if acp_update else " (latest)"
58
+ )
59
+ table.add_row("Agent Control Plane", acp_version, acp_status)
60
+
61
+ # AgentSystems UI
62
+ ui = components.get("agentsystems-ui", {})
63
+ ui_version = ui.get("current_version", "unknown")
64
+ ui_update = ui.get("update_available", False)
65
+ ui_status = "✓ Running" + (
66
+ " (update available)" if ui_update else " (latest)"
67
+ )
68
+ table.add_row("AgentSystems UI", ui_version, ui_status)
69
+
70
+ else:
71
+ table.add_row(
72
+ "Agent Control Plane", "unknown", "⚠ Deployment not accessible"
73
+ )
74
+ table.add_row("AgentSystems UI", "unknown", "⚠ Deployment not accessible")
75
+
76
+ except Exception:
77
+ # Deployment not running or not accessible
78
+ table.add_row("Agent Control Plane", "N/A", "⚠ Deployment not running")
79
+ table.add_row("AgentSystems UI", "N/A", "⚠ Deployment not running")
80
+
81
+ console.print(table)
82
+ # Note: Simple check since Rich table internals are complex
83
+ if "⚠" in str(table):
84
+ console.print(
85
+ "\n[dim]Note: Start deployment with 'agentsystems up' to check running versions[/dim]"
86
+ )
agentsystems_sdk/utils.py CHANGED
@@ -263,9 +263,9 @@ def get_required_images() -> List[str]:
263
263
  Returns:
264
264
  List of Docker image names
265
265
  """
266
- return [
267
- "ghcr.io/agentsystems/agent-control-plane:latest",
268
- ]
266
+ # Control plane and other images are pulled during 'agentsystems up'
267
+ # when the docker-compose file is processed, not during init
268
+ return []
269
269
 
270
270
 
271
271
  def cleanup_langfuse_init_vars(env_path: pathlib.Path) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentsystems-sdk
3
- Version: 0.3.4
3
+ Version: 0.4.0
4
4
  Summary: AgentSystems Python SDK and CLI
5
5
  Author-email: AgentSystems <support@agentsystems.ai>
6
6
  License-Expression: Apache-2.0
@@ -91,6 +91,7 @@ All commands are available through `agentsystems` (or the shorter alias `agntsys
91
91
  | `agentsystems version` | Show the installed SDK version. |
92
92
  | `agentsystems artifacts-path THREAD_ID [REL_PATH]` | Resolve a path inside the shared artifacts volume using thread-centric structure. |
93
93
  | `agentsystems run AGENT PAYLOAD` | Invoke an agent with JSON payload and optional file uploads, stream progress, and return results. |
94
+ | `agentsystems update [PROJECT_DIR]` | Update core platform images (agent-control-plane, agentsystems-ui) to latest versions. Faster than re-running `up` when you only need to update platform components. |
94
95
 
95
96
  ### `up` options
96
97
 
@@ -1,9 +1,9 @@
1
1
  agentsystems_sdk/__init__.py,sha256=e0cW9_DFgYAM8oTyOXL_FyuqF_PELxPGLKTayhp4PqA,407
2
- agentsystems_sdk/cli.py,sha256=rfHvkBI3Y6QSz8vFmxAyLT0hk1DnXBpXsKhqJ2sFpeg,2310
2
+ agentsystems_sdk/cli.py,sha256=6x_ZQ7nSKyGEzsQpUtLTkiVjhX7gqrgkkjmtofH7Qs4,2508
3
3
  agentsystems_sdk/config.py,sha256=-rlUtexDEg_PuEjM4x_kCMLnb5zvKkTNdKs1PbH-7ck,6659
4
4
  agentsystems_sdk/progress_tracker.py,sha256=34zW26QPlCGORkOYOK0cqbYIGvl5ga4Jp9cTN4Ar0RU,4082
5
- agentsystems_sdk/utils.py,sha256=8971J2BzjeEGfmewU_iX8TUg2_3Umd4MmfrM_QdfHgQ,9156
6
- agentsystems_sdk/commands/__init__.py,sha256=b_lONb7CywM_wCBBYYrTCFi8kvxFc8M6j5IWc2Mg0kg,542
5
+ agentsystems_sdk/utils.py,sha256=sdza_FsmoZ8L4gS0HU3jQ6JjNfL030dhIkS8IOp5S6o,9230
6
+ agentsystems_sdk/commands/__init__.py,sha256=spKxXRRsyD8huKx8U2E_NOd2AspB1cr6Fto_Plt89UI,701
7
7
  agentsystems_sdk/commands/artifacts.py,sha256=KTOEu0Cg9aeFEaNfOUW-lSJM7dewOC9KJYtyw8vESM4,1113
8
8
  agentsystems_sdk/commands/clean.py,sha256=-wyy7CleRmEew3SUlff0iYsCMLsj_JcwhlpqgQYhZZk,1942
9
9
  agentsystems_sdk/commands/down.py,sha256=z8VHzLfrxiVeedR9fl4CSjNPKuZ_0_R2vKI46rhEVRw,3318
@@ -12,7 +12,9 @@ agentsystems_sdk/commands/logs.py,sha256=2BpoXuQr_Vq_ou7oj1x-oYC552enWZiuKqoOEJO
12
12
  agentsystems_sdk/commands/restart.py,sha256=-UBZyHMfyQeG2pl-Mtff3cM6ziUvHrJVgqKl7sVWD0o,1923
13
13
  agentsystems_sdk/commands/run.py,sha256=3ptW48sq4APvY05AvCmBTdqcRfS3puERiFuInE2ddJ4,5440
14
14
  agentsystems_sdk/commands/status.py,sha256=C-9-eLG_gbDB4T69g4B3QjT41ASOZWjbEZydn2kcXM4,876
15
- agentsystems_sdk/commands/up.py,sha256=dy0a58DubwznbongbjYRMXUUZdVHvIzkmjW68fXMwPY,16702
15
+ agentsystems_sdk/commands/up.py,sha256=HCWHlXjP_bPLUvOsrTtu8YRKUWysCKE9e3SRZG_yXaA,19913
16
+ agentsystems_sdk/commands/update.py,sha256=mY3Yfk_X-P5CYE3wR1cZ4DzmrDknYXWl41ZwjDUvtNM,2968
17
+ agentsystems_sdk/commands/version.py,sha256=sNmppGZucbc7UGY_YyiZy-wobeVxu7OMgH0vuz7Y7Ks,3179
16
18
  agentsystems_sdk/deployments_scaffold/.env.example,sha256=RBRZicUDHCnpozFMgT__IceUV69B7WNLUXHElkcXCD8,634
17
19
  agentsystems_sdk/deployments_scaffold/CONTRIBUTING.md,sha256=UgQ-CETCvOiMRszSxPBQURWJkAuAj-KwO42V7csQe1I,1145
18
20
  agentsystems_sdk/deployments_scaffold/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
@@ -28,10 +30,10 @@ agentsystems_sdk/deployments_scaffold/compose/local/db-backup/Dockerfile,sha256=
28
30
  agentsystems_sdk/deployments_scaffold/compose/local/db-backup/entrypoint.sh,sha256=7as7UNRCR5ziTOUWJGHtPgCb70oNLImWmGJsgTy0t-A,2462
29
31
  agentsystems_sdk/deployments_scaffold/compose/local/postgres-init/audit.sql,sha256=96812AZ2Tm57rmIi5de2nsAwxnn_AkJmavJgBn_MKKE,1796
30
32
  agentsystems_sdk/deployments_scaffold/schema/agentsystems-config.schema.json,sha256=fhZfE_fVSbv0vYvh9JT5EZC2XYjp9v54cP0UK6hH18A,1374
31
- agentsystems_sdk-0.3.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
- agentsystems_sdk-0.3.4.dist-info/licenses/NOTICE,sha256=SGMFwyEoZ6NG19ZrdvwYt43lig12rEl5z8XvWMGej6c,918
33
- agentsystems_sdk-0.3.4.dist-info/METADATA,sha256=Krz6sw23zsrCysUiGS4VW9BeI123jkLnzV8gOCnCPUU,11687
34
- agentsystems_sdk-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- agentsystems_sdk-0.3.4.dist-info/entry_points.txt,sha256=0lejF8v40DAB0D2612UWLLA3e1Ux8TyyLU6yJc0vQkQ,93
36
- agentsystems_sdk-0.3.4.dist-info/top_level.txt,sha256=nkHK6IHAO6-yoZJukUr0CruzkP8weBKraPnsj2FmDV8,17
37
- agentsystems_sdk-0.3.4.dist-info/RECORD,,
33
+ agentsystems_sdk-0.4.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ agentsystems_sdk-0.4.0.dist-info/licenses/NOTICE,sha256=SGMFwyEoZ6NG19ZrdvwYt43lig12rEl5z8XvWMGej6c,918
35
+ agentsystems_sdk-0.4.0.dist-info/METADATA,sha256=KXUI4wqQL5A5nG1YNt5pV9sS-ZVcEOBX-LFT9HJuwSg,11894
36
+ agentsystems_sdk-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ agentsystems_sdk-0.4.0.dist-info/entry_points.txt,sha256=0lejF8v40DAB0D2612UWLLA3e1Ux8TyyLU6yJc0vQkQ,93
38
+ agentsystems_sdk-0.4.0.dist-info/top_level.txt,sha256=nkHK6IHAO6-yoZJukUr0CruzkP8weBKraPnsj2FmDV8,17
39
+ agentsystems_sdk-0.4.0.dist-info/RECORD,,