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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ from agent_assembly import init_assembly
from agent_assembly.exceptions import ConfigurationError

try:
context = init_assembly(gateway_url="", api_key="my-api-key", agent_id="my-agent-001")
# An invalid mode fails validation up front and raises ConfigurationError.
# (An empty/unset gateway_url is not an error — it triggers local
# auto-discovery; a gateway that can't be reached raises GatewayError.)
context = init_assembly(gateway_url="http://localhost:7391", mode="invalid-mode")
except ConfigurationError as exc:
print(f"Invalid configuration: {exc}")
```
Expand Down
7 changes: 7 additions & 0 deletions agent_assembly/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
import argparse
import sys

from agent_assembly import __version__


def _build_parser() -> argparse.ArgumentParser:
"""Build the top-level argument parser with the adapter subcommand."""
parser = argparse.ArgumentParser(
prog="aasm",
description="Agent Assembly SDK command-line tools.",
)
parser.add_argument(
"--version",
action="version",
version=f"%(prog)s {__version__}",
)
subparsers = parser.add_subparsers(dest="command", help="Available commands")

adapter_parser = subparsers.add_parser("adapter", help="Adapter management commands")
Expand Down
12 changes: 12 additions & 0 deletions test/unit/cli/test_cli_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@

import pytest

from agent_assembly import __version__
from agent_assembly.cli.main import main


class TestCliMainVersion:
"""Tests for the ``aasm --version`` flag."""

def test_version_prints_version_and_exits_zero(self, capsys: pytest.CaptureFixture[str]) -> None:
with mock.patch("sys.argv", ["aasm", "--version"]):
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 0
assert capsys.readouterr().out.strip() == f"aasm {__version__}"


class TestCliMainExitCodeZero:
"""Tests for CLI main returning exit code 0."""

Expand Down