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.
Files changed (312) hide show
  1. agent_env/__init__.py +0 -0
  2. agent_env/a2a_agent/__init__.py +23 -0
  3. agent_env/a2a_agent/a2a_agent.py +600 -0
  4. agent_env/a2a_agent/conversation_store.py +356 -0
  5. agent_env/a2a_agent/object_transfer.py +609 -0
  6. agent_env/a2a_agent/protocol.py +238 -0
  7. agent_env/a2a_agent/store.py +201 -0
  8. agent_env/a2a_agent/validator.py +901 -0
  9. agent_env/artifact/__init__.py +48 -0
  10. agent_env/artifact/artifact.py +74 -0
  11. agent_env/artifact/artifacts/__init__.py +0 -0
  12. agent_env/artifact/artifacts/cli.py +83 -0
  13. agent_env/artifact/artifacts/docker_image.py +457 -0
  14. agent_env/artifact/artifacts/environment.py +89 -0
  15. agent_env/artifact/artifacts/environment_universe.py +156 -0
  16. agent_env/artifact/artifacts/file.py +214 -0
  17. agent_env/artifact/artifacts/file_artifact_universe.py +206 -0
  18. agent_env/artifact/artifacts/skill.py +206 -0
  19. agent_env/artifact/artifacts/vm_image.py +95 -0
  20. agent_env/artifact/ref.py +15 -0
  21. agent_env/artifact/registry.py +251 -0
  22. agent_env/artifact/store.py +295 -0
  23. agent_env/artifact/universe.py +38 -0
  24. agent_env/attribution.py +41 -0
  25. agent_env/bundle/__init__.py +4 -0
  26. agent_env/bundle/_fs.py +128 -0
  27. agent_env/bundle/authoring.py +239 -0
  28. agent_env/bundle/installed.py +175 -0
  29. agent_env/bundle/ledger.py +269 -0
  30. agent_env/bundle/materialize.py +204 -0
  31. agent_env/bundle/parse.py +594 -0
  32. agent_env/bundle/plan.py +414 -0
  33. agent_env/bundle/resolve.py +404 -0
  34. agent_env/bundle/run.py +361 -0
  35. agent_env/cli/__init__.py +69 -0
  36. agent_env/cli/__main__.py +10 -0
  37. agent_env/cli/_installers.py +576 -0
  38. agent_env/cli/_plugin_changes.py +947 -0
  39. agent_env/cli/a2a_agent/__init__.py +22 -0
  40. agent_env/cli/a2a_agent/add_skill.py +97 -0
  41. agent_env/cli/a2a_agent/deploy.py +60 -0
  42. agent_env/cli/a2a_agent/get.py +15 -0
  43. agent_env/cli/a2a_agent/get_instance.py +26 -0
  44. agent_env/cli/a2a_agent/put.py +78 -0
  45. agent_env/cli/a2a_agent/validate.py +56 -0
  46. agent_env/cli/artifact/__init__.py +20 -0
  47. agent_env/cli/artifact/cli.py +83 -0
  48. agent_env/cli/artifact/environment.py +44 -0
  49. agent_env/cli/artifact/environment_universe.py +163 -0
  50. agent_env/cli/artifact/file_artifact_universe.py +281 -0
  51. agent_env/cli/artifact/skill.py +128 -0
  52. agent_env/cli/banner.py +25 -0
  53. agent_env/cli/config.py +263 -0
  54. agent_env/cli/env/__init__.py +31 -0
  55. agent_env/cli/env/deploy.py +112 -0
  56. agent_env/cli/env/gateway.py +57 -0
  57. agent_env/cli/env/get_instance.py +40 -0
  58. agent_env/cli/env/mcp_server.py +410 -0
  59. agent_env/cli/env/multi.py +282 -0
  60. agent_env/cli/env/service_db.py +99 -0
  61. agent_env/cli/env/snapshot.py +35 -0
  62. agent_env/cli/env/state/__init__.py +6 -0
  63. agent_env/cli/env/state/init.py +108 -0
  64. agent_env/cli/env/state/teardown.py +44 -0
  65. agent_env/cli/env/website.py +216 -0
  66. agent_env/cli/env/website_browser.py +67 -0
  67. agent_env/cli/eval/__init__.py +16 -0
  68. agent_env/cli/eval/add_tasks.py +63 -0
  69. agent_env/cli/eval/create.py +49 -0
  70. agent_env/cli/eval/run.py +194 -0
  71. agent_env/cli/identity/__init__.py +5 -0
  72. agent_env/cli/identity/client_identity.py +37 -0
  73. agent_env/cli/plugin.py +438 -0
  74. agent_env/cli/run.py +285 -0
  75. agent_env/cli/task/__init__.py +21 -0
  76. agent_env/cli/task/create.py +109 -0
  77. agent_env/cli/task/get.py +17 -0
  78. agent_env/cli/task/get_instance.py +34 -0
  79. agent_env/cli/task/run.py +615 -0
  80. agent_env/cli/task/validate.py +31 -0
  81. agent_env/cli/up.py +123 -0
  82. agent_env/cli/utils.py +183 -0
  83. agent_env/config/__init__.py +50 -0
  84. agent_env/config/describe.py +1067 -0
  85. agent_env/config/errors.py +13 -0
  86. agent_env/config/loader.py +245 -0
  87. agent_env/config/model.py +154 -0
  88. agent_env/config/paths.py +25 -0
  89. agent_env/config/plugin_tables.py +101 -0
  90. agent_env/config/provenance.py +134 -0
  91. agent_env/config/runtime.py +1064 -0
  92. agent_env/config/snapshot.py +81 -0
  93. agent_env/entity_refs.py +186 -0
  94. agent_env/env/__init__.py +49 -0
  95. agent_env/env/env.py +433 -0
  96. agent_env/env/env_artifact_store.py +87 -0
  97. agent_env/env/envs/__init__.py +7 -0
  98. agent_env/env/envs/_deployment.py +281 -0
  99. agent_env/env/envs/gateway_server.py +32 -0
  100. agent_env/env/envs/mcp_server.py +387 -0
  101. agent_env/env/envs/multi_env.py +780 -0
  102. agent_env/env/envs/service_db/Dockerfile +20 -0
  103. agent_env/env/envs/service_db/Dockerfile.db-mcp +42 -0
  104. agent_env/env/envs/service_db/Dockerfile.db-web +8 -0
  105. agent_env/env/envs/service_db.py +92 -0
  106. agent_env/env/envs/website.py +294 -0
  107. agent_env/env/envs/website_browser/Dockerfile +40 -0
  108. agent_env/env/envs/website_browser/__init__.py +17 -0
  109. agent_env/env/envs/website_browser/entrypoint.sh +13 -0
  110. agent_env/env/gateway/Dockerfile +14 -0
  111. agent_env/env/gateway/__init__.py +37 -0
  112. agent_env/env/gateway/clock.py +184 -0
  113. agent_env/env/gateway/constants.py +190 -0
  114. agent_env/env/gateway/entrypoint.py +156 -0
  115. agent_env/env/gateway/gateway.py +1095 -0
  116. agent_env/env/gateway/get_time.py +60 -0
  117. agent_env/env/gateway/requirements.txt +4 -0
  118. agent_env/env/gateway/triggers.py +1193 -0
  119. agent_env/env/legacy_protocol.py +146 -0
  120. agent_env/env/registry.py +93 -0
  121. agent_env/env/snapshot_store.py +372 -0
  122. agent_env/env/store.py +411 -0
  123. agent_env/eval/__init__.py +14 -0
  124. agent_env/eval/eval.py +68 -0
  125. agent_env/eval/store.py +116 -0
  126. agent_env/examples/hello/README.md +9 -0
  127. agent_env/examples/hello/artifacts/greeting/check.sh +1 -0
  128. agent_env/examples/hello/artifacts/greeting/hello.txt +1 -0
  129. agent_env/examples/hello/tasks/hello.json +10 -0
  130. agent_env/explorer/__init__.py +12 -0
  131. agent_env/explorer/app.py +277 -0
  132. agent_env/explorer/openapi_docs.py +242 -0
  133. agent_env/explorer/plugin.py +95 -0
  134. agent_env/explorer/routers/__init__.py +1 -0
  135. agent_env/explorer/routers/common.py +174 -0
  136. agent_env/explorer/routers/conversations.py +25 -0
  137. agent_env/explorer/routers/objects.py +112 -0
  138. agent_env/explorer/routers/runs.py +475 -0
  139. agent_env/plugins/__init__.py +59 -0
  140. agent_env/plugins/_cli.py +244 -0
  141. agent_env/plugins/_discovery.py +97 -0
  142. agent_env/plugins/_inventory.py +262 -0
  143. agent_env/plugins/_registration.py +268 -0
  144. agent_env/plugins/_report.py +47 -0
  145. agent_env/plugins/_requirements.py +55 -0
  146. agent_env/providers/__init__.py +37 -0
  147. agent_env/providers/env_providers/__init__.py +12 -0
  148. agent_env/providers/env_providers/constants.py +13 -0
  149. agent_env/providers/env_providers/env_gateway_provider.py +1354 -0
  150. agent_env/providers/env_providers/env_provider.py +237 -0
  151. agent_env/providers/env_providers/env_server_provider.py +133 -0
  152. agent_env/providers/env_state/__init__.py +49 -0
  153. agent_env/providers/env_state/env_state_provider.py +554 -0
  154. agent_env/providers/env_state/local_postgres.py +390 -0
  155. agent_env/providers/env_state/store.py +112 -0
  156. agent_env/providers/sandbox_providers/__init__.py +29 -0
  157. agent_env/providers/sandbox_providers/chained_sandbox_provider.py +93 -0
  158. agent_env/providers/sandbox_providers/e2b/__init__.py +6 -0
  159. agent_env/providers/sandbox_providers/e2b/provider.py +376 -0
  160. agent_env/providers/sandbox_providers/e2b/sandbox.py +342 -0
  161. agent_env/providers/sandbox_providers/e2b/template.py +158 -0
  162. agent_env/providers/sandbox_providers/local_sandbox.py +408 -0
  163. agent_env/providers/sandbox_providers/modal_sandbox.py +500 -0
  164. agent_env/providers/sandbox_providers/modal_vm_sandbox.py +466 -0
  165. agent_env/providers/sandbox_providers/sandbox.py +387 -0
  166. agent_env/providers/sandbox_providers/sandbox_provider.py +614 -0
  167. agent_env/py.typed +0 -0
  168. agent_env/runner/__init__.py +16 -0
  169. agent_env/runner/local_runner.py +190 -0
  170. agent_env/runner/runner.py +127 -0
  171. agent_env/runner/store.py +94 -0
  172. agent_env/store/__init__.py +126 -0
  173. agent_env/store/_google.py +68 -0
  174. agent_env/store/base.py +33 -0
  175. agent_env/store/document_store/__init__.py +60 -0
  176. agent_env/store/document_store/document_store.py +519 -0
  177. agent_env/store/document_store/dynamodb_document_store.py +306 -0
  178. agent_env/store/document_store/evaluation.py +199 -0
  179. agent_env/store/document_store/firestore_mongo_document_store.py +242 -0
  180. agent_env/store/document_store/mongo_document_store.py +259 -0
  181. agent_env/store/document_store/sqlite_document_store.py +314 -0
  182. agent_env/store/ids.py +123 -0
  183. agent_env/store/image_store/__init__.py +34 -0
  184. agent_env/store/image_store/ecr_image_store.py +131 -0
  185. agent_env/store/image_store/google_credentials.py +113 -0
  186. agent_env/store/image_store/image_store.py +113 -0
  187. agent_env/store/image_store/local_registry_image_store.py +106 -0
  188. agent_env/store/image_store/oci_registry_credentials.py +196 -0
  189. agent_env/store/local_state.py +27 -0
  190. agent_env/store/object_store/__init__.py +24 -0
  191. agent_env/store/object_store/gcs_object_store.py +415 -0
  192. agent_env/store/object_store/local_object_store.py +143 -0
  193. agent_env/store/object_store/object_store.py +198 -0
  194. agent_env/store/object_store/s3_object_store.py +354 -0
  195. agent_env/store/query.py +112 -0
  196. agent_env/store/routing.py +609 -0
  197. agent_env/store/secret_store/__init__.py +19 -0
  198. agent_env/store/secret_store/aws_secrets_manager_secret_store.py +293 -0
  199. agent_env/store/secret_store/gcp_secret_manager_secret_store.py +319 -0
  200. agent_env/store/secret_store/local_secret_store.py +47 -0
  201. agent_env/store/secret_store/secret_store.py +19 -0
  202. agent_env/task/__init__.py +27 -0
  203. agent_env/task/interrupts.py +109 -0
  204. agent_env/task/registry.py +27 -0
  205. agent_env/task/step_journal.py +99 -0
  206. agent_env/task/store.py +940 -0
  207. agent_env/task/task.py +815 -0
  208. agent_env/task/teardown.py +142 -0
  209. agent_env/task_step/__init__.py +47 -0
  210. agent_env/task_step/context.py +195 -0
  211. agent_env/task_step/context_ops.py +224 -0
  212. agent_env/task_step/registry.py +182 -0
  213. agent_env/task_step/review_store.py +118 -0
  214. agent_env/task_step/snapshot_utils/__init__.py +2 -0
  215. agent_env/task_step/snapshot_utils/agent_state_capture.py +261 -0
  216. agent_env/task_step/snapshot_utils/snapshot_series.py +631 -0
  217. agent_env/task_step/store.py +129 -0
  218. agent_env/task_step/task_step.py +173 -0
  219. agent_env/task_step/task_steps/__init__.py +27 -0
  220. agent_env/task_step/task_steps/a2a_agent_validator/__init__.py +31 -0
  221. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/README.md +158 -0
  222. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.m4a +0 -0
  223. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.mp3 +0 -0
  224. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.mp4 +0 -0
  225. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.ogg +0 -0
  226. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/clip.wav +0 -0
  227. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/document.pdf +0 -0
  228. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.gif +0 -0
  229. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.jpg +0 -0
  230. agent_env/task_step/task_steps/a2a_agent_validator/fixtures/red.png +0 -0
  231. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_card.py +103 -0
  232. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_config_identity.py +69 -0
  233. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_agent_mcp.py +178 -0
  234. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_core_protocol.py +67 -0
  235. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_install.py +115 -0
  236. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_litellm_attribution.py +124 -0
  237. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_litellm_attribution_runtime.py +173 -0
  238. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_modalities.py +270 -0
  239. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_peer_agents.py +102 -0
  240. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_role.py +151 -0
  241. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_skill_config.py +194 -0
  242. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_snapshot.py +111 -0
  243. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_system_prompt.py +215 -0
  244. agent_env/task_step/task_steps/a2a_agent_validator/verify_a2a_trajectory.py +164 -0
  245. agent_env/task_step/task_steps/add_skills.py +240 -0
  246. agent_env/task_step/task_steps/apply_server_config.py +288 -0
  247. agent_env/task_step/task_steps/collect_artifacts.py +940 -0
  248. agent_env/task_step/task_steps/deploy_agent.py +626 -0
  249. agent_env/task_step/task_steps/deploy_env.py +197 -0
  250. agent_env/task_step/task_steps/deploy_human_agent.py +100 -0
  251. agent_env/task_step/task_steps/deploy_sandbox.py +170 -0
  252. agent_env/task_step/task_steps/env_card_validator/__init__.py +4 -0
  253. agent_env/task_step/task_steps/env_card_validator/verify_env_card.py +109 -0
  254. agent_env/task_step/task_steps/env_card_validator/verify_env_core_protocol.py +108 -0
  255. agent_env/task_step/task_steps/install_agent.py +376 -0
  256. agent_env/task_step/task_steps/load_artifact.py +775 -0
  257. agent_env/task_step/task_steps/mcp_cli_builder/__init__.py +4 -0
  258. agent_env/task_step/task_steps/mcp_cli_builder/build_mcp_cli.py +201 -0
  259. agent_env/task_step/task_steps/mcp_cli_builder/codegen.py +627 -0
  260. agent_env/task_step/task_steps/mcp_env_validator/__init__.py +44 -0
  261. agent_env/task_step/task_steps/mcp_env_validator/validation_gate_aggregator.py +102 -0
  262. agent_env/task_step/task_steps/mcp_env_validator/verify_mcp_env_assessment.py +78 -0
  263. agent_env/task_step/task_steps/mcp_env_validator/verify_mcp_tool_schema.py +152 -0
  264. agent_env/task_step/task_steps/mcp_env_validator/verify_spec_conformance.py +486 -0
  265. agent_env/task_step/task_steps/modify_env_tool_access.py +80 -0
  266. agent_env/task_step/task_steps/multienv_validator/__init__.py +3 -0
  267. agent_env/task_step/task_steps/multienv_validator/combine_universe_verdicts.py +107 -0
  268. agent_env/task_step/task_steps/multienv_validator/universe_comparison.py +253 -0
  269. agent_env/task_step/task_steps/multienv_validator/verify_universe_agent_judge.py +180 -0
  270. agent_env/task_step/task_steps/multienv_validator/verify_universe_roundtrip.py +241 -0
  271. agent_env/task_step/task_steps/peer_agents.py +92 -0
  272. agent_env/task_step/task_steps/prompt_agent.py +900 -0
  273. agent_env/task_step/task_steps/register_agent_triggers.py +113 -0
  274. agent_env/task_step/task_steps/register_env_triggers.py +97 -0
  275. agent_env/task_step/task_steps/reset_env.py +71 -0
  276. agent_env/task_step/task_steps/review.py +152 -0
  277. agent_env/task_step/task_steps/run_code.py +461 -0
  278. agent_env/task_step/task_steps/run_code_runner.py +52 -0
  279. agent_env/task_step/task_steps/run_docker_container.py +380 -0
  280. agent_env/task_step/task_steps/sandbox_utils/__init__.py +0 -0
  281. agent_env/task_step/task_steps/sandbox_utils/sandbox_utils.py +79 -0
  282. agent_env/task_step/task_steps/snapshot_agent_state.py +205 -0
  283. agent_env/task_step/task_steps/snapshot_env.py +637 -0
  284. agent_env/task_step/task_steps/sync_env_clock.py +132 -0
  285. agent_env/task_step/task_steps/teardown_sandboxes.py +170 -0
  286. agent_env/task_step/task_steps/verifiers/__init__.py +23 -0
  287. agent_env/task_step/task_steps/verifiers/agent_prompt_response_verifier.py +166 -0
  288. agent_env/task_step/task_steps/verifiers/aggregate_verifiers.py +90 -0
  289. agent_env/task_step/task_steps/verifiers/env_outcome_verifier.py +127 -0
  290. agent_env/task_step/task_steps/verifiers/judge_utils/__init__.py +2 -0
  291. agent_env/task_step/task_steps/verifiers/judge_utils/frame_selection.py +377 -0
  292. agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py +1293 -0
  293. agent_env/task_step/task_steps/verifiers/judge_utils/trajectory_filter.py +514 -0
  294. agent_env/task_step/task_steps/verifiers/rubrics_verifier.py +1318 -0
  295. agent_env/task_step/task_steps/verifiers/run_container_unit_tests_verifier.py +434 -0
  296. agent_env/task_step/task_steps/verifiers/scoring.py +40 -0
  297. agent_env/task_step/task_steps/verifiers/verify_sandbox.py +308 -0
  298. agent_env/task_step/thread_work.py +61 -0
  299. agent_env/utils/__init__.py +0 -0
  300. agent_env/utils/card_naming.py +108 -0
  301. agent_env/utils/deprecation.py +109 -0
  302. agent_env/utils/docker_build.py +29 -0
  303. agent_env/utils/exec_retry.py +77 -0
  304. agent_env/utils/litellm_attribution.py +59 -0
  305. agent_env/utils/paths.py +20 -0
  306. agentenv_framework-0.9.1254.dist-info/METADATA +394 -0
  307. agentenv_framework-0.9.1254.dist-info/RECORD +312 -0
  308. agentenv_framework-0.9.1254.dist-info/WHEEL +4 -0
  309. agentenv_framework-0.9.1254.dist-info/entry_points.txt +5 -0
  310. agentenv_framework-0.9.1254.dist-info/licenses/LICENSE +202 -0
  311. agentenv_framework-0.9.1254.dist-info/licenses/NOTICE +4 -0
  312. agentenv_framework-0.9.1254.dist-info/licenses/THIRD_PARTY_NOTICES.md +7665 -0
@@ -0,0 +1,20 @@
1
+ FROM public.ecr.aws/docker/library/postgres:16-alpine
2
+
3
+ # ServiceDBEnv - PostgreSQL database for MCP services
4
+ #
5
+ # Configuration via environment variables:
6
+ # - POSTGRES_USER (default: agentenv)
7
+ # - POSTGRES_PASSWORD (default: agentenv)
8
+ # - POSTGRES_DB (default: agentenv)
9
+ #
10
+ # MCP servers connect via DATABASE_URL:
11
+ # postgresql://agentenv:agentenv@servicedb:5432/agentenv
12
+
13
+ ENV POSTGRES_USER=agentenv
14
+ ENV POSTGRES_PASSWORD=agentenv
15
+ ENV POSTGRES_DB=agentenv
16
+
17
+ HEALTHCHECK --interval=5s --timeout=5s --retries=5 \
18
+ CMD pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} || exit 1
19
+
20
+ EXPOSE 5432
@@ -0,0 +1,42 @@
1
+ # Build postgres-mcp from source to get streamable-http transport support.
2
+ # The Docker Hub image (crystaldba/postgres-mcp:latest) ships MCP 1.6.0,
3
+ # which only supports stdio and SSE transports.
4
+
5
+ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
6
+ ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
7
+ ENV UV_PYTHON_DOWNLOADS=0
8
+
9
+ WORKDIR /app
10
+ RUN apt-get update \
11
+ && apt-get install -y libpq-dev gcc git \
12
+ && rm -rf /var/lib/apt/lists/*
13
+ RUN git clone https://github.com/crystaldba/postgres-mcp.git /app
14
+
15
+ # Patch: disable DNS rebinding protection in FastMCP constructor.
16
+ # FastMCP auto-enables it when host="127.0.0.1" (the default), which rejects
17
+ # requests arriving through reverse proxies with non-localhost Host headers.
18
+ # postgres-mcp creates FastMCP("postgres-mcp") with defaults, then sets
19
+ # mcp.settings.host later — but transport_security is already locked in.
20
+ RUN sed -i 's/mcp = FastMCP("postgres-mcp")/from mcp.server.transport_security import TransportSecuritySettings\nmcp = FastMCP("postgres-mcp", transport_security=TransportSecuritySettings(enable_dns_rebinding_protection=False))/' /app/src/postgres_mcp/server.py
21
+
22
+ RUN --mount=type=cache,target=/root/.cache/uv \
23
+ uv sync --frozen --no-dev
24
+
25
+ FROM public.ecr.aws/docker/library/python:3.12-slim-bookworm
26
+ RUN groupadd -r app && useradd -r -g app app
27
+ COPY --from=builder --chown=app:app /app /app
28
+
29
+ ENV PATH="/app/.venv/bin:$PATH"
30
+
31
+ RUN apt-get update && apt-get install -y \
32
+ libpq-dev \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ COPY --from=builder /app/docker-entrypoint.sh /app/docker-entrypoint.sh
36
+ RUN chmod +x /app/docker-entrypoint.sh
37
+
38
+ USER app
39
+ EXPOSE 8000
40
+
41
+ ENTRYPOINT ["/app/docker-entrypoint.sh", "postgres-mcp"]
42
+ CMD []
@@ -0,0 +1,8 @@
1
+ # Official pgweb image, pulled from its public GitHub Container Registry mirror.
2
+ # We avoid Docker Hub because anonymous pulls are rate-limited per IP (429s from
3
+ # CodeBuild's shared NAT). ghcr.io hosts the same image (identical digest) with
4
+ # no anonymous rate limit and no auth required, so no private ECR mirror is
5
+ # needed. The digest matches docker.io/sosedoff/pgweb:0.16.2. To bump: pick a
6
+ # new tag from https://github.com/sosedoff/pgweb/pkgs/container/pgweb and update
7
+ # the tag + digest here.
8
+ FROM ghcr.io/sosedoff/pgweb:0.16.2@sha256:8f1ed22e10c9da0912169b98b62ddc54930dc39a5ae07b0f1354d2a93d44c6ed
@@ -0,0 +1,92 @@
1
+ """ServiceDB environment for shared PostgreSQL database."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from typing import ClassVar, Optional
7
+
8
+ from agent_env.artifact import Artifact, DockerImageArtifact
9
+ from agent_env.env.env import Env
10
+
11
+ SERVICE_DB_PORT = 5432
12
+ DB_USER = "agentenv"
13
+ DB_PASSWORD = "agentenv"
14
+ DB_NAME = "agentenv"
15
+
16
+ # The service db's containers: compose service names and ports.
17
+ DATABASE_SERVICE_NAME = "servicedb"
18
+ PGWEB_SERVICE_NAME = "pgweb"
19
+ DB_WEB_PORT = 8081 # pgweb: same port host-side and in-container (8081:8081)
20
+ DB_MCP_SERVICE_NAME = "db-mcp"
21
+ DB_MCP_PORT = 18767 # db-mcp host/tunnel port
22
+ DB_MCP_CONTAINER_PORT = 8000 # db-mcp's in-container listen port (tunneled as DB_MCP_PORT:DB_MCP_CONTAINER_PORT)
23
+
24
+
25
+ @dataclass
26
+ class ServiceDBConfig:
27
+ """Image configuration for the shared PostgreSQL database services."""
28
+ db_image: str = "public.ecr.aws/docker/library/postgres:16-alpine"
29
+ db_web_image: str | None = None
30
+ db_mcp_image: str | None = None
31
+
32
+
33
+ class ServiceDBEnv(Env):
34
+ """PostgreSQL database env for holding env state"""
35
+ type: ClassVar[str] = "service_db"
36
+
37
+ def __init__(
38
+ self,
39
+ id: str,
40
+ db_docker_image_artifact: DockerImageArtifact,
41
+ db_web_docker_image_artifact: DockerImageArtifact,
42
+ db_mcp_docker_image_artifact: DockerImageArtifact,
43
+ version: Optional[int] = None,
44
+ metadata: Optional[dict[str, str]] = None,
45
+ ):
46
+ super().__init__(id, version, metadata=metadata)
47
+ self.db_docker_image_artifact = db_docker_image_artifact
48
+ self.db_web_docker_image_artifact = db_web_docker_image_artifact
49
+ self.db_mcp_docker_image_artifact = db_mcp_docker_image_artifact
50
+
51
+ def to_config(self) -> ServiceDBConfig:
52
+ return ServiceDBConfig(
53
+ db_image=self.db_docker_image_artifact.image_name,
54
+ db_web_image=self.db_web_docker_image_artifact.image_name,
55
+ db_mcp_image=self.db_mcp_docker_image_artifact.image_name,
56
+ )
57
+
58
+ def to_dict(self) -> dict:
59
+ base = super().to_dict()
60
+ base["db_docker_image_artifact"] = {
61
+ "id": self.db_docker_image_artifact.id,
62
+ "version": self.db_docker_image_artifact.version,
63
+ "type": self.db_docker_image_artifact.type,
64
+ }
65
+ base["db_web_docker_image_artifact"] = {
66
+ "id": self.db_web_docker_image_artifact.id,
67
+ "version": self.db_web_docker_image_artifact.version,
68
+ "type": self.db_web_docker_image_artifact.type,
69
+ }
70
+ base["db_mcp_docker_image_artifact"] = {
71
+ "id": self.db_mcp_docker_image_artifact.id,
72
+ "version": self.db_mcp_docker_image_artifact.version,
73
+ "type": self.db_mcp_docker_image_artifact.type,
74
+ }
75
+ return base
76
+
77
+ @classmethod
78
+ def from_dict(cls, data: dict) -> "ServiceDBEnv":
79
+ db_ref = data["db_docker_image_artifact"]
80
+ db_docker_image_artifact = Artifact.get(db_ref["id"], version=db_ref.get("version"))
81
+ db_web_ref = data["db_web_docker_image_artifact"]
82
+ db_web_docker_image_artifact = Artifact.get(db_web_ref["id"], version=db_web_ref.get("version"))
83
+ db_mcp_ref = data["db_mcp_docker_image_artifact"]
84
+ db_mcp_docker_image_artifact = Artifact.get(db_mcp_ref["id"], version=db_mcp_ref.get("version"))
85
+ return cls(
86
+ id=data["id"],
87
+ db_docker_image_artifact=db_docker_image_artifact,
88
+ db_web_docker_image_artifact=db_web_docker_image_artifact,
89
+ db_mcp_docker_image_artifact=db_mcp_docker_image_artifact,
90
+ version=data.get("version"),
91
+ metadata=data.get("metadata", {}),
92
+ )
@@ -0,0 +1,294 @@
1
+ """Website environment with frontend and backend containers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+ import logging
7
+ import os
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, EnvironmentArtifact
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 AGENT_ENV_GATEWAY_MCP_PORT, GatewayMode
23
+ from agent_env.attribution import Attribution
24
+ if TYPE_CHECKING:
25
+ from agent_env.env.env import DeployedEnv
26
+ from agent_env.providers.env_providers.env_provider import EnvironmentProvider
27
+
28
+ logger = logging.getLogger(__name__)
29
+
30
+
31
+
32
+
33
+ class WebsiteEnv(Env):
34
+ type: ClassVar[str] = "website"
35
+ description = "Website environment with frontend and backend containers, deployed through the environment provider its env_provider_type names"
36
+
37
+ def __init__(
38
+ self,
39
+ id: str,
40
+ version: Optional[int],
41
+ backend_docker_image_artifact: DockerImageArtifact,
42
+ frontend_docker_image_artifact: DockerImageArtifact,
43
+ environment_name: Optional[str] = None,
44
+ *,
45
+ metadata: Optional[dict[str, str]] = None,
46
+ env_provider_type: str = "gateway",
47
+ ):
48
+ super().__init__(id, version, metadata=metadata)
49
+ if not environment_name:
50
+ raise ValueError("environment_name cannot be empty")
51
+ if not env_provider_type:
52
+ raise ValueError("env_provider_type cannot be empty")
53
+ self.backend_docker_image_artifact = backend_docker_image_artifact
54
+ self.frontend_docker_image_artifact = frontend_docker_image_artifact
55
+ self.environment_name = environment_name
56
+ self.env_provider_type = env_provider_type
57
+ self._sandbox = None
58
+ # As for an MCPServerEnv: a built-in's provider is built with the env, a plugin's when it deploys.
59
+ self._env_provider: Optional[EnvironmentProvider] = builtin_provider_for(env_provider_type)
60
+ self._gateway_url = None
61
+ self._deployed: Optional[DeployedEnv] = None
62
+ self._replaced: list[tuple] = [] # the provider and sandbox of each deployment a later deploy replaced, for close()
63
+
64
+ def to_dict(self) -> dict:
65
+ base = super().to_dict()
66
+ base["backend_docker_image_artifact"] = {
67
+ "id": self.backend_docker_image_artifact.id,
68
+ "version": self.backend_docker_image_artifact.version,
69
+ "type": self.backend_docker_image_artifact.type,
70
+ }
71
+ base["frontend_docker_image_artifact"] = {
72
+ "id": self.frontend_docker_image_artifact.id,
73
+ "version": self.frontend_docker_image_artifact.version,
74
+ "type": self.frontend_docker_image_artifact.type,
75
+ }
76
+ base["service_name"] = self.environment_name
77
+ base["environment_name"] = self.environment_name # dual-write with service_name during the rename
78
+ base["env_provider_type"] = self.env_provider_type
79
+ return base
80
+
81
+ @classmethod
82
+ def from_dict(cls, data: dict) -> WebsiteEnv:
83
+ backend_ref = data["backend_docker_image_artifact"]
84
+ backend_artifact = Artifact.get(backend_ref["id"], version=backend_ref["version"])
85
+ frontend_ref = data["frontend_docker_image_artifact"]
86
+ frontend_artifact = Artifact.get(frontend_ref["id"], version=frontend_ref["version"])
87
+ return cls(
88
+ id=data["id"],
89
+ version=data.get("version"),
90
+ backend_docker_image_artifact=backend_artifact,
91
+ frontend_docker_image_artifact=frontend_artifact,
92
+ environment_name=data["environment_name"] if "environment_name" in data else data["service_name"],
93
+ metadata=data.get("metadata", {}),
94
+ env_provider_type=data.get("env_provider_type", "gateway"),
95
+ )
96
+
97
+ 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:
98
+ return await deploy_through_provider(
99
+ self, environment_name=self.environment_name, ttl_seconds=ttl_seconds, sandbox_type=sandbox_type,
100
+ disk_size_gb=disk_size_gb, gateway_mode=gateway_mode, cpu=cpu, memory_mb=memory_mb, priority=priority,
101
+ env_state_type=env_state_type, env_state_instance_id=env_state_instance_id, attribution=attribution,
102
+ )
103
+
104
+ def deploy_refusal(self, **options) -> str | None:
105
+ """Why deploy() would refuse these options before building anything, or None; raises, as deploy() does, for a type this process can't find."""
106
+ return deploy_refusal(self, provider_or_class(self), options)
107
+
108
+ @classmethod
109
+ async def from_deployed_env(cls, deployed: DeployedEnv) -> WebsiteEnv:
110
+ env = Env.get(deployed.env_id, deployed.env_version)
111
+ if not isinstance(env, WebsiteEnv):
112
+ raise TypeError(f"Expected WebsiteEnv, got {type(env).__name__}")
113
+ if env._env_provider is None:
114
+ env._env_provider = plugin_provider_like_a_builtin(env.env_provider_type)
115
+ if builtin := as_builtin(env._env_provider):
116
+ env._sandbox = await builtin._reattach(env, deployed)
117
+ env._gateway_url = gateway_url_of(deployed)
118
+ env._instance_id = deployed.instance_id
119
+ env._deployed = deployed
120
+ return env
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 and gateway to stage through; a plugin's leaves only its record.
125
+ if (self._sandbox is None or self._gateway_url is None) 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=False)
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
+ await protocol_v1.reset_data(base_url)
141
+ await protocol_v1.add_data(base_url, [FilePart(file={
142
+ "uri": f"file://{container_path}",
143
+ "mimeType": file_artifact.content_type,
144
+ "name": file_artifact.filename,
145
+ })], timeout=DATA_PLANE_LOAD_TIMEOUT_S)
146
+ else:
147
+ await self._load_environment_artifact_legacy(file_artifact)
148
+ await builtin.install_changelog_triggers(self.environment_name)
149
+
150
+ async def load_file_artifact_universe(self, file_artifact_universe: "Any", destination_path: Optional[str] = None,
151
+ ) -> "LoadFileArtifactUniverseResult":
152
+ if refusal := host_staging_refusal(self, "Staging files onto the env's host"):
153
+ raise RuntimeError(refusal)
154
+ return await super().load_file_artifact_universe(file_artifact_universe, destination_path)
155
+
156
+ async def _copy_artifact_into_container(self, file_artifact) -> str:
157
+ from agent_env.providers.env_providers.constants import AGENT_ENV_WEBSITE_BACKEND_SUFFIX, DOCKER_COMPOSE_PATH
158
+ filename = file_artifact.filename
159
+ backend_service = f"{self.environment_name}-{AGENT_ENV_WEBSITE_BACKEND_SUFFIX}"
160
+ # Random suffix so concurrent loads on a shared sandbox (parallel /load-universe,
161
+ # MCP+website sharing a service_name, repeated loads) don't race on a shared path.
162
+ vm_path = f"/tmp/_artifact_{self.environment_name}-{uuid.uuid4().hex[:8]}-{filename}"
163
+ container_path = f"/tmp/data/{filename}"
164
+ compose = f"docker compose -f {DOCKER_COMPOSE_PATH}"
165
+
166
+ await self._sandbox.load_s3_file(file_artifact.object_url, vm_path)
167
+ await self._sandbox.exec_script(f"{compose} exec -T {backend_service} mkdir -p /tmp/data")
168
+ await self._sandbox.exec_script(f"{compose} cp {vm_path} {backend_service}:{container_path}")
169
+ await self._sandbox.exec_script(f"rm -f {vm_path}")
170
+ return container_path
171
+
172
+ async def _load_environment_artifact_legacy(self, file_artifact) -> None:
173
+ container_path = await self._copy_artifact_into_container(file_artifact)
174
+ base_url = legacy_protocol.environment_base_url(self._gateway_url, self.environment_name, mcp=False)
175
+ from agent_env.env.gateway.constants import DATA_PLANE_LOAD_TIMEOUT_S
176
+ await legacy_protocol.reset_via_rest(base_url, timeout=60)
177
+ try:
178
+ await legacy_protocol.add_via_rest(base_url, container_path, timeout=DATA_PLANE_LOAD_TIMEOUT_S)
179
+ except Exception as e:
180
+ logger.error(
181
+ "load_environment_artifact: /api/add failed after /api/reset succeeded; "
182
+ f"environment '{self.environment_name}' backend is in empty state: {e}"
183
+ )
184
+ raise
185
+
186
+ async def close(self) -> None:
187
+ await close_replaced(self)
188
+ if self._env_provider is not None:
189
+ try:
190
+ await self._env_provider.close()
191
+ except BaseException as e:
192
+ logger.warning(f"Failed to close env provider: {e}")
193
+ if self._sandbox is not None:
194
+ try:
195
+ await self._sandbox.terminate()
196
+ except BaseException as e:
197
+ logger.warning(f"Failed to terminate sandbox {self._sandbox.sandbox_id}: {e}")
198
+ self._sandbox = None
199
+
200
+ async def validate(self, on_progress: Optional[Callable[[str], None]] = None) -> str:
201
+ """Run the basic env-card validator task and return the task instance ID.
202
+
203
+ Deploys the env, fetches + persists its composed EnvironmentCard, then tears down.
204
+ """
205
+ refuse_local_derivation(self.id, "env", "validating")
206
+ from agent_env.task import Task
207
+ from agent_env.task_step import DeployEnvTaskStep, VerifyEnvironmentCardStep
208
+
209
+ task_id = f"validate-{self.id}-v{self.version}"
210
+ task = Task.put(
211
+ id=task_id,
212
+ steps=[
213
+ DeployEnvTaskStep(id=f"{task_id}-deploy", version=None, env_id=self.id, env_version=self.version),
214
+ VerifyEnvironmentCardStep(id=f"{task_id}-envcard", version=None, env_id=self.id),
215
+ ],
216
+ )
217
+ logger.info(f"Created validation task: {task.id} version={task.version}")
218
+
219
+ log = on_progress or (lambda msg: None)
220
+ on_start = lambda i, total, step, ctx: log(f"Running step [{i+1}/{total}]: {step.type}...")
221
+ on_complete = lambda i, total, step, ctx, dur: log(f"Completed step [{i+1}/{total}]: {step.type} [{dur:.1f}s]")
222
+ context = await task.run(on_step_start=on_start, on_step_complete=on_complete)
223
+
224
+ for deployed_env in context.deployed_envs:
225
+ try:
226
+ await close_deployed(deployed_env, WebsiteEnv)
227
+ except Exception as e:
228
+ logger.warning(f"Failed to clean up env {deployed_env.env_id}: {e}")
229
+ return context.instance_id
230
+
231
+ @classmethod
232
+ async def put_from_github(
233
+ cls,
234
+ id: str,
235
+ backend_dockerfile_github_url: str,
236
+ backend_docker_context_github_url: str | None = None,
237
+ frontend_dockerfile_github_url: str = "",
238
+ frontend_docker_context_github_url: str | None = None,
239
+ environment_name: str | None = None,
240
+ *,
241
+ metadata: dict[str, str] | None = None,
242
+ on_backend_progress: ProgressCallback | None = None,
243
+ on_frontend_progress: ProgressCallback | None = None,
244
+ github_token: str | None = None,
245
+ env_provider_type: str = "gateway",
246
+ ) -> WebsiteEnv:
247
+ """Build backend and frontend Docker images from GitHub in parallel and create a WebsiteEnv."""
248
+ refuse_local_github_build(id)
249
+ backend, frontend = await asyncio.gather(
250
+ DockerImageArtifact.put_from_github(
251
+ id=f"website-backend-{id}",
252
+ dockerfile_github_url=backend_dockerfile_github_url,
253
+ docker_context_github_url=backend_docker_context_github_url,
254
+ on_progress=on_backend_progress,
255
+ github_token=github_token,
256
+ ),
257
+ DockerImageArtifact.put_from_github(
258
+ id=f"website-frontend-{id}",
259
+ dockerfile_github_url=frontend_dockerfile_github_url,
260
+ docker_context_github_url=frontend_docker_context_github_url,
261
+ on_progress=on_frontend_progress,
262
+ github_token=github_token,
263
+ ),
264
+ )
265
+
266
+ combined_metadata: dict[str, str] = {}
267
+ user = os.getenv("USER")
268
+ if user:
269
+ combined_metadata["created_by"] = user
270
+ try:
271
+ combined_metadata["agent_env_version"] = pkg_version("agentenv-framework")
272
+ except Exception:
273
+ pass
274
+ for prefix, build in [("backend", backend), ("frontend", frontend)]:
275
+ combined_metadata[f"{prefix}_dockerfile_github_url"] = build.dockerfile_github_url
276
+ combined_metadata[f"{prefix}_github_owner"] = build.github_owner
277
+ combined_metadata[f"{prefix}_github_repo"] = build.github_repo
278
+ combined_metadata[f"{prefix}_github_commit"] = build.github_commit
279
+ if build.docker_context_github_url:
280
+ combined_metadata[f"{prefix}_docker_context_github_url"] = build.docker_context_github_url
281
+ if build.github_ref:
282
+ combined_metadata[f"{prefix}_github_ref"] = build.github_ref
283
+ if metadata:
284
+ combined_metadata.update(metadata)
285
+
286
+ env = cls.put(
287
+ id=id,
288
+ backend_docker_image_artifact=backend.artifact,
289
+ frontend_docker_image_artifact=frontend.artifact,
290
+ environment_name=environment_name,
291
+ metadata=combined_metadata,
292
+ env_provider_type=env_provider_type,
293
+ )
294
+ return env
@@ -0,0 +1,40 @@
1
+ FROM public.ecr.aws/docker/library/node:22-slim@sha256:813a7480f28fdadac1f7f5c824bcdad435b5bc1322a5968bbbdef8d058f9dff4
2
+
3
+ # Chrome runtime dependencies for headless mode.
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ libnss3 \
6
+ libnspr4 \
7
+ libatk1.0-0 \
8
+ libatk-bridge2.0-0 \
9
+ libcups2 \
10
+ libdrm2 \
11
+ libdbus-1-3 \
12
+ libxkbcommon0 \
13
+ libatspi2.0-0 \
14
+ libxcomposite1 \
15
+ libxdamage1 \
16
+ libxfixes3 \
17
+ libxrandr2 \
18
+ libgbm1 \
19
+ libpango-1.0-0 \
20
+ libcairo2 \
21
+ libasound2 \
22
+ libwayland-client0 \
23
+ fonts-liberation \
24
+ fonts-noto-color-emoji \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ WORKDIR /app
28
+
29
+ ARG PLAYWRIGHT_MCP_VERSION
30
+ ENV PLAYWRIGHT_MCP_VERSION=${PLAYWRIGHT_MCP_VERSION}
31
+
32
+ # Pre-install the pinned version and Chrome.
33
+ RUN npm init -y && \
34
+ npm install @playwright/mcp@${PLAYWRIGHT_MCP_VERSION} && \
35
+ npx playwright install chrome
36
+
37
+ COPY entrypoint.sh /app/entrypoint.sh
38
+ RUN chmod +x /app/entrypoint.sh
39
+
40
+ CMD ["/app/entrypoint.sh"]
@@ -0,0 +1,17 @@
1
+ """Website browser (Playwright) MCP server constants."""
2
+
3
+ # Pinned version of @playwright/mcp to install in the Docker image.
4
+ # Update this when upgrading the Playwright MCP server.
5
+ PLAYWRIGHT_MCP_VERSION = "0.0.41"
6
+
7
+ # Docker image tag for the website browser server image.
8
+ WEBSITE_BROWSER_IMAGE_TAG = "mcp-website-browser"
9
+
10
+ # The environment_name used when creating MCPServerEnv.
11
+ WEBSITE_BROWSER_ENVIRONMENT_NAME = "website-browser"
12
+
13
+ __all__ = [
14
+ "PLAYWRIGHT_MCP_VERSION",
15
+ "WEBSITE_BROWSER_IMAGE_TAG",
16
+ "WEBSITE_BROWSER_ENVIRONMENT_NAME",
17
+ ]
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # MCP_PORT and MCP_HOST are injected by docker-compose (gateway convention).
5
+ # PLAYWRIGHT_MCP_VERSION is baked into the image at build time.
6
+ exec npx @playwright/mcp@${PLAYWRIGHT_MCP_VERSION} \
7
+ --headless \
8
+ --isolated \
9
+ --no-sandbox \
10
+ --host "${MCP_HOST:-0.0.0.0}" \
11
+ --port "${MCP_PORT:-18765}" \
12
+ --allowed-hosts '*' \
13
+ --caps vision
@@ -0,0 +1,14 @@
1
+ FROM public.ecr.aws/docker/library/python:3.11-slim@sha256:c20888b6acdd1e63e1c433a185bf3ad162c0288fe484616ce062e0d28add2900
2
+
3
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
4
+
5
+ WORKDIR /app
6
+
7
+ COPY gateway/requirements.txt .
8
+ RUN pip install --no-cache-dir -r requirements.txt
9
+
10
+ COPY gateway/ ./gateway/
11
+
12
+ ENV PYTHONPATH=/app
13
+
14
+ CMD ["python", "-m", "gateway.entrypoint"]
@@ -0,0 +1,37 @@
1
+ """The gateway's client-facing vocabulary. The server class lives in ``.gateway`` and is
2
+ container code: it needs the Postgres driver, so it is deliberately not re-exported here."""
3
+
4
+ from dataclasses import dataclass
5
+
6
+ from .constants import (
7
+ AGENT_ENV_ROLE_HEADER,
8
+ DEFAULT_ROLE,
9
+ GATEWAY_TRAJECTORY_FILE,
10
+ TOOL_DISABLE_ACTION,
11
+ TOOL_ENABLE_ACTION,
12
+ WILDCARD,
13
+ GatewayMode,
14
+ )
15
+
16
+ AGENT_ENV_GATEWAY_MCP_PORT = 18765 # Reserved port for MCP gateway communications
17
+
18
+
19
+ @dataclass
20
+ class InternalMCPServer:
21
+ """Configuration for an internal MCP server to proxy tools from."""
22
+
23
+ name: str
24
+ mcp_url: str
25
+
26
+
27
+ __all__ = [
28
+ "AGENT_ENV_GATEWAY_MCP_PORT",
29
+ "AGENT_ENV_ROLE_HEADER",
30
+ "DEFAULT_ROLE",
31
+ "GATEWAY_TRAJECTORY_FILE",
32
+ "GatewayMode",
33
+ "InternalMCPServer",
34
+ "TOOL_DISABLE_ACTION",
35
+ "TOOL_ENABLE_ACTION",
36
+ "WILDCARD",
37
+ ]