agentenv-framework 0.9.1254__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.
- agent_env/__init__.py +0 -0
- agent_env/a2a_agent/__init__.py +23 -0
- agent_env/a2a_agent/a2a_agent.py +600 -0
- agent_env/a2a_agent/conversation_store.py +356 -0
- agent_env/a2a_agent/object_transfer.py +609 -0
- agent_env/a2a_agent/protocol.py +238 -0
- agent_env/a2a_agent/store.py +201 -0
- agent_env/a2a_agent/validator.py +901 -0
- agent_env/artifact/__init__.py +48 -0
- agent_env/artifact/artifact.py +74 -0
- agent_env/artifact/artifacts/__init__.py +0 -0
- agent_env/artifact/artifacts/cli.py +83 -0
- agent_env/artifact/artifacts/docker_image.py +457 -0
- agent_env/artifact/artifacts/environment.py +89 -0
- agent_env/artifact/artifacts/environment_universe.py +156 -0
- agent_env/artifact/artifacts/file.py +214 -0
- agent_env/artifact/artifacts/file_artifact_universe.py +206 -0
- agent_env/artifact/artifacts/skill.py +206 -0
- agent_env/artifact/artifacts/vm_image.py +95 -0
- agent_env/artifact/ref.py +15 -0
- agent_env/artifact/registry.py +251 -0
- agent_env/artifact/store.py +295 -0
- agent_env/artifact/universe.py +38 -0
- agent_env/attribution.py +41 -0
- agent_env/bundle/__init__.py +4 -0
- agent_env/bundle/_fs.py +128 -0
- agent_env/bundle/authoring.py +239 -0
- agent_env/bundle/installed.py +175 -0
- agent_env/bundle/ledger.py +269 -0
- agent_env/bundle/materialize.py +204 -0
- agent_env/bundle/parse.py +594 -0
- agent_env/bundle/plan.py +414 -0
- agent_env/bundle/resolve.py +404 -0
- agent_env/bundle/run.py +361 -0
- agent_env/cli/__init__.py +69 -0
- agent_env/cli/__main__.py +10 -0
- agent_env/cli/_installers.py +576 -0
- agent_env/cli/_plugin_changes.py +947 -0
- agent_env/cli/a2a_agent/__init__.py +22 -0
- agent_env/cli/a2a_agent/add_skill.py +97 -0
- agent_env/cli/a2a_agent/deploy.py +60 -0
- agent_env/cli/a2a_agent/get.py +15 -0
- agent_env/cli/a2a_agent/get_instance.py +26 -0
- agent_env/cli/a2a_agent/put.py +78 -0
- agent_env/cli/a2a_agent/validate.py +56 -0
- agent_env/cli/artifact/__init__.py +20 -0
- agent_env/cli/artifact/cli.py +83 -0
- agent_env/cli/artifact/environment.py +44 -0
- agent_env/cli/artifact/environment_universe.py +163 -0
- agent_env/cli/artifact/file_artifact_universe.py +281 -0
- agent_env/cli/artifact/skill.py +128 -0
- agent_env/cli/banner.py +25 -0
- agent_env/cli/config.py +263 -0
- agent_env/cli/env/__init__.py +31 -0
- agent_env/cli/env/deploy.py +112 -0
- agent_env/cli/env/gateway.py +57 -0
- agent_env/cli/env/get_instance.py +40 -0
- agent_env/cli/env/mcp_server.py +410 -0
- agent_env/cli/env/multi.py +282 -0
- agent_env/cli/env/service_db.py +99 -0
- agent_env/cli/env/snapshot.py +35 -0
- agent_env/cli/env/state/__init__.py +6 -0
- agent_env/cli/env/state/init.py +108 -0
- agent_env/cli/env/state/teardown.py +44 -0
- agent_env/cli/env/website.py +216 -0
- agent_env/cli/env/website_browser.py +67 -0
- agent_env/cli/eval/__init__.py +16 -0
- agent_env/cli/eval/add_tasks.py +63 -0
- agent_env/cli/eval/create.py +49 -0
- agent_env/cli/eval/run.py +194 -0
- agent_env/cli/identity/__init__.py +5 -0
- agent_env/cli/identity/client_identity.py +37 -0
- agent_env/cli/plugin.py +438 -0
- agent_env/cli/run.py +285 -0
- agent_env/cli/task/__init__.py +21 -0
- agent_env/cli/task/create.py +109 -0
- agent_env/cli/task/get.py +17 -0
- agent_env/cli/task/get_instance.py +34 -0
- agent_env/cli/task/run.py +615 -0
- agent_env/cli/task/validate.py +31 -0
- agent_env/cli/up.py +123 -0
- agent_env/cli/utils.py +183 -0
- agent_env/config/__init__.py +50 -0
- agent_env/config/describe.py +1067 -0
- agent_env/config/errors.py +13 -0
- agent_env/config/loader.py +245 -0
- agent_env/config/model.py +154 -0
- agent_env/config/paths.py +25 -0
- agent_env/config/plugin_tables.py +101 -0
- agent_env/config/provenance.py +134 -0
- agent_env/config/runtime.py +1064 -0
- agent_env/config/snapshot.py +81 -0
- agent_env/entity_refs.py +186 -0
- agent_env/env/__init__.py +49 -0
- agent_env/env/env.py +433 -0
- agent_env/env/env_artifact_store.py +87 -0
- agent_env/env/envs/__init__.py +7 -0
- agent_env/env/envs/_deployment.py +281 -0
- agent_env/env/envs/gateway_server.py +32 -0
- agent_env/env/envs/mcp_server.py +387 -0
- agent_env/env/envs/multi_env.py +780 -0
- agent_env/env/envs/service_db/Dockerfile +20 -0
- agent_env/env/envs/service_db/Dockerfile.db-mcp +42 -0
- agent_env/env/envs/service_db/Dockerfile.db-web +8 -0
- agent_env/env/envs/service_db.py +92 -0
- agent_env/env/envs/website.py +294 -0
- agent_env/env/envs/website_browser/Dockerfile +40 -0
- agent_env/env/envs/website_browser/__init__.py +17 -0
- agent_env/env/envs/website_browser/entrypoint.sh +13 -0
- agent_env/env/gateway/Dockerfile +14 -0
- agent_env/env/gateway/__init__.py +37 -0
- agent_env/env/gateway/clock.py +184 -0
- agent_env/env/gateway/constants.py +190 -0
- agent_env/env/gateway/entrypoint.py +156 -0
- agent_env/env/gateway/gateway.py +1095 -0
- agent_env/env/gateway/get_time.py +60 -0
- agent_env/env/gateway/requirements.txt +4 -0
- agent_env/env/gateway/triggers.py +1193 -0
- agent_env/env/legacy_protocol.py +146 -0
- agent_env/env/registry.py +93 -0
- agent_env/env/snapshot_store.py +372 -0
- agent_env/env/store.py +411 -0
- agent_env/eval/__init__.py +14 -0
- agent_env/eval/eval.py +68 -0
- agent_env/eval/store.py +116 -0
- agent_env/examples/hello/README.md +9 -0
- agent_env/examples/hello/artifacts/greeting/check.sh +1 -0
- agent_env/examples/hello/artifacts/greeting/hello.txt +1 -0
- agent_env/examples/hello/tasks/hello.json +10 -0
- agent_env/explorer/__init__.py +12 -0
- agent_env/explorer/app.py +277 -0
- agent_env/explorer/openapi_docs.py +242 -0
- agent_env/explorer/plugin.py +95 -0
- agent_env/explorer/routers/__init__.py +1 -0
- agent_env/explorer/routers/common.py +174 -0
- agent_env/explorer/routers/conversations.py +25 -0
- agent_env/explorer/routers/objects.py +112 -0
- agent_env/explorer/routers/runs.py +475 -0
- agent_env/plugins/__init__.py +59 -0
- agent_env/plugins/_cli.py +244 -0
- agent_env/plugins/_discovery.py +97 -0
- agent_env/plugins/_inventory.py +262 -0
- agent_env/plugins/_registration.py +268 -0
- agent_env/plugins/_report.py +47 -0
- agent_env/plugins/_requirements.py +55 -0
- agent_env/providers/__init__.py +37 -0
- agent_env/providers/env_providers/__init__.py +12 -0
- agent_env/providers/env_providers/constants.py +13 -0
- agent_env/providers/env_providers/env_gateway_provider.py +1354 -0
- agent_env/providers/env_providers/env_provider.py +237 -0
- agent_env/providers/env_providers/env_server_provider.py +133 -0
- agent_env/providers/env_state/__init__.py +49 -0
- agent_env/providers/env_state/env_state_provider.py +554 -0
- agent_env/providers/env_state/local_postgres.py +390 -0
- agent_env/providers/env_state/store.py +112 -0
- agent_env/providers/sandbox_providers/__init__.py +29 -0
- agent_env/providers/sandbox_providers/chained_sandbox_provider.py +93 -0
- agent_env/providers/sandbox_providers/e2b/__init__.py +6 -0
- agent_env/providers/sandbox_providers/e2b/provider.py +376 -0
- agent_env/providers/sandbox_providers/e2b/sandbox.py +342 -0
- agent_env/providers/sandbox_providers/e2b/template.py +158 -0
- agent_env/providers/sandbox_providers/local_sandbox.py +408 -0
- agent_env/providers/sandbox_providers/modal_sandbox.py +500 -0
- agent_env/providers/sandbox_providers/modal_vm_sandbox.py +466 -0
- agent_env/providers/sandbox_providers/sandbox.py +387 -0
- agent_env/providers/sandbox_providers/sandbox_provider.py +614 -0
- agent_env/py.typed +0 -0
- agent_env/runner/__init__.py +16 -0
- agent_env/runner/local_runner.py +190 -0
- agent_env/runner/runner.py +127 -0
- agent_env/runner/store.py +94 -0
- agent_env/store/__init__.py +126 -0
- agent_env/store/_google.py +68 -0
- agent_env/store/base.py +33 -0
- agent_env/store/document_store/__init__.py +60 -0
- agent_env/store/document_store/document_store.py +519 -0
- agent_env/store/document_store/dynamodb_document_store.py +306 -0
- agent_env/store/document_store/evaluation.py +199 -0
- agent_env/store/document_store/firestore_mongo_document_store.py +242 -0
- agent_env/store/document_store/mongo_document_store.py +259 -0
- agent_env/store/document_store/sqlite_document_store.py +314 -0
- agent_env/store/ids.py +123 -0
- agent_env/store/image_store/__init__.py +34 -0
- agent_env/store/image_store/ecr_image_store.py +131 -0
- agent_env/store/image_store/google_credentials.py +113 -0
- agent_env/store/image_store/image_store.py +113 -0
- agent_env/store/image_store/local_registry_image_store.py +106 -0
- agent_env/store/image_store/oci_registry_credentials.py +196 -0
- agent_env/store/local_state.py +27 -0
- agent_env/store/object_store/__init__.py +24 -0
- agent_env/store/object_store/gcs_object_store.py +415 -0
- agent_env/store/object_store/local_object_store.py +143 -0
- agent_env/store/object_store/object_store.py +198 -0
- agent_env/store/object_store/s3_object_store.py +354 -0
- agent_env/store/query.py +112 -0
- agent_env/store/routing.py +609 -0
- agent_env/store/secret_store/__init__.py +19 -0
- agent_env/store/secret_store/aws_secrets_manager_secret_store.py +293 -0
- agent_env/store/secret_store/gcp_secret_manager_secret_store.py +319 -0
- agent_env/store/secret_store/local_secret_store.py +47 -0
- agent_env/store/secret_store/secret_store.py +19 -0
- agent_env/task/__init__.py +27 -0
- agent_env/task/interrupts.py +109 -0
- agent_env/task/registry.py +27 -0
- agent_env/task/step_journal.py +99 -0
- agent_env/task/store.py +940 -0
- agent_env/task/task.py +815 -0
- agent_env/task/teardown.py +142 -0
- agent_env/task_step/__init__.py +47 -0
- agent_env/task_step/context.py +195 -0
- agent_env/task_step/context_ops.py +224 -0
- agent_env/task_step/registry.py +182 -0
- agent_env/task_step/review_store.py +118 -0
- agent_env/task_step/snapshot_utils/__init__.py +2 -0
- agent_env/task_step/snapshot_utils/agent_state_capture.py +261 -0
- agent_env/task_step/snapshot_utils/snapshot_series.py +631 -0
- agent_env/task_step/store.py +129 -0
- agent_env/task_step/task_step.py +173 -0
- agent_env/task_step/task_steps/__init__.py +27 -0
- agent_env/task_step/task_steps/a2a_agent_validator/__init__.py +31 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/README.md +158 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.m4a +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.mp3 +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.mp4 +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.ogg +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.wav +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/document.pdf +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.gif +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.jpg +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.png +0 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_card.py +103 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_config_identity.py +69 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_mcp.py +178 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_core_protocol.py +67 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_install.py +115 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_litellm_attribution.py +124 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_litellm_attribution_runtime.py +173 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_modalities.py +270 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_peer_agents.py +102 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_role.py +151 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_skill_config.py +194 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_snapshot.py +111 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_system_prompt.py +215 -0
- agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_trajectory.py +164 -0
- agent_env/task_step/task_steps/add_skills.py +240 -0
- agent_env/task_step/task_steps/apply_server_config.py +288 -0
- agent_env/task_step/task_steps/collect_artifacts.py +940 -0
- agent_env/task_step/task_steps/deploy_agent.py +626 -0
- agent_env/task_step/task_steps/deploy_env.py +197 -0
- agent_env/task_step/task_steps/deploy_human_agent.py +100 -0
- agent_env/task_step/task_steps/deploy_sandbox.py +170 -0
- agent_env/task_step/task_steps/env_card_validator/__init__.py +4 -0
- agent_env/task_step/task_steps/env_card_validator/verify_env_card.py +109 -0
- agent_env/task_step/task_steps/env_card_validator/verify_env_core_protocol.py +108 -0
- agent_env/task_step/task_steps/install_agent.py +376 -0
- agent_env/task_step/task_steps/load_artifact.py +775 -0
- agent_env/task_step/task_steps/mcp_cli_builder/__init__.py +4 -0
- agent_env/task_step/task_steps/mcp_cli_builder/build_mcp_cli.py +201 -0
- agent_env/task_step/task_steps/mcp_cli_builder/codegen.py +627 -0
- agent_env/task_step/task_steps/mcp_env_validator/__init__.py +44 -0
- agent_env/task_step/task_steps/mcp_env_validator/validation_gate_aggregator.py +102 -0
- agent_env/task_step/task_steps/mcp_env_validator/verify_mcp_env_assessment.py +78 -0
- agent_env/task_step/task_steps/mcp_env_validator/verify_mcp_tool_schema.py +152 -0
- agent_env/task_step/task_steps/mcp_env_validator/verify_spec_conformance.py +486 -0
- agent_env/task_step/task_steps/modify_env_tool_access.py +80 -0
- agent_env/task_step/task_steps/multienv_validator/__init__.py +3 -0
- agent_env/task_step/task_steps/multienv_validator/combine_universe_verdicts.py +107 -0
- agent_env/task_step/task_steps/multienv_validator/universe_comparison.py +253 -0
- agent_env/task_step/task_steps/multienv_validator/verify_universe_agent_judge.py +180 -0
- agent_env/task_step/task_steps/multienv_validator/verify_universe_roundtrip.py +241 -0
- agent_env/task_step/task_steps/peer_agents.py +92 -0
- agent_env/task_step/task_steps/prompt_agent.py +900 -0
- agent_env/task_step/task_steps/register_agent_triggers.py +113 -0
- agent_env/task_step/task_steps/register_env_triggers.py +97 -0
- agent_env/task_step/task_steps/reset_env.py +71 -0
- agent_env/task_step/task_steps/review.py +152 -0
- agent_env/task_step/task_steps/run_code.py +461 -0
- agent_env/task_step/task_steps/run_code_runner.py +52 -0
- agent_env/task_step/task_steps/run_docker_container.py +380 -0
- agent_env/task_step/task_steps/sandbox_utils/__init__.py +0 -0
- agent_env/task_step/task_steps/sandbox_utils/sandbox_utils.py +79 -0
- agent_env/task_step/task_steps/snapshot_agent_state.py +205 -0
- agent_env/task_step/task_steps/snapshot_env.py +637 -0
- agent_env/task_step/task_steps/sync_env_clock.py +132 -0
- agent_env/task_step/task_steps/teardown_sandboxes.py +170 -0
- agent_env/task_step/task_steps/verifiers/__init__.py +23 -0
- agent_env/task_step/task_steps/verifiers/agent_prompt_response_verifier.py +166 -0
- agent_env/task_step/task_steps/verifiers/aggregate_verifiers.py +90 -0
- agent_env/task_step/task_steps/verifiers/env_outcome_verifier.py +127 -0
- agent_env/task_step/task_steps/verifiers/judge_utils/__init__.py +2 -0
- agent_env/task_step/task_steps/verifiers/judge_utils/frame_selection.py +377 -0
- agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py +1293 -0
- agent_env/task_step/task_steps/verifiers/judge_utils/trajectory_filter.py +514 -0
- agent_env/task_step/task_steps/verifiers/rubrics_verifier.py +1318 -0
- agent_env/task_step/task_steps/verifiers/run_container_unit_tests_verifier.py +434 -0
- agent_env/task_step/task_steps/verifiers/scoring.py +40 -0
- agent_env/task_step/task_steps/verifiers/verify_sandbox.py +308 -0
- agent_env/task_step/thread_work.py +61 -0
- agent_env/utils/__init__.py +0 -0
- agent_env/utils/card_naming.py +108 -0
- agent_env/utils/deprecation.py +109 -0
- agent_env/utils/docker_build.py +29 -0
- agent_env/utils/exec_retry.py +77 -0
- agent_env/utils/litellm_attribution.py +59 -0
- agent_env/utils/paths.py +20 -0
- agentenv_framework-0.9.1254.dist-info/METADATA +394 -0
- agentenv_framework-0.9.1254.dist-info/RECORD +312 -0
- agentenv_framework-0.9.1254.dist-info/WHEEL +4 -0
- agentenv_framework-0.9.1254.dist-info/entry_points.txt +5 -0
- agentenv_framework-0.9.1254.dist-info/licenses/LICENSE +202 -0
- agentenv_framework-0.9.1254.dist-info/licenses/NOTICE +4 -0
- agentenv_framework-0.9.1254.dist-info/licenses/THIRD_PARTY_NOTICES.md +7665 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"""MCP Server environment."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import os
|
|
7
|
+
import shlex
|
|
8
|
+
import uuid
|
|
9
|
+
from importlib.metadata import version as pkg_version
|
|
10
|
+
from typing import TYPE_CHECKING, Callable, ClassVar, Optional
|
|
11
|
+
|
|
12
|
+
from agentenv_protocol import FilePart, client as protocol_v1
|
|
13
|
+
from agent_env.artifact import Artifact, DockerImageArtifact
|
|
14
|
+
from agent_env.artifact.artifacts.docker_image import GitHubBuildResult, ProgressCallback, refuse_local_github_build
|
|
15
|
+
from agent_env.env.env import Env, gateway_url_of
|
|
16
|
+
from agent_env.store.routing import refuse_local_derivation
|
|
17
|
+
from agent_env.env import legacy_protocol
|
|
18
|
+
from agent_env.env.envs._deployment import (
|
|
19
|
+
as_builtin, builtin_provider_for, close_deployed, close_replaced, deploy_refusal, deploy_through_provider, host_staging_refusal,
|
|
20
|
+
load_by_signed_url, plugin_provider_like_a_builtin, provider_or_class,
|
|
21
|
+
)
|
|
22
|
+
from agent_env.env.gateway import GatewayMode
|
|
23
|
+
from agent_env.providers.sandbox_providers.sandbox_provider import SANDBOX_MODE_CONTAINER
|
|
24
|
+
from agent_env.attribution import Attribution
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
from agent_env.artifact import CliArtifact, EnvironmentArtifact, EnvironmentUniverseArtifact
|
|
28
|
+
from agent_env.env.env import DeployedEnv
|
|
29
|
+
from agent_env.providers.env_providers.env_provider import EnvironmentProvider
|
|
30
|
+
|
|
31
|
+
logger = logging.getLogger(__name__)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class MCPServerEnv(Env):
|
|
35
|
+
type: ClassVar[str] = "mcp_server"
|
|
36
|
+
description = "An MCP server, deployed through the environment provider its env_provider_type names"
|
|
37
|
+
_MCP_MAX_RETRIES: ClassVar[int] = 5
|
|
38
|
+
|
|
39
|
+
def __init__(self, id: str, version: Optional[int], docker_image_artifact: DockerImageArtifact, environment_name: Optional[str] = None, *, metadata: Optional[dict[str, str]] = None, env_provider_type: str = "gateway"):
|
|
40
|
+
super().__init__(id, version, metadata=metadata)
|
|
41
|
+
if not environment_name:
|
|
42
|
+
raise ValueError("environment_name cannot be empty")
|
|
43
|
+
if not env_provider_type:
|
|
44
|
+
raise ValueError("env_provider_type cannot be empty")
|
|
45
|
+
self.docker_image_artifact = docker_image_artifact
|
|
46
|
+
self.environment_name = environment_name
|
|
47
|
+
self.env_provider_type = env_provider_type
|
|
48
|
+
self._sandbox = None
|
|
49
|
+
# A built-in's provider is built with the env, as callers that wire an env up by hand rely on; a plugin's is built
|
|
50
|
+
# when the env deploys, so reading a stored env needs no plugin installed. A MultiEnv hands its children its own.
|
|
51
|
+
self._env_provider: Optional[EnvironmentProvider] = builtin_provider_for(env_provider_type)
|
|
52
|
+
self._gateway_url = None
|
|
53
|
+
self._deployed: Optional[DeployedEnv] = None
|
|
54
|
+
self._replaced: list[tuple] = [] # the provider and sandbox of each deployment a later deploy replaced, for close()
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> dict:
|
|
57
|
+
base = super().to_dict()
|
|
58
|
+
base["docker_image_artifact"] = {
|
|
59
|
+
"id": self.docker_image_artifact.id,
|
|
60
|
+
"version": self.docker_image_artifact.version,
|
|
61
|
+
"type": self.docker_image_artifact.type,
|
|
62
|
+
}
|
|
63
|
+
base["service_name"] = self.environment_name
|
|
64
|
+
base["environment_name"] = self.environment_name # dual-write with service_name during the rename
|
|
65
|
+
base["env_provider_type"] = self.env_provider_type
|
|
66
|
+
return base
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_dict(cls, data: dict) -> MCPServerEnv:
|
|
70
|
+
artifact_ref = data["docker_image_artifact"]
|
|
71
|
+
docker_image_artifact = Artifact.get(artifact_ref["id"], version=artifact_ref["version"])
|
|
72
|
+
return cls(
|
|
73
|
+
id=data["id"],
|
|
74
|
+
version=data.get("version"),
|
|
75
|
+
docker_image_artifact=docker_image_artifact,
|
|
76
|
+
environment_name=data["environment_name"] if "environment_name" in data else data["service_name"],
|
|
77
|
+
metadata=data.get("metadata", {}),
|
|
78
|
+
env_provider_type=data.get("env_provider_type", "gateway"),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
async def deploy(self, ttl_seconds: int = 10800, disk_size_gb: float = 10, gateway_mode: GatewayMode = GatewayMode.PERFORMANCE, cpu: float | None = None, memory_mb: int | None = None, sandbox_type: str | None = None, priority: Optional[int] = None, env_state_type: str | None = None, env_state_instance_id: str | None = None, *, attribution: Optional[Attribution] = None) -> DeployedEnv:
|
|
82
|
+
# In container mode the server runs in its own container, so loads stage there, as for a MultiEnv child.
|
|
83
|
+
return await deploy_through_provider(
|
|
84
|
+
self, environment_name=self.environment_name, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type,
|
|
85
|
+
disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, priority=priority,
|
|
86
|
+
env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def deploy_refusal(self, **options) -> str | None:
|
|
90
|
+
"""Why deploy() would refuse these options before building anything, or None; raises, as deploy() does, for a type this process can't find."""
|
|
91
|
+
return deploy_refusal(self, provider_or_class(self), options)
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
async def from_deployed_env(cls, deployed: DeployedEnv) -> MCPServerEnv:
|
|
95
|
+
env = Env.get(deployed.env_id, deployed.env_version)
|
|
96
|
+
if not isinstance(env, MCPServerEnv):
|
|
97
|
+
raise TypeError(f"Expected MCPServerEnv, got {type(env).__name__}")
|
|
98
|
+
if env._env_provider is None:
|
|
99
|
+
env._env_provider = plugin_provider_like_a_builtin(env.env_provider_type)
|
|
100
|
+
if builtin := as_builtin(env._env_provider):
|
|
101
|
+
env._sandbox = await builtin._reattach(env, deployed)
|
|
102
|
+
# Any other plugin's deployment holds its own sandboxes: its env loads through its card and reattaches none.
|
|
103
|
+
env._gateway_url = gateway_url_of(deployed)
|
|
104
|
+
env._instance_id = deployed.instance_id
|
|
105
|
+
env._deployed = deployed
|
|
106
|
+
return env
|
|
107
|
+
|
|
108
|
+
async def close(self) -> None:
|
|
109
|
+
await close_replaced(self)
|
|
110
|
+
if self._env_provider is not None:
|
|
111
|
+
try:
|
|
112
|
+
await self._env_provider.close()
|
|
113
|
+
except BaseException as e:
|
|
114
|
+
logger.warning(f"Failed to close env provider: {e}")
|
|
115
|
+
if self._sandbox is not None:
|
|
116
|
+
try:
|
|
117
|
+
await self._sandbox.terminate()
|
|
118
|
+
except BaseException as e:
|
|
119
|
+
logger.warning(f"Failed to terminate sandbox {self._sandbox.sandbox_id}: {e}")
|
|
120
|
+
self._sandbox = None
|
|
121
|
+
|
|
122
|
+
async def load_environment_artifact(self, environment_artifact: EnvironmentArtifact) -> None:
|
|
123
|
+
builtin = as_builtin(self._env_provider)
|
|
124
|
+
# A built-in's deploy leaves a sandbox to stage into; a plugin's leaves only its record.
|
|
125
|
+
if (self._sandbox if builtin else self._deployed) is None:
|
|
126
|
+
raise RuntimeError("Environment not deployed - call deploy() first")
|
|
127
|
+
if environment_artifact.environment_name != self.environment_name:
|
|
128
|
+
raise ValueError(
|
|
129
|
+
f"EnvironmentArtifact environment_name '{environment_artifact.environment_name}' "
|
|
130
|
+
f"does not match env environment_name '{self.environment_name}'"
|
|
131
|
+
)
|
|
132
|
+
file_artifact = environment_artifact.get_file_artifact()
|
|
133
|
+
if builtin is None:
|
|
134
|
+
await load_by_signed_url(self, file_artifact)
|
|
135
|
+
return
|
|
136
|
+
base_url = await legacy_protocol.v1_base_url(self._deployed, self._gateway_url, self.environment_name, mcp=True)
|
|
137
|
+
if base_url is not None:
|
|
138
|
+
from agent_env.env.gateway.constants import data_plane_load_timeout_s
|
|
139
|
+
container_path = await self._copy_artifact_into_container(file_artifact)
|
|
140
|
+
# Sized from the payload actually staged on the VM rather than a flat constant:
|
|
141
|
+
# a 3.5GB service and a 30KB one were previously given the same 600s, which
|
|
142
|
+
# killed healthy large loads. Measured after staging so the number reflects real
|
|
143
|
+
# bytes rather than whatever the artifact document claims.
|
|
144
|
+
timeout = data_plane_load_timeout_s(await self._staged_artifact_size(container_path))
|
|
145
|
+
# reset_data previously took the client default (30s), tighter than the load it
|
|
146
|
+
# precedes -- dropping and recreating a large service's schemas can plausibly
|
|
147
|
+
# exceed that. Give it the same budget as the load it belongs to.
|
|
148
|
+
await protocol_v1.reset_data(base_url, timeout=timeout)
|
|
149
|
+
await protocol_v1.add_data(base_url, [FilePart(file={
|
|
150
|
+
"uri": f"file://{container_path}",
|
|
151
|
+
"mimeType": file_artifact.content_type,
|
|
152
|
+
"name": file_artifact.filename,
|
|
153
|
+
})], timeout=timeout)
|
|
154
|
+
else:
|
|
155
|
+
await self._load_environment_artifact_legacy(file_artifact)
|
|
156
|
+
await builtin.install_changelog_triggers(self.environment_name)
|
|
157
|
+
|
|
158
|
+
async def load_file_artifact_universe(self, file_artifact_universe: "Any", destination_path: Optional[str] = None,
|
|
159
|
+
) -> "LoadFileArtifactUniverseResult":
|
|
160
|
+
if refusal := host_staging_refusal(self, "Staging files onto the env's host"):
|
|
161
|
+
raise RuntimeError(refusal)
|
|
162
|
+
return await super().load_file_artifact_universe(file_artifact_universe, destination_path)
|
|
163
|
+
|
|
164
|
+
async def load_environment_universe_artifact(self, environment_universe_artifact: EnvironmentUniverseArtifact) -> None:
|
|
165
|
+
environment_artifacts = environment_universe_artifact.get_environment_artifacts()
|
|
166
|
+
matching = [sa for sa in environment_artifacts if sa.environment_name == self.environment_name]
|
|
167
|
+
if not matching:
|
|
168
|
+
raise RuntimeError(
|
|
169
|
+
f"MCPServerEnv '{self.id}' (environment '{self.environment_name}') cannot load "
|
|
170
|
+
f"EnvironmentUniverseArtifact '{environment_universe_artifact.id}': it has no EnvironmentArtifact for "
|
|
171
|
+
f"environment '{self.environment_name}' (universe environments: {[sa.environment_name for sa in environment_artifacts]})."
|
|
172
|
+
)
|
|
173
|
+
skipped = [sa.environment_name for sa in environment_artifacts if sa.environment_name != self.environment_name]
|
|
174
|
+
if skipped:
|
|
175
|
+
logger.warning(f"[{self.id}] loading only service '{self.environment_name}' from universe '{environment_universe_artifact.id}'; skipping non-hostable services {skipped}")
|
|
176
|
+
await self.load_environment_artifact(matching[0])
|
|
177
|
+
if self._instance_id:
|
|
178
|
+
from agent_env.env.store import update_env_instance_environment_universe
|
|
179
|
+
update_env_instance_environment_universe(self._instance_id, environment_universe_artifact.id, environment_universe_artifact.version)
|
|
180
|
+
|
|
181
|
+
async def load_artifact(self, artifact):
|
|
182
|
+
from agent_env.artifact import EnvironmentArtifact, EnvironmentUniverseArtifact
|
|
183
|
+
if isinstance(artifact, EnvironmentUniverseArtifact):
|
|
184
|
+
return await self.load_environment_universe_artifact(artifact)
|
|
185
|
+
if isinstance(artifact, EnvironmentArtifact):
|
|
186
|
+
return await self.load_environment_artifact(artifact)
|
|
187
|
+
raise ValueError(f"{type(self).__name__} '{self.id}' cannot load artifact '{getattr(artifact, 'id', '?')}' of type '{getattr(artifact, 'type', '?')}' — expected a EnvironmentArtifact or EnvironmentUniverseArtifact")
|
|
188
|
+
|
|
189
|
+
async def _staged_artifact_size(self, container_path: str) -> int | None:
|
|
190
|
+
"""Bytes of the staged payload, or None if it can't be measured.
|
|
191
|
+
|
|
192
|
+
Best-effort on purpose: the size only picks a timeout, so a failed stat should fall
|
|
193
|
+
back to the floor (today's behaviour) rather than fail a load that is fine.
|
|
194
|
+
"""
|
|
195
|
+
if self._sandbox is None:
|
|
196
|
+
return None
|
|
197
|
+
try:
|
|
198
|
+
container_id = await self._env_provider._get_container_id(self._sandbox, self.environment_name)
|
|
199
|
+
out = await self._sandbox.exec_script(
|
|
200
|
+
f"docker exec {container_id} stat -c %s {shlex.quote(container_path)}"
|
|
201
|
+
)
|
|
202
|
+
return int(out.strip())
|
|
203
|
+
except Exception as e: # noqa: BLE001 -- a measurement, not a dependency
|
|
204
|
+
logger.warning(
|
|
205
|
+
"[%s] could not stat staged payload %s (%s); using the floor timeout",
|
|
206
|
+
self.environment_name, container_path, e,
|
|
207
|
+
)
|
|
208
|
+
return None
|
|
209
|
+
|
|
210
|
+
async def _copy_artifact_into_container(self, file_artifact) -> str:
|
|
211
|
+
container_path = f"/data/{file_artifact.filename}"
|
|
212
|
+
if self._sandbox.mode == SANDBOX_MODE_CONTAINER:
|
|
213
|
+
await self._sandbox.write_file_from_s3(file_artifact.object_url, container_path)
|
|
214
|
+
else:
|
|
215
|
+
# Stage on the disk-backed app dir, not /tmp (tmpfs/RAM): a large
|
|
216
|
+
# artifact (github ~8GB) OOM-kills the copy under concurrent loads.
|
|
217
|
+
# Random suffix avoids collisions between concurrent loads.
|
|
218
|
+
from agent_env.providers.env_providers.constants import GATEWAY_APP_DIR
|
|
219
|
+
stage_dir = f"{GATEWAY_APP_DIR}/_artifact_staging"
|
|
220
|
+
vm_temp_path = f"{stage_dir}/{self.environment_name}-{uuid.uuid4().hex[:8]}-{file_artifact.filename}"
|
|
221
|
+
await self._sandbox.exec_script(f"mkdir -p {stage_dir}")
|
|
222
|
+
await self._sandbox.load_s3_file(file_artifact.object_url, vm_temp_path)
|
|
223
|
+
container_id = await self._env_provider._get_container_id(self._sandbox, self.environment_name)
|
|
224
|
+
await self._sandbox.exec_script(f"docker exec {container_id} mkdir -p /data")
|
|
225
|
+
await self._sandbox.exec_script(f"docker cp {vm_temp_path} {container_id}:{container_path}")
|
|
226
|
+
await self._sandbox.exec_script(f"rm -f {vm_temp_path}")
|
|
227
|
+
return container_path
|
|
228
|
+
|
|
229
|
+
async def _load_environment_artifact_legacy(self, file_artifact) -> None:
|
|
230
|
+
container_path = await self._copy_artifact_into_container(file_artifact)
|
|
231
|
+
await legacy_protocol.reset(
|
|
232
|
+
self._gateway_url, self.environment_name, container_path, max_retries=self._MCP_MAX_RETRIES
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
async def validate(self, on_progress: Optional[Callable[[str], None]] = None) -> str:
|
|
236
|
+
"""Run the env validator task and return the task instance ID.
|
|
237
|
+
|
|
238
|
+
Creates a new versioned Task with ID ``validate-{env_id}-v{version}`` each time.
|
|
239
|
+
"""
|
|
240
|
+
refuse_local_derivation(self.id, "env", "validating")
|
|
241
|
+
from agent_env.task import Task
|
|
242
|
+
from agent_env.task_step import DeployAgentTaskStep, DeployEnvTaskStep, PromptAgentTaskStep, ValidationGateAggregatorStep, VerifyCoreEnvironmentProtocolStep, VerifyEnvironmentCardStep, VerifyMCPToolSchemaTaskStep, VerifySpecConformanceTaskStep, VerifyMCPEnvAssessmentStep
|
|
243
|
+
from agent_env.task_step.task_steps.mcp_env_validator import TOOL_CORRECTNESS_PROMPT, TOOL_CORRECTNESS_OUTPUT_FORMAT
|
|
244
|
+
|
|
245
|
+
task_id = f"validate-{self.id}-v{self.version}"
|
|
246
|
+
prompt_id = f"{task_id}-prompt"
|
|
247
|
+
|
|
248
|
+
# Env metadata can narrow the gate, e.g. {"required_gates": ["mcp_tool_schema"]}.
|
|
249
|
+
# Unset = DEFAULT_REQUIRED_GATES.
|
|
250
|
+
required_gates = self.metadata.get("required_gates")
|
|
251
|
+
if required_gates is not None and not isinstance(required_gates, list):
|
|
252
|
+
logger.warning(f"Ignoring non-list required_gates in env metadata: {required_gates!r}")
|
|
253
|
+
required_gates = None
|
|
254
|
+
|
|
255
|
+
task = Task.put(
|
|
256
|
+
id=task_id,
|
|
257
|
+
steps=[
|
|
258
|
+
DeployEnvTaskStep(id=f"{task_id}-deploy", version=None, env_id=self.id, env_version=self.version),
|
|
259
|
+
VerifyEnvironmentCardStep(id=f"{task_id}-envcard", version=None, env_id=self.id, depends_on=[{"task_step_id": f"{task_id}-deploy"}]),
|
|
260
|
+
VerifyCoreEnvironmentProtocolStep(id=f"{task_id}-protocol", version=None, env_id=self.id, depends_on=[{"task_step_id": f"{task_id}-deploy"}]),
|
|
261
|
+
VerifyMCPToolSchemaTaskStep(id=f"{task_id}-schema", version=None, env_id=self.id, depends_on=[{"task_step_id": f"{task_id}-deploy"}]),
|
|
262
|
+
# Tolerant: an infra failure here must still let the gate aggregate,
|
|
263
|
+
# so `put` reports "gate did not run" rather than a traceback.
|
|
264
|
+
VerifySpecConformanceTaskStep(id=f"{task_id}-spec", version=None, env_id=self.id, depends_on=[{"task_step_id": f"{task_id}-deploy"}], fail_task_on_error=False),
|
|
265
|
+
DeployAgentTaskStep(id=f"{task_id}-agent", version=None, env_ids=[self.id], depends_on=[{"task_step_id": f"{task_id}-schema"}]),
|
|
266
|
+
PromptAgentTaskStep(id=f"{task_id}-prompt", version=None, prompt=TOOL_CORRECTNESS_PROMPT, prompt_id=prompt_id, output_format=TOOL_CORRECTNESS_OUTPUT_FORMAT, timeout_seconds=300, depends_on=[{"task_step_id": f"{task_id}-agent"}]),
|
|
267
|
+
VerifyMCPEnvAssessmentStep(id=f"{task_id}-assess", version=None, env_id=self.id, prompt_id=prompt_id, depends_on=[{"task_step_id": f"{task_id}-prompt"}]),
|
|
268
|
+
ValidationGateAggregatorStep(id=f"{task_id}-gate", version=None, env_id=self.id, required_gates=required_gates, depends_on=[{"task_step_id": f"{task_id}-schema"}, {"task_step_id": f"{task_id}-spec"}, {"task_step_id": f"{task_id}-assess"}]),
|
|
269
|
+
],
|
|
270
|
+
)
|
|
271
|
+
logger.info(f"Created validation task: {task.id} version={task.version}")
|
|
272
|
+
|
|
273
|
+
log = on_progress or (lambda msg: None)
|
|
274
|
+
on_start = lambda i, total, step, ctx: log(f"Running step [{i+1}/{total}]: {step.type}...")
|
|
275
|
+
on_complete = lambda i, total, step, ctx, dur: log(f"Completed step [{i+1}/{total}]: {step.type} [{dur:.1f}s]")
|
|
276
|
+
context = await task.run(on_step_start=on_start, on_step_complete=on_complete)
|
|
277
|
+
for deployed_env in context.deployed_envs:
|
|
278
|
+
try:
|
|
279
|
+
await close_deployed(deployed_env, MCPServerEnv)
|
|
280
|
+
except Exception as e:
|
|
281
|
+
logger.warning(f"Failed to clean up env {deployed_env.env_id}: {e}")
|
|
282
|
+
for deployed_agent in context.deployed_agents:
|
|
283
|
+
if deployed_agent.sandbox_id:
|
|
284
|
+
try:
|
|
285
|
+
from agent_env.providers import build_sandbox_provider, get_agent_sandbox_provider
|
|
286
|
+
provider = build_sandbox_provider(deployed_agent.sandbox_type) if deployed_agent.sandbox_type else get_agent_sandbox_provider()
|
|
287
|
+
sandbox = await provider.get_sandbox(deployed_agent.sandbox_id)
|
|
288
|
+
await sandbox.terminate()
|
|
289
|
+
except Exception as e:
|
|
290
|
+
logger.warning(f"Failed to clean up agent sandbox {deployed_agent.sandbox_id}: {e}")
|
|
291
|
+
return context.instance_id
|
|
292
|
+
|
|
293
|
+
async def create_cli(self, command_name: Optional[str] = None, on_progress: Optional[Callable[[str], None]] = None, force: bool = False) -> "CliArtifact":
|
|
294
|
+
from agent_env.store.base import ConcurrentModificationError, NotFoundError
|
|
295
|
+
from agent_env.task import Task
|
|
296
|
+
from agent_env.task_step import BuildMcpCliTaskStep, DeployEnvTaskStep
|
|
297
|
+
|
|
298
|
+
if not force:
|
|
299
|
+
cached = self.metadata.get("cli_artifact")
|
|
300
|
+
if cached and cached.get("id") and cached.get("version") is not None:
|
|
301
|
+
try:
|
|
302
|
+
artifact = Artifact.get(cached["id"], version=cached["version"])
|
|
303
|
+
logger.info(f"Reusing CliArtifact from env metadata: id={artifact.id} version={artifact.version} (pass force=True to rebuild)")
|
|
304
|
+
return artifact
|
|
305
|
+
except NotFoundError:
|
|
306
|
+
logger.warning(f"Cached CliArtifact {cached} not found in store; rebuilding")
|
|
307
|
+
|
|
308
|
+
cmd = command_name or self.environment_name
|
|
309
|
+
task_id = f"create-cli-{self.id}-v{self.version}"
|
|
310
|
+
cli_artifact_id = f"cli-{self.id}"
|
|
311
|
+
|
|
312
|
+
task = Task.put(id=task_id, steps=[
|
|
313
|
+
DeployEnvTaskStep(id=f"{task_id}-deploy", version=None, env_id=self.id, env_version=self.version),
|
|
314
|
+
BuildMcpCliTaskStep(id=f"{task_id}-build", version=None, env_id=self.id, command_name=cmd, cli_artifact_id=cli_artifact_id),
|
|
315
|
+
])
|
|
316
|
+
logger.info(f"Created create-cli task: {task.id} version={task.version}")
|
|
317
|
+
|
|
318
|
+
log = on_progress or (lambda msg: None)
|
|
319
|
+
on_start = lambda i, total, step, ctx: log(f"Running step [{i+1}/{total}]: {step.type}...")
|
|
320
|
+
on_complete = lambda i, total, step, ctx, dur: log(f"Completed step [{i+1}/{total}]: {step.type} [{dur:.1f}s]")
|
|
321
|
+
context = await task.run(on_step_start=on_start, on_step_complete=on_complete)
|
|
322
|
+
for deployed_env in context.deployed_envs:
|
|
323
|
+
try:
|
|
324
|
+
await close_deployed(deployed_env, MCPServerEnv)
|
|
325
|
+
except Exception as e:
|
|
326
|
+
logger.warning(f"Failed to clean up env {deployed_env.env_id}: {e}")
|
|
327
|
+
|
|
328
|
+
ref = context.metadata["cli_artifact"]
|
|
329
|
+
artifact = Artifact.get(ref["id"], version=ref["version"])
|
|
330
|
+
try:
|
|
331
|
+
self.update_metadata({**self.metadata, "cli_artifact": {"id": artifact.id, "version": artifact.version}})
|
|
332
|
+
except ConcurrentModificationError as e:
|
|
333
|
+
logger.warning(f"Concurrent metadata update lost CAS; cli_artifact built but env metadata not updated: {e}")
|
|
334
|
+
return artifact
|
|
335
|
+
|
|
336
|
+
@classmethod
|
|
337
|
+
async def put_from_github(
|
|
338
|
+
cls,
|
|
339
|
+
id: str,
|
|
340
|
+
dockerfile_github_url: str,
|
|
341
|
+
docker_context_github_url: str | None = None,
|
|
342
|
+
environment_name: str | None = None,
|
|
343
|
+
*,
|
|
344
|
+
metadata: dict[str, str] | None = None,
|
|
345
|
+
on_progress: ProgressCallback | None = None,
|
|
346
|
+
github_token: str | None = None,
|
|
347
|
+
env_provider_type: str = "gateway",
|
|
348
|
+
) -> MCPServerEnv:
|
|
349
|
+
"""Build a Docker image from a GitHub repo on a temporary VM and create an MCPServerEnv.
|
|
350
|
+
|
|
351
|
+
The resulting DockerImageArtifact and MCPServerEnv are identical to the local-build path.
|
|
352
|
+
"""
|
|
353
|
+
refuse_local_github_build(id)
|
|
354
|
+
docker_image_artifact = await DockerImageArtifact.put_from_github(
|
|
355
|
+
id=f"mcp-server-{id}",
|
|
356
|
+
dockerfile_github_url=dockerfile_github_url,
|
|
357
|
+
docker_context_github_url=docker_context_github_url,
|
|
358
|
+
on_progress=on_progress,
|
|
359
|
+
github_token=github_token,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
combined_metadata: dict[str, str] = {}
|
|
363
|
+
user = os.getenv("USER")
|
|
364
|
+
if user:
|
|
365
|
+
combined_metadata["created_by"] = user
|
|
366
|
+
try:
|
|
367
|
+
combined_metadata["agent_env_version"] = pkg_version("agentenv-framework")
|
|
368
|
+
except Exception:
|
|
369
|
+
pass
|
|
370
|
+
combined_metadata["dockerfile_github_url"] = docker_image_artifact.dockerfile_github_url
|
|
371
|
+
combined_metadata["github_owner"] = docker_image_artifact.github_owner
|
|
372
|
+
combined_metadata["github_repo"] = docker_image_artifact.github_repo
|
|
373
|
+
combined_metadata["github_commit"] = docker_image_artifact.github_commit
|
|
374
|
+
if docker_image_artifact.docker_context_github_url:
|
|
375
|
+
combined_metadata["docker_context_github_url"] = docker_image_artifact.docker_context_github_url
|
|
376
|
+
if docker_image_artifact.github_ref:
|
|
377
|
+
combined_metadata["github_ref"] = docker_image_artifact.github_ref
|
|
378
|
+
if metadata:
|
|
379
|
+
combined_metadata.update(metadata)
|
|
380
|
+
|
|
381
|
+
return cls.put(
|
|
382
|
+
id=id,
|
|
383
|
+
docker_image_artifact=docker_image_artifact.artifact,
|
|
384
|
+
environment_name=environment_name,
|
|
385
|
+
metadata=combined_metadata,
|
|
386
|
+
env_provider_type=env_provider_type,
|
|
387
|
+
)
|