diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 2b11178b..bfe6623a 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -9,6 +9,8 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" - uses: pre-commit/action@v3.0.1 diff --git a/config.py b/config.py index d1ae8ace..8ca22cbe 100644 --- a/config.py +++ b/config.py @@ -102,7 +102,8 @@ TITLE_WORDS = { "alibabacloud": "AlibabaCloud" }, "aws": { - "cloudfront": "CloudFront" + "agentcore": "AgentCore", + "cloudfront": "CloudFront", }, "digitalocean": { "digitalocean": "DigitalOcean" @@ -241,7 +242,10 @@ ALIASES = { "ServerMigrationService": "SMS", }, "ml": { + "AiAgent": "AIAgent", "DeepLearningContainers": "DLC", + "PolicyEngineAgenticGuardrails": "PEAG", + "Observability": "OBS", }, "network": { "CloudFront": "CF", diff --git a/diagrams/__init__.py b/diagrams/__init__.py index 062ecae2..c3acacfc 100644 --- a/diagrams/__init__.py +++ b/diagrams/__init__.py @@ -182,8 +182,7 @@ class Diagram: if isinstance(outformat, list): for one_format in outformat: if not self._validate_outformat(one_format): - raise ValueError( - f'"{one_format}" is not a valid output format') + raise ValueError(f'"{one_format}" is not a valid output format') else: if not self._validate_outformat(outformat): raise ValueError(f'"{outformat}" is not a valid output format') @@ -540,8 +539,7 @@ class Edge: """Implement Self - Node or Edge and Self - [Nodes]""" return self.connect(other) - def __rsub__(self, other: Union[List["Node"], - List["Edge"]]) -> List["Edge"]: + def __rsub__(self, other: Union[List["Node"], List["Edge"]]) -> List["Edge"]: """Called for [Nodes] or [Edges] - Self because list don't have __sub__ operators.""" return self.append(other) @@ -555,23 +553,15 @@ class Edge: self.reverse = True return self.connect(other) - def __rrshift__(self, - other: Union[List["Node"], - List["Edge"]]) -> List["Edge"]: + def __rrshift__(self, other: Union[List["Node"], List["Edge"]]) -> List["Edge"]: """Called for [Nodes] or [Edges] >> Self because list of Edges don't have __rshift__ operators.""" return self.append(other, forward=True) - def __rlshift__(self, - other: Union[List["Node"], - List["Edge"]]) -> List["Edge"]: + def __rlshift__(self, other: Union[List["Node"], List["Edge"]]) -> List["Edge"]: """Called for [Nodes] or [Edges] << Self because list of Edges don't have __lshift__ operators.""" return self.append(other, reverse=True) - def append(self, - other: Union[List["Node"], - List["Edge"]], - forward=None, - reverse=None) -> List["Edge"]: + def append(self, other: Union[List["Node"], List["Edge"]], forward=None, reverse=None) -> List["Edge"]: result = [] for o in other: if isinstance(o, Edge): @@ -580,12 +570,7 @@ class Edge: self._attrs = o.attrs.copy() result.append(o) else: - result.append( - Edge( - o, - forward=forward, - reverse=reverse, - **self._attrs)) + result.append(Edge(o, forward=forward, reverse=reverse, **self._attrs)) return result def connect(self, other: Union["Node", "Edge", List["Node"]]): diff --git a/diagrams/aws/ml.py b/diagrams/aws/ml.py index 6d2cce6b..d8c0838f 100644 --- a/diagrams/aws/ml.py +++ b/diagrams/aws/ml.py @@ -8,6 +8,18 @@ class _ML(_AWS): _icon_dir = "resources/aws/ml" +class AgentCore(_ML): + _icon = "agentcore.png" + + +class AiAgent(_ML): + _icon = "ai-agent.png" + + +class AmazonNova(_ML): + _icon = "amazon-nova.png" + + class ApacheMxnetOnAWS(_ML): _icon = "apache-mxnet-on-aws.png" @@ -16,10 +28,26 @@ class AugmentedAi(_ML): _icon = "augmented-ai.png" +class AWSAppStudio(_ML): + _icon = "aws-app-studio.png" + + +class AWSNeuron(_ML): + _icon = "aws-neuron.png" + + class Bedrock(_ML): _icon = "bedrock.png" +class BrowserTool(_ML): + _icon = "browser-tool.png" + + +class CodeInterpreter(_ML): + _icon = "code-interpreter.png" + + class Comprehend(_ML): _icon = "comprehend.png" @@ -48,6 +76,10 @@ class ElasticInference(_ML): _icon = "elastic-inference.png" +class Evaluations(_ML): + _icon = "evaluations.png" + + class Forecast(_ML): _icon = "forecast.png" @@ -56,6 +88,14 @@ class FraudDetector(_ML): _icon = "fraud-detector.png" +class Gateway(_ML): + _icon = "gateway.png" + + +class Identity(_ML): + _icon = "identity.png" + + class Kendra(_ML): _icon = "kendra.png" @@ -68,10 +108,22 @@ class MachineLearning(_ML): _icon = "machine-learning.png" +class Memory(_ML): + _icon = "memory.png" + + +class Observability(_ML): + _icon = "observability.png" + + class Personalize(_ML): _icon = "personalize.png" +class PolicyEngineAgenticGuardrails(_ML): + _icon = "policy-engine-agentic-guardrails.png" + + class Polly(_ML): _icon = "polly.png" @@ -92,6 +144,10 @@ class Rekognition(_ML): _icon = "rekognition.png" +class Runtime(_ML): + _icon = "runtime.png" + + class SagemakerGroundTruth(_ML): _icon = "sagemaker-ground-truth.png" @@ -134,4 +190,7 @@ class Translate(_ML): # Aliases +AIAgent = AiAgent DLC = DeepLearningContainers +PEAG = PolicyEngineAgenticGuardrails +OBS = Observability diff --git a/diagrams/cli.py b/diagrams/cli.py index c75eb3d9..7346300e 100644 --- a/diagrams/cli.py +++ b/diagrams/cli.py @@ -24,7 +24,7 @@ def run() -> int: args = parser.parse_args() for path in args.paths: - with open(path, encoding='utf-8') as f: + with open(path, encoding="utf-8") as f: exec(f.read()) return 0 diff --git a/docs/nodes/aws.md b/docs/nodes/aws.md index fb6b7d80..5ad00a5b 100644 --- a/docs/nodes/aws.md +++ b/docs/nodes/aws.md @@ -1100,15 +1100,36 @@ Node classes list of the aws provider. ## aws.ml +AgentCore +**diagrams.aws.ml.AgentCore** + +AiAgent +**diagrams.aws.ml.AiAgent**, **AIAgent** (alias) + +AmazonNova +**diagrams.aws.ml.AmazonNova** + ApacheMxnetOnAWS **diagrams.aws.ml.ApacheMxnetOnAWS** AugmentedAi **diagrams.aws.ml.AugmentedAi** +AWSAppStudio +**diagrams.aws.ml.AWSAppStudio** + +AWSNeuron +**diagrams.aws.ml.AWSNeuron** + Bedrock **diagrams.aws.ml.Bedrock** +BrowserTool +**diagrams.aws.ml.BrowserTool** + +CodeInterpreter +**diagrams.aws.ml.CodeInterpreter** + Comprehend **diagrams.aws.ml.Comprehend** @@ -1130,12 +1151,21 @@ Node classes list of the aws provider. ElasticInference **diagrams.aws.ml.ElasticInference** +Evaluations +**diagrams.aws.ml.Evaluations** + Forecast **diagrams.aws.ml.Forecast** FraudDetector **diagrams.aws.ml.FraudDetector** +Gateway +**diagrams.aws.ml.Gateway** + +Identity +**diagrams.aws.ml.Identity** + Kendra **diagrams.aws.ml.Kendra** @@ -1145,9 +1175,18 @@ Node classes list of the aws provider. MachineLearning **diagrams.aws.ml.MachineLearning** +Memory +**diagrams.aws.ml.Memory** + +Observability +**diagrams.aws.ml.Observability**, **OBS** (alias) + Personalize **diagrams.aws.ml.Personalize** +PolicyEngineAgenticGuardrails +**diagrams.aws.ml.PolicyEngineAgenticGuardrails**, **PEAG** (alias) + Polly **diagrams.aws.ml.Polly** @@ -1163,6 +1202,9 @@ Node classes list of the aws provider. Rekognition **diagrams.aws.ml.Rekognition** +Runtime +**diagrams.aws.ml.Runtime** + SagemakerGroundTruth **diagrams.aws.ml.SagemakerGroundTruth** diff --git a/resources/aws/ml/agentcore.png b/resources/aws/ml/agentcore.png new file mode 100644 index 00000000..debeadd2 Binary files /dev/null and b/resources/aws/ml/agentcore.png differ diff --git a/resources/aws/ml/ai-agent.png b/resources/aws/ml/ai-agent.png new file mode 100644 index 00000000..f13894a9 Binary files /dev/null and b/resources/aws/ml/ai-agent.png differ diff --git a/resources/aws/ml/amazon-nova.png b/resources/aws/ml/amazon-nova.png new file mode 100644 index 00000000..bfbfc28d Binary files /dev/null and b/resources/aws/ml/amazon-nova.png differ diff --git a/resources/aws/ml/aws-app-studio.png b/resources/aws/ml/aws-app-studio.png new file mode 100644 index 00000000..c6340b3b Binary files /dev/null and b/resources/aws/ml/aws-app-studio.png differ diff --git a/resources/aws/ml/aws-neuron.png b/resources/aws/ml/aws-neuron.png new file mode 100644 index 00000000..3f6b96c5 Binary files /dev/null and b/resources/aws/ml/aws-neuron.png differ diff --git a/resources/aws/ml/browser-tool.png b/resources/aws/ml/browser-tool.png new file mode 100644 index 00000000..bc41ba93 Binary files /dev/null and b/resources/aws/ml/browser-tool.png differ diff --git a/resources/aws/ml/code-interpreter.png b/resources/aws/ml/code-interpreter.png new file mode 100644 index 00000000..b51d0033 Binary files /dev/null and b/resources/aws/ml/code-interpreter.png differ diff --git a/resources/aws/ml/evaluations.png b/resources/aws/ml/evaluations.png new file mode 100644 index 00000000..15dcb02e Binary files /dev/null and b/resources/aws/ml/evaluations.png differ diff --git a/resources/aws/ml/gateway.png b/resources/aws/ml/gateway.png new file mode 100644 index 00000000..099b2d14 Binary files /dev/null and b/resources/aws/ml/gateway.png differ diff --git a/resources/aws/ml/identity.png b/resources/aws/ml/identity.png new file mode 100644 index 00000000..d6eeccd7 Binary files /dev/null and b/resources/aws/ml/identity.png differ diff --git a/resources/aws/ml/memory.png b/resources/aws/ml/memory.png new file mode 100644 index 00000000..e864cfb1 Binary files /dev/null and b/resources/aws/ml/memory.png differ diff --git a/resources/aws/ml/observability.png b/resources/aws/ml/observability.png new file mode 100644 index 00000000..8588ea29 Binary files /dev/null and b/resources/aws/ml/observability.png differ diff --git a/resources/aws/ml/policy-engine-agentic-guardrails.png b/resources/aws/ml/policy-engine-agentic-guardrails.png new file mode 100644 index 00000000..4239e826 Binary files /dev/null and b/resources/aws/ml/policy-engine-agentic-guardrails.png differ diff --git a/resources/aws/ml/runtime.png b/resources/aws/ml/runtime.png new file mode 100644 index 00000000..e7daf27e Binary files /dev/null and b/resources/aws/ml/runtime.png differ diff --git a/tests/test_aws_ml_icons.py b/tests/test_aws_ml_icons.py new file mode 100644 index 00000000..a16965eb --- /dev/null +++ b/tests/test_aws_ml_icons.py @@ -0,0 +1,93 @@ +import os +import unittest + +from diagrams import Diagram, setcluster, setdiagram +from diagrams.aws.ml import ( + DLC, + OBS, + PEAG, + AgentCore, + AiAgent, + AIAgent, + AmazonNova, + AWSAppStudio, + AWSNeuron, + BrowserTool, + CodeInterpreter, + Evaluations, + Gateway, + Identity, + Memory, + Observability, + PolicyEngineAgenticGuardrails, + Runtime, +) + + +class AgentcoreIconsTest(unittest.TestCase): + def setUp(self): + self.name = "test_agentcore_icons" + + def tearDown(self): + setdiagram(None) + setcluster(None) + try: + os.remove(self.name + ".png") + except FileNotFoundError: + pass + + def test_agentcore_diagram(self): + with Diagram(name=self.name, show=False, filename=self.name): + agentcore = AgentCore("Agentcore") + ai_agent = AiAgent("AI Agent") + runtime = Runtime("Runtime") + gateway = Gateway("Gateway") + identity = Identity("Identity") + policy_engine = PolicyEngineAgenticGuardrails("Policy Engine") + code_interpreter = CodeInterpreter("Code Interpreter") + browser_tool = BrowserTool("Browser Tool") + memory = Memory("Memory") + observability = Observability("Observability") + evaluations = Evaluations("Evaluations") + + agentcore >> ai_agent >> runtime + ai_agent >> [code_interpreter, browser_tool, memory] + gateway >> identity >> policy_engine + [runtime, code_interpreter, browser_tool] >> observability + observability >> evaluations + + self.assertTrue(os.path.exists(self.name + ".png")) + + +class NovaIconsTest(unittest.TestCase): + def setUp(self): + self.name = "test_nova_icons" + + def tearDown(self): + setdiagram(None) + setcluster(None) + try: + os.remove(self.name + ".png") + except FileNotFoundError: + pass + + def test_nova_diagram(self): + with Diagram(name=self.name, show=False, filename=self.name): + nova = AmazonNova("Amazon Nova") + app_studio = AWSAppStudio("AWS App Studio") + neuron = AWSNeuron("AWS Neuron") + + nova >> app_studio >> neuron + + self.assertTrue(os.path.exists(self.name + ".png")) + + +class AliasesTest(unittest.TestCase): + def test_aliases_exist(self): + self.assertIs(AIAgent, AiAgent) + self.assertIs(PEAG, PolicyEngineAgenticGuardrails) + self.assertIs(OBS, Observability) + + +if __name__ == "__main__": + unittest.main() diff --git a/website/static/img/resources/aws/ml/agentcore.png b/website/static/img/resources/aws/ml/agentcore.png new file mode 100644 index 00000000..debeadd2 Binary files /dev/null and b/website/static/img/resources/aws/ml/agentcore.png differ diff --git a/website/static/img/resources/aws/ml/ai-agent.png b/website/static/img/resources/aws/ml/ai-agent.png new file mode 100644 index 00000000..f13894a9 Binary files /dev/null and b/website/static/img/resources/aws/ml/ai-agent.png differ diff --git a/website/static/img/resources/aws/ml/amazon-nova.png b/website/static/img/resources/aws/ml/amazon-nova.png new file mode 100644 index 00000000..bfbfc28d Binary files /dev/null and b/website/static/img/resources/aws/ml/amazon-nova.png differ diff --git a/website/static/img/resources/aws/ml/aws-app-studio.png b/website/static/img/resources/aws/ml/aws-app-studio.png new file mode 100644 index 00000000..c6340b3b Binary files /dev/null and b/website/static/img/resources/aws/ml/aws-app-studio.png differ diff --git a/website/static/img/resources/aws/ml/aws-neuron.png b/website/static/img/resources/aws/ml/aws-neuron.png new file mode 100644 index 00000000..3f6b96c5 Binary files /dev/null and b/website/static/img/resources/aws/ml/aws-neuron.png differ diff --git a/website/static/img/resources/aws/ml/browser-tool.png b/website/static/img/resources/aws/ml/browser-tool.png new file mode 100644 index 00000000..bc41ba93 Binary files /dev/null and b/website/static/img/resources/aws/ml/browser-tool.png differ diff --git a/website/static/img/resources/aws/ml/code-interpreter.png b/website/static/img/resources/aws/ml/code-interpreter.png new file mode 100644 index 00000000..b51d0033 Binary files /dev/null and b/website/static/img/resources/aws/ml/code-interpreter.png differ diff --git a/website/static/img/resources/aws/ml/evaluations.png b/website/static/img/resources/aws/ml/evaluations.png new file mode 100644 index 00000000..15dcb02e Binary files /dev/null and b/website/static/img/resources/aws/ml/evaluations.png differ diff --git a/website/static/img/resources/aws/ml/gateway.png b/website/static/img/resources/aws/ml/gateway.png new file mode 100644 index 00000000..099b2d14 Binary files /dev/null and b/website/static/img/resources/aws/ml/gateway.png differ diff --git a/website/static/img/resources/aws/ml/identity.png b/website/static/img/resources/aws/ml/identity.png new file mode 100644 index 00000000..d6eeccd7 Binary files /dev/null and b/website/static/img/resources/aws/ml/identity.png differ diff --git a/website/static/img/resources/aws/ml/memory.png b/website/static/img/resources/aws/ml/memory.png new file mode 100644 index 00000000..e864cfb1 Binary files /dev/null and b/website/static/img/resources/aws/ml/memory.png differ diff --git a/website/static/img/resources/aws/ml/observability.png b/website/static/img/resources/aws/ml/observability.png new file mode 100644 index 00000000..8588ea29 Binary files /dev/null and b/website/static/img/resources/aws/ml/observability.png differ diff --git a/website/static/img/resources/aws/ml/policy-engine-agentic-guardrails.png b/website/static/img/resources/aws/ml/policy-engine-agentic-guardrails.png new file mode 100644 index 00000000..4239e826 Binary files /dev/null and b/website/static/img/resources/aws/ml/policy-engine-agentic-guardrails.png differ diff --git a/website/static/img/resources/aws/ml/runtime.png b/website/static/img/resources/aws/ml/runtime.png new file mode 100644 index 00000000..e7daf27e Binary files /dev/null and b/website/static/img/resources/aws/ml/runtime.png differ