agentsystems-sdk 0.4.4__tar.gz → 0.4.5__tar.gz

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.
Files changed (66) hide show
  1. {agentsystems_sdk-0.4.4/agentsystems_sdk.egg-info → agentsystems_sdk-0.4.5}/PKG-INFO +1 -1
  2. agentsystems_sdk-0.4.5/agentsystems_sdk/commands/restart.py +89 -0
  3. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/licenses/python/ATTRIBUTIONS.md +1 -1
  4. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/licenses/python/THIRD_PARTY_LICENSES.json +1 -1
  5. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5/agentsystems_sdk.egg-info}/PKG-INFO +1 -1
  6. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/pyproject.toml +1 -1
  7. agentsystems_sdk-0.4.5/tests/test_cli_restart.py +158 -0
  8. agentsystems_sdk-0.4.4/agentsystems_sdk/commands/restart.py +0 -72
  9. agentsystems_sdk-0.4.4/tests/test_cli_restart.py +0 -361
  10. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/LICENSE +0 -0
  11. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/MANIFEST.in +0 -0
  12. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/NOTICE +0 -0
  13. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/README.md +0 -0
  14. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/__init__.py +0 -0
  15. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/cli.py +0 -0
  16. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/__init__.py +0 -0
  17. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/artifacts.py +0 -0
  18. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/clean.py +0 -0
  19. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/down.py +0 -0
  20. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/init.py +0 -0
  21. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/logs.py +0 -0
  22. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/run.py +0 -0
  23. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/status.py +0 -0
  24. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/up.py +0 -0
  25. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/update.py +0 -0
  26. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/commands/version.py +0 -0
  27. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/config.py +0 -0
  28. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/.env.example +0 -0
  29. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/CONTRIBUTING.md +0 -0
  30. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/LICENSE +0 -0
  31. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/Makefile +0 -0
  32. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/NOTICE +0 -0
  33. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/README.md +0 -0
  34. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/agentsystems-config.yml +0 -0
  35. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/langfuse/docker-compose.yml +0 -0
  36. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/local/db-backup/Dockerfile +0 -0
  37. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/local/db-backup/entrypoint.sh +0 -0
  38. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/local/docker-compose.yml +0 -0
  39. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/local/init-artifacts-volume.sh +0 -0
  40. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/compose/local/postgres-init/audit.sql +0 -0
  41. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/requirements-dev.txt +0 -0
  42. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/deployments_scaffold/schema/agentsystems-config.schema.json +0 -0
  43. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/licenses/python/THIRD_PARTY_REQUIREMENTS.txt +0 -0
  44. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/progress_tracker.py +0 -0
  45. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk/utils.py +0 -0
  46. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk.egg-info/SOURCES.txt +0 -0
  47. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk.egg-info/dependency_links.txt +0 -0
  48. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk.egg-info/entry_points.txt +0 -0
  49. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk.egg-info/requires.txt +0 -0
  50. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/agentsystems_sdk.egg-info/top_level.txt +0 -0
  51. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/setup.cfg +0 -0
  52. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli.py +0 -0
  53. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_artifacts.py +0 -0
  54. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_clean.py +0 -0
  55. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_down.py +0 -0
  56. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_init.py +0 -0
  57. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_logs.py +0 -0
  58. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_main.py +0 -0
  59. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_run.py +0 -0
  60. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_status.py +0 -0
  61. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_cli_up.py +0 -0
  62. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_config.py +0 -0
  63. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_config_errors.py +0 -0
  64. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_init.py +0 -0
  65. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_progress.py +0 -0
  66. {agentsystems_sdk-0.4.4 → agentsystems_sdk-0.4.5}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentsystems-sdk
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: AgentSystems Python SDK and CLI
5
5
  Author-email: AgentSystems <support@agentsystems.ai>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,89 @@
1
+ """Restart AgentSystems services."""
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
+
11
+ from .down import down_command
12
+ from .up import up_command, AgentStartMode
13
+
14
+ console = Console()
15
+
16
+
17
+ def restart_command(
18
+ project_dir: pathlib.Path = typer.Argument(
19
+ ".",
20
+ exists=True,
21
+ file_okay=False,
22
+ dir_okay=True,
23
+ readable=True,
24
+ resolve_path=True,
25
+ help="Path to an agent-platform-deployments checkout",
26
+ ),
27
+ detach: bool = typer.Option(
28
+ True,
29
+ "--detach/--foreground",
30
+ "-d",
31
+ help="Run containers in background (default) or stream logs in foreground",
32
+ ),
33
+ wait_ready: bool = typer.Option(
34
+ True,
35
+ "--wait/--no-wait",
36
+ help="After start, wait until gateway is ready (detached mode only)",
37
+ ),
38
+ no_langfuse: bool = typer.Option(
39
+ False, "--no-langfuse", help="Disable Langfuse tracing stack"
40
+ ),
41
+ agents_mode: AgentStartMode = typer.Option(
42
+ AgentStartMode.create,
43
+ "--agents",
44
+ help="Agent startup mode: all (start), create (pull & create containers stopped), none (skip agents)",
45
+ show_default=True,
46
+ ),
47
+ env_file: Optional[pathlib.Path] = typer.Option(
48
+ None,
49
+ "--env-file",
50
+ help="Custom .env file passed to docker compose",
51
+ exists=True,
52
+ file_okay=True,
53
+ dir_okay=False,
54
+ resolve_path=True,
55
+ ),
56
+ ):
57
+ """Full platform restart with fresh agent containers and updated configuration.
58
+
59
+ This is equivalent to `agentsystems down && agentsystems up` and will:
60
+ - Stop all services and remove agent containers
61
+ - Clean up unused networks
62
+ - Start services with fresh agent containers using current .env and config
63
+
64
+ Perfect for picking up configuration changes (API keys, model connections, etc.).
65
+ """
66
+ console.print("[cyan]🔄 Full platform restart (down → up)[/cyan]")
67
+
68
+ # Call down command with default settings
69
+ down_command(
70
+ project_dir=project_dir,
71
+ delete_volumes=False,
72
+ delete_containers=False, # Cleanup is now automatic
73
+ delete_all=False,
74
+ volumes=None,
75
+ no_langfuse=no_langfuse,
76
+ )
77
+
78
+ # Call up command with all the same options
79
+ up_command(
80
+ project_dir=project_dir,
81
+ detach=detach,
82
+ fresh=False, # Down already cleaned up
83
+ wait_ready=wait_ready,
84
+ no_langfuse=no_langfuse,
85
+ agents_mode=agents_mode,
86
+ env_file=env_file,
87
+ agent_control_plane_version=None,
88
+ agentsystems_ui_version=None,
89
+ )
@@ -2,7 +2,7 @@
2
2
 
3
3
  This package relies on the third-party Python packages listed below.
4
4
 
5
- ## agentsystems-sdk 0.4.4
5
+ ## agentsystems-sdk 0.4.5
6
6
  - License: UNKNOWN
7
7
  - URL: UNKNOWN
8
8
  - Author: AgentSystems <support@agentsystems.ai>
@@ -29,7 +29,7 @@
29
29
  "LicenseText": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n",
30
30
  "Name": "agentsystems-sdk",
31
31
  "URL": "UNKNOWN",
32
- "Version": "0.4.4"
32
+ "Version": "0.4.5"
33
33
  },
34
34
  {
35
35
  "Author": "\"Jason R. Coombs\" <jaraco@jaraco.com>",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentsystems-sdk
3
- Version: 0.4.4
3
+ Version: 0.4.5
4
4
  Summary: AgentSystems Python SDK and CLI
5
5
  Author-email: AgentSystems <support@agentsystems.ai>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentsystems-sdk"
3
- version = "0.4.4"
3
+ version = "0.4.5"
4
4
  description = "AgentSystems Python SDK and CLI"
5
5
  readme = "README.md"
6
6
  authors = [ { name = "AgentSystems", email = "support@agentsystems.ai" } ]
@@ -0,0 +1,158 @@
1
+ """Tests for the restart command."""
2
+
3
+ from unittest.mock import patch
4
+
5
+ from agentsystems_sdk.commands.restart import restart_command
6
+ from agentsystems_sdk.commands.up import AgentStartMode
7
+
8
+
9
+ class TestRestartCommand:
10
+ """Tests for the restart command."""
11
+
12
+ @patch("agentsystems_sdk.commands.restart.up_command")
13
+ @patch("agentsystems_sdk.commands.restart.down_command")
14
+ def test_restart_calls_down_then_up(
15
+ self,
16
+ mock_down_command,
17
+ mock_up_command,
18
+ tmp_path,
19
+ ):
20
+ """Test restart command calls down then up with correct parameters."""
21
+ # Execute
22
+ restart_command(
23
+ project_dir=tmp_path,
24
+ detach=True,
25
+ wait_ready=True,
26
+ no_langfuse=False,
27
+ agents_mode=AgentStartMode.create,
28
+ env_file=None,
29
+ )
30
+
31
+ # Verify down was called first
32
+ mock_down_command.assert_called_once_with(
33
+ project_dir=tmp_path,
34
+ delete_volumes=False,
35
+ delete_containers=False,
36
+ delete_all=False,
37
+ volumes=None,
38
+ no_langfuse=False,
39
+ )
40
+
41
+ # Verify up was called second
42
+ mock_up_command.assert_called_once_with(
43
+ project_dir=tmp_path,
44
+ detach=True,
45
+ fresh=False,
46
+ wait_ready=True,
47
+ no_langfuse=False,
48
+ agents_mode=AgentStartMode.create,
49
+ env_file=None,
50
+ agent_control_plane_version=None,
51
+ agentsystems_ui_version=None,
52
+ )
53
+
54
+ @patch("agentsystems_sdk.commands.restart.up_command")
55
+ @patch("agentsystems_sdk.commands.restart.down_command")
56
+ def test_restart_passes_options_correctly(
57
+ self,
58
+ mock_down_command,
59
+ mock_up_command,
60
+ tmp_path,
61
+ ):
62
+ """Test restart command passes options to down and up correctly."""
63
+ # Execute with specific options
64
+ restart_command(
65
+ project_dir=tmp_path,
66
+ detach=False, # Foreground
67
+ wait_ready=False, # No wait
68
+ no_langfuse=True, # No Langfuse
69
+ agents_mode=AgentStartMode.all, # Start all agents
70
+ env_file=tmp_path / ".env.test",
71
+ )
72
+
73
+ # Verify options passed to down
74
+ mock_down_command.assert_called_once_with(
75
+ project_dir=tmp_path,
76
+ delete_volumes=False,
77
+ delete_containers=False,
78
+ delete_all=False,
79
+ volumes=None,
80
+ no_langfuse=True, # Passed through
81
+ )
82
+
83
+ # Verify options passed to up
84
+ mock_up_command.assert_called_once_with(
85
+ project_dir=tmp_path,
86
+ detach=False, # Passed through
87
+ fresh=False,
88
+ wait_ready=False, # Passed through
89
+ no_langfuse=True, # Passed through
90
+ agents_mode=AgentStartMode.all, # Passed through
91
+ env_file=tmp_path / ".env.test", # Passed through
92
+ agent_control_plane_version=None,
93
+ agentsystems_ui_version=None,
94
+ )
95
+
96
+ @patch("agentsystems_sdk.commands.restart.up_command")
97
+ @patch("agentsystems_sdk.commands.restart.down_command")
98
+ def test_restart_down_failure_propagates(
99
+ self,
100
+ mock_down_command,
101
+ mock_up_command,
102
+ tmp_path,
103
+ ):
104
+ """Test restart command propagates down command failures."""
105
+ # Make down command fail
106
+ import typer
107
+
108
+ mock_down_command.side_effect = typer.Exit(code=1)
109
+
110
+ # Execute and expect exception
111
+ try:
112
+ restart_command(
113
+ project_dir=tmp_path,
114
+ detach=True,
115
+ wait_ready=True,
116
+ no_langfuse=False,
117
+ agents_mode=AgentStartMode.create,
118
+ env_file=None,
119
+ )
120
+ assert False, "Expected typer.Exit to be raised"
121
+ except typer.Exit as e:
122
+ assert e.exit_code == 1
123
+
124
+ # Verify down was called but up was not
125
+ mock_down_command.assert_called_once()
126
+ mock_up_command.assert_not_called()
127
+
128
+ @patch("agentsystems_sdk.commands.restart.up_command")
129
+ @patch("agentsystems_sdk.commands.restart.down_command")
130
+ def test_restart_up_failure_propagates(
131
+ self,
132
+ mock_down_command,
133
+ mock_up_command,
134
+ tmp_path,
135
+ ):
136
+ """Test restart command propagates up command failures."""
137
+ # Make up command fail
138
+ import typer
139
+
140
+ mock_up_command.side_effect = typer.Exit(code=1)
141
+
142
+ # Execute and expect exception
143
+ try:
144
+ restart_command(
145
+ project_dir=tmp_path,
146
+ detach=True,
147
+ wait_ready=True,
148
+ no_langfuse=False,
149
+ agents_mode=AgentStartMode.create,
150
+ env_file=None,
151
+ )
152
+ assert False, "Expected typer.Exit to be raised"
153
+ except typer.Exit as e:
154
+ assert e.exit_code == 1
155
+
156
+ # Verify both were called (down succeeded, up failed)
157
+ mock_down_command.assert_called_once()
158
+ mock_up_command.assert_called_once()
@@ -1,72 +0,0 @@
1
- """Restart AgentSystems services."""
2
-
3
- from __future__ import annotations
4
-
5
- import os
6
- import pathlib
7
-
8
- import typer
9
- from rich.console import Console
10
-
11
- from ..utils import (
12
- ensure_docker_installed,
13
- compose_args,
14
- run_command_with_env,
15
- wait_for_gateway_ready,
16
- )
17
-
18
- console = Console()
19
-
20
-
21
- def restart_command(
22
- project_dir: pathlib.Path = typer.Argument(
23
- ".",
24
- exists=True,
25
- file_okay=False,
26
- dir_okay=True,
27
- readable=True,
28
- resolve_path=True,
29
- help="Path to an agent-platform-deployments checkout",
30
- ),
31
- detach: bool = typer.Option(
32
- True,
33
- "--detach/--foreground",
34
- "-d",
35
- help="Run containers in background (default) or stream logs in foreground",
36
- ),
37
- wait_ready: bool = typer.Option(
38
- True,
39
- "--wait/--no-wait",
40
- help="After start, wait until gateway is ready (detached mode only)",
41
- ),
42
- no_langfuse: bool = typer.Option(
43
- False, "--no-langfuse", help="Disable Langfuse tracing stack"
44
- ),
45
- ):
46
- """Quick bounce: `down` → `up` (non-destructive).
47
-
48
- Retains data volumes; wipe with `down --delete-volumes` first.
49
- Useful during development and CI.
50
- """
51
- ensure_docker_installed()
52
- core_compose, compose_args_list = compose_args(
53
- project_dir, langfuse=not no_langfuse
54
- )
55
- env = os.environ.copy()
56
-
57
- # Stop current stack
58
- cmd_down: list[str] = [*compose_args_list, "down"]
59
- console.print("[cyan]⏻ Stopping core services…[/cyan]")
60
- run_command_with_env(cmd_down, env)
61
-
62
- # Start stack again
63
- cmd_up: list[str] = [*compose_args_list, "up"]
64
- if detach:
65
- cmd_up.append("-d")
66
- console.print("[cyan]⏫ Starting core services…[/cyan]")
67
- run_command_with_env(cmd_up, env)
68
-
69
- # Optional readiness wait
70
- if wait_ready and detach:
71
- wait_for_gateway_ready()
72
- console.print("[green]✓ Restart complete.[/green]")
@@ -1,361 +0,0 @@
1
- """Tests for the restart command."""
2
-
3
- from unittest.mock import patch
4
-
5
- from agentsystems_sdk.commands.restart import restart_command
6
-
7
-
8
- class TestRestartCommand:
9
- """Tests for the restart command."""
10
-
11
- @patch("agentsystems_sdk.commands.restart.wait_for_gateway_ready")
12
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
13
- @patch("agentsystems_sdk.commands.restart.compose_args")
14
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
15
- @patch("agentsystems_sdk.commands.restart.console.print")
16
- @patch("agentsystems_sdk.commands.restart.os.environ.copy")
17
- def test_restart_command_detached_with_wait(
18
- self,
19
- mock_environ_copy,
20
- mock_console_print,
21
- mock_ensure_docker,
22
- mock_compose_args,
23
- mock_run_command,
24
- mock_wait_gateway,
25
- tmp_path,
26
- ):
27
- """Test restart command in detached mode with wait (default)."""
28
- # Setup
29
- compose_file = tmp_path / "docker-compose.yml"
30
- mock_compose_args.return_value = (
31
- compose_file,
32
- ["docker-compose", "-f", str(compose_file)],
33
- )
34
- test_env = {"TEST_VAR": "test_value"}
35
- mock_environ_copy.return_value = test_env
36
- mock_wait_gateway.return_value = True
37
-
38
- # Execute
39
- restart_command(
40
- project_dir=tmp_path,
41
- detach=True, # Default
42
- wait_ready=True, # Default
43
- no_langfuse=False,
44
- )
45
-
46
- # Verify
47
- mock_ensure_docker.assert_called_once()
48
- mock_compose_args.assert_called_once_with(tmp_path, langfuse=True)
49
-
50
- # Verify two commands were run (down, then up)
51
- assert mock_run_command.call_count == 2
52
-
53
- # First call: docker-compose down
54
- down_call = mock_run_command.call_args_list[0]
55
- down_cmd = down_call[0][0]
56
- assert "down" in down_cmd
57
- assert down_call[0][1] == test_env
58
-
59
- # Second call: docker-compose up -d
60
- up_call = mock_run_command.call_args_list[1]
61
- up_cmd = up_call[0][0]
62
- assert "up" in up_cmd
63
- assert "-d" in up_cmd
64
- assert up_call[0][1] == test_env
65
-
66
- # Verify gateway wait was called
67
- mock_wait_gateway.assert_called_once_with()
68
-
69
- # Verify console messages
70
- print_calls = [str(call) for call in mock_console_print.call_args_list]
71
- assert any("Stopping core services" in call for call in print_calls)
72
- assert any("Starting core services" in call for call in print_calls)
73
- assert any("Restart complete" in call for call in print_calls)
74
-
75
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
76
- @patch("agentsystems_sdk.commands.restart.compose_args")
77
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
78
- def test_restart_command_foreground(
79
- self,
80
- mock_ensure_docker,
81
- mock_compose_args,
82
- mock_run_command,
83
- tmp_path,
84
- ):
85
- """Test restart command in foreground mode."""
86
- # Setup
87
- compose_file = tmp_path / "docker-compose.yml"
88
- mock_compose_args.return_value = (
89
- compose_file,
90
- ["docker-compose", "-f", str(compose_file)],
91
- )
92
-
93
- # Execute
94
- restart_command(
95
- project_dir=tmp_path,
96
- detach=False, # Foreground
97
- wait_ready=True, # Will be ignored in foreground
98
- no_langfuse=False,
99
- )
100
-
101
- # Verify up command doesn't have -d flag
102
- up_call = mock_run_command.call_args_list[1]
103
- up_cmd = up_call[0][0]
104
- assert "up" in up_cmd
105
- assert "-d" not in up_cmd
106
-
107
- @patch("agentsystems_sdk.commands.restart.wait_for_gateway_ready")
108
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
109
- @patch("agentsystems_sdk.commands.restart.compose_args")
110
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
111
- def test_restart_command_detached_no_wait(
112
- self,
113
- mock_ensure_docker,
114
- mock_compose_args,
115
- mock_run_command,
116
- mock_wait_gateway,
117
- tmp_path,
118
- ):
119
- """Test restart command in detached mode without wait."""
120
- # Setup
121
- compose_file = tmp_path / "docker-compose.yml"
122
- mock_compose_args.return_value = (
123
- compose_file,
124
- ["docker-compose", "-f", str(compose_file)],
125
- )
126
-
127
- # Execute
128
- restart_command(
129
- project_dir=tmp_path,
130
- detach=True,
131
- wait_ready=False, # No wait
132
- no_langfuse=False,
133
- )
134
-
135
- # Verify gateway wait was NOT called
136
- mock_wait_gateway.assert_not_called()
137
-
138
- @patch("agentsystems_sdk.commands.restart.wait_for_gateway_ready")
139
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
140
- @patch("agentsystems_sdk.commands.restart.compose_args")
141
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
142
- def test_restart_command_foreground_with_wait(
143
- self,
144
- mock_ensure_docker,
145
- mock_compose_args,
146
- mock_run_command,
147
- mock_wait_gateway,
148
- tmp_path,
149
- ):
150
- """Test restart command in foreground mode ignores wait flag."""
151
- # Setup
152
- compose_file = tmp_path / "docker-compose.yml"
153
- mock_compose_args.return_value = (
154
- compose_file,
155
- ["docker-compose", "-f", str(compose_file)],
156
- )
157
-
158
- # Execute
159
- restart_command(
160
- project_dir=tmp_path,
161
- detach=False, # Foreground
162
- wait_ready=True, # Should be ignored
163
- no_langfuse=False,
164
- )
165
-
166
- # Verify gateway wait was NOT called (foreground mode)
167
- mock_wait_gateway.assert_not_called()
168
-
169
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
170
- @patch("agentsystems_sdk.commands.restart.compose_args")
171
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
172
- def test_restart_command_no_langfuse(
173
- self,
174
- mock_ensure_docker,
175
- mock_compose_args,
176
- mock_run_command,
177
- tmp_path,
178
- ):
179
- """Test restart command with --no-langfuse option."""
180
- # Setup
181
- compose_file = tmp_path / "docker-compose.yml"
182
- mock_compose_args.return_value = (
183
- compose_file,
184
- ["docker-compose", "-f", str(compose_file)],
185
- )
186
-
187
- # Execute
188
- restart_command(
189
- project_dir=tmp_path,
190
- detach=True,
191
- wait_ready=False,
192
- no_langfuse=True,
193
- )
194
-
195
- # Verify compose_args was called with langfuse=False
196
- mock_compose_args.assert_called_once_with(tmp_path, langfuse=False)
197
-
198
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
199
- @patch("agentsystems_sdk.commands.restart.compose_args")
200
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
201
- def test_restart_command_down_failure(
202
- self,
203
- mock_ensure_docker,
204
- mock_compose_args,
205
- mock_run_command,
206
- tmp_path,
207
- ):
208
- """Test restart command when down command fails."""
209
- # Setup
210
- compose_file = tmp_path / "docker-compose.yml"
211
- mock_compose_args.return_value = (
212
- compose_file,
213
- ["docker-compose", "-f", str(compose_file)],
214
- )
215
-
216
- # Make down command fail
217
- import typer
218
-
219
- mock_run_command.side_effect = typer.Exit(code=1)
220
-
221
- # Execute and expect exception
222
- try:
223
- restart_command(
224
- project_dir=tmp_path,
225
- detach=True,
226
- wait_ready=True,
227
- no_langfuse=False,
228
- )
229
- except typer.Exit as e:
230
- assert e.exit_code == 1
231
-
232
- # Verify only one command was attempted (failed on down)
233
- assert mock_run_command.call_count == 1
234
-
235
- @patch("agentsystems_sdk.commands.restart.wait_for_gateway_ready")
236
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
237
- @patch("agentsystems_sdk.commands.restart.compose_args")
238
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
239
- def test_restart_command_up_failure(
240
- self,
241
- mock_ensure_docker,
242
- mock_compose_args,
243
- mock_run_command,
244
- mock_wait_gateway,
245
- tmp_path,
246
- ):
247
- """Test restart command when up command fails."""
248
- # Setup
249
- compose_file = tmp_path / "docker-compose.yml"
250
- mock_compose_args.return_value = (
251
- compose_file,
252
- ["docker-compose", "-f", str(compose_file)],
253
- )
254
-
255
- # Make up command fail
256
- import typer
257
-
258
- def run_command_side_effect(cmd, env):
259
- if "up" in cmd:
260
- raise typer.Exit(code=1)
261
-
262
- mock_run_command.side_effect = run_command_side_effect
263
-
264
- # Execute and expect exception
265
- try:
266
- restart_command(
267
- project_dir=tmp_path,
268
- detach=True,
269
- wait_ready=True,
270
- no_langfuse=False,
271
- )
272
- except typer.Exit as e:
273
- assert e.exit_code == 1
274
-
275
- # Verify two commands were attempted
276
- assert mock_run_command.call_count == 2
277
-
278
- # Verify gateway wait was NOT called (failed before that)
279
- mock_wait_gateway.assert_not_called()
280
-
281
- @patch("agentsystems_sdk.commands.restart.wait_for_gateway_ready")
282
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
283
- @patch("agentsystems_sdk.commands.restart.compose_args")
284
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
285
- @patch("agentsystems_sdk.commands.restart.console.print")
286
- def test_restart_command_gateway_wait_timeout(
287
- self,
288
- mock_console_print,
289
- mock_ensure_docker,
290
- mock_compose_args,
291
- mock_run_command,
292
- mock_wait_gateway,
293
- tmp_path,
294
- ):
295
- """Test restart command continues when gateway wait times out."""
296
- # Setup
297
- compose_file = tmp_path / "docker-compose.yml"
298
- mock_compose_args.return_value = (
299
- compose_file,
300
- ["docker-compose", "-f", str(compose_file)],
301
- )
302
-
303
- # Gateway wait returns False (timeout)
304
- mock_wait_gateway.return_value = False
305
-
306
- # Execute
307
- restart_command(
308
- project_dir=tmp_path,
309
- detach=True,
310
- wait_ready=True,
311
- no_langfuse=False,
312
- )
313
-
314
- # Verify gateway wait was called
315
- mock_wait_gateway.assert_called_once_with()
316
-
317
- # Verify restart still completes
318
- print_calls = [str(call) for call in mock_console_print.call_args_list]
319
- assert any("Restart complete" in call for call in print_calls)
320
-
321
- @patch("agentsystems_sdk.commands.restart.run_command_with_env")
322
- @patch("agentsystems_sdk.commands.restart.compose_args")
323
- @patch("agentsystems_sdk.commands.restart.ensure_docker_installed")
324
- def test_restart_command_compose_args_integration(
325
- self,
326
- mock_ensure_docker,
327
- mock_compose_args,
328
- mock_run_command,
329
- tmp_path,
330
- ):
331
- """Test restart command properly builds commands with compose args."""
332
- # Setup with complex compose args
333
- compose_file = tmp_path / "docker-compose.yml"
334
- compose_args_list = [
335
- "docker",
336
- "compose",
337
- "-f",
338
- str(compose_file),
339
- "-f",
340
- str(tmp_path / "docker-compose.override.yml"),
341
- "-p",
342
- "myproject",
343
- ]
344
- mock_compose_args.return_value = (compose_file, compose_args_list)
345
-
346
- # Execute
347
- restart_command(
348
- project_dir=tmp_path,
349
- detach=True,
350
- wait_ready=False,
351
- no_langfuse=False,
352
- )
353
-
354
- # Verify commands include all compose args
355
- down_cmd = mock_run_command.call_args_list[0][0][0]
356
- expected_down = compose_args_list + ["down"]
357
- assert down_cmd == expected_down
358
-
359
- up_cmd = mock_run_command.call_args_list[1][0][0]
360
- expected_up = compose_args_list + ["up", "-d"]
361
- assert up_cmd == expected_up