Skip to content

Commit 85f2146

Browse files
feat: Add AI gateway and MCP gateway flags to network policy create (#7638)
1 parent 21d4ce8 commit 85f2146

6 files changed

Lines changed: 73 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1a92de99959f20ab5850a7f89db21cb66269b2e0002ffc5e5afbe660d05b0768.yml
3-
openapi_spec_hash: 41e4660f26e27e6ab94d223da4ec1253
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-dd0f43e15cb67179deaf86f83ae04c6fae4ff858ee33e82a3b89231566cdc5bb.yml
3+
openapi_spec_hash: 569176c1c4f48efd25a44fa526fad9d1
44
config_hash: cbda3692cb48ab8582a0df1674b9e5c8

src/runloop_api_client/resources/network_policies.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ def create(
4848
self,
4949
*,
5050
name: str,
51+
allow_ai_gateway: Optional[bool] | Omit = omit,
5152
allow_all: Optional[bool] | Omit = omit,
5253
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
54+
allow_mcp_gateway: Optional[bool] | Omit = omit,
5355
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
5456
description: Optional[str] | Omit = omit,
5557
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -69,13 +71,19 @@ def create(
6971
name: The human-readable name for the NetworkPolicy. Must be unique within the
7072
account.
7173
74+
allow_ai_gateway: (Optional) If true, allows devbox egress to the AI credential gateway for
75+
credential proxying. Defaults to false.
76+
7277
allow_all: (Optional) If true, all egress traffic is allowed (ALLOW_ALL policy). Defaults
7378
to false.
7479
7580
allow_devbox_to_devbox: (Optional) If true, allows traffic between the account's own devboxes via
7681
tunnels. Defaults to false. If allow_all is true, this is automatically set to
7782
true.
7883
84+
allow_mcp_gateway: (Optional) If true, allows devbox egress to the MCP hub for MCP server access.
85+
Defaults to false.
86+
7987
allowed_hostnames: (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
8088
'*.npmjs.org'].
8189
@@ -96,8 +104,10 @@ def create(
96104
body=maybe_transform(
97105
{
98106
"name": name,
107+
"allow_ai_gateway": allow_ai_gateway,
99108
"allow_all": allow_all,
100109
"allow_devbox_to_devbox": allow_devbox_to_devbox,
110+
"allow_mcp_gateway": allow_mcp_gateway,
101111
"allowed_hostnames": allowed_hostnames,
102112
"description": description,
103113
},
@@ -150,8 +160,10 @@ def update(
150160
self,
151161
id: str,
152162
*,
163+
allow_ai_gateway: Optional[bool] | Omit = omit,
153164
allow_all: Optional[bool] | Omit = omit,
154165
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
166+
allow_mcp_gateway: Optional[bool] | Omit = omit,
155167
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
156168
description: Optional[str] | Omit = omit,
157169
name: Optional[str] | Omit = omit,
@@ -168,10 +180,14 @@ def update(
168180
All fields are optional.
169181
170182
Args:
183+
allow_ai_gateway: If true, allows devbox egress to the AI credential gateway.
184+
171185
allow_all: If true, all egress traffic is allowed (ALLOW_ALL policy).
172186
173187
allow_devbox_to_devbox: If true, allows traffic between the account's own devboxes via tunnels.
174188
189+
allow_mcp_gateway: If true, allows devbox egress to the MCP hub.
190+
175191
allowed_hostnames: Updated DNS-based allow list with wildcard support. Examples: ['github.com',
176192
'*.npmjs.org'].
177193
@@ -195,8 +211,10 @@ def update(
195211
f"/v1/network-policies/{id}",
196212
body=maybe_transform(
197213
{
214+
"allow_ai_gateway": allow_ai_gateway,
198215
"allow_all": allow_all,
199216
"allow_devbox_to_devbox": allow_devbox_to_devbox,
217+
"allow_mcp_gateway": allow_mcp_gateway,
200218
"allowed_hostnames": allowed_hostnames,
201219
"description": description,
202220
"name": name,
@@ -334,8 +352,10 @@ async def create(
334352
self,
335353
*,
336354
name: str,
355+
allow_ai_gateway: Optional[bool] | Omit = omit,
337356
allow_all: Optional[bool] | Omit = omit,
338357
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
358+
allow_mcp_gateway: Optional[bool] | Omit = omit,
339359
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
340360
description: Optional[str] | Omit = omit,
341361
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -355,13 +375,19 @@ async def create(
355375
name: The human-readable name for the NetworkPolicy. Must be unique within the
356376
account.
357377
378+
allow_ai_gateway: (Optional) If true, allows devbox egress to the AI credential gateway for
379+
credential proxying. Defaults to false.
380+
358381
allow_all: (Optional) If true, all egress traffic is allowed (ALLOW_ALL policy). Defaults
359382
to false.
360383
361384
allow_devbox_to_devbox: (Optional) If true, allows traffic between the account's own devboxes via
362385
tunnels. Defaults to false. If allow_all is true, this is automatically set to
363386
true.
364387
388+
allow_mcp_gateway: (Optional) If true, allows devbox egress to the MCP hub for MCP server access.
389+
Defaults to false.
390+
365391
allowed_hostnames: (Optional) DNS-based allow list with wildcard support. Examples: ['github.com',
366392
'*.npmjs.org'].
367393
@@ -382,8 +408,10 @@ async def create(
382408
body=await async_maybe_transform(
383409
{
384410
"name": name,
411+
"allow_ai_gateway": allow_ai_gateway,
385412
"allow_all": allow_all,
386413
"allow_devbox_to_devbox": allow_devbox_to_devbox,
414+
"allow_mcp_gateway": allow_mcp_gateway,
387415
"allowed_hostnames": allowed_hostnames,
388416
"description": description,
389417
},
@@ -436,8 +464,10 @@ async def update(
436464
self,
437465
id: str,
438466
*,
467+
allow_ai_gateway: Optional[bool] | Omit = omit,
439468
allow_all: Optional[bool] | Omit = omit,
440469
allow_devbox_to_devbox: Optional[bool] | Omit = omit,
470+
allow_mcp_gateway: Optional[bool] | Omit = omit,
441471
allowed_hostnames: Optional[SequenceNotStr[str]] | Omit = omit,
442472
description: Optional[str] | Omit = omit,
443473
name: Optional[str] | Omit = omit,
@@ -454,10 +484,14 @@ async def update(
454484
All fields are optional.
455485
456486
Args:
487+
allow_ai_gateway: If true, allows devbox egress to the AI credential gateway.
488+
457489
allow_all: If true, all egress traffic is allowed (ALLOW_ALL policy).
458490
459491
allow_devbox_to_devbox: If true, allows traffic between the account's own devboxes via tunnels.
460492
493+
allow_mcp_gateway: If true, allows devbox egress to the MCP hub.
494+
461495
allowed_hostnames: Updated DNS-based allow list with wildcard support. Examples: ['github.com',
462496
'*.npmjs.org'].
463497
@@ -481,8 +515,10 @@ async def update(
481515
f"/v1/network-policies/{id}",
482516
body=await async_maybe_transform(
483517
{
518+
"allow_ai_gateway": allow_ai_gateway,
484519
"allow_all": allow_all,
485520
"allow_devbox_to_devbox": allow_devbox_to_devbox,
521+
"allow_mcp_gateway": allow_mcp_gateway,
486522
"allowed_hostnames": allowed_hostnames,
487523
"description": description,
488524
"name": name,

src/runloop_api_client/types/network_policy_create_params.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ class NetworkPolicyCreateParams(TypedDict, total=False):
1717
Must be unique within the account.
1818
"""
1919

20+
allow_ai_gateway: Optional[bool]
21+
"""
22+
(Optional) If true, allows devbox egress to the AI credential gateway for
23+
credential proxying. Defaults to false.
24+
"""
25+
2026
allow_all: Optional[bool]
2127
"""(Optional) If true, all egress traffic is allowed (ALLOW_ALL policy).
2228
@@ -30,6 +36,12 @@ class NetworkPolicyCreateParams(TypedDict, total=False):
3036
true.
3137
"""
3238

39+
allow_mcp_gateway: Optional[bool]
40+
"""(Optional) If true, allows devbox egress to the MCP hub for MCP server access.
41+
42+
Defaults to false.
43+
"""
44+
3345
allowed_hostnames: Optional[SequenceNotStr[str]]
3446
"""(Optional) DNS-based allow list with wildcard support.
3547

src/runloop_api_client/types/network_policy_update_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111

1212

1313
class NetworkPolicyUpdateParams(TypedDict, total=False):
14+
allow_ai_gateway: Optional[bool]
15+
"""If true, allows devbox egress to the AI credential gateway."""
16+
1417
allow_all: Optional[bool]
1518
"""If true, all egress traffic is allowed (ALLOW_ALL policy)."""
1619

1720
allow_devbox_to_devbox: Optional[bool]
1821
"""If true, allows traffic between the account's own devboxes via tunnels."""
1922

23+
allow_mcp_gateway: Optional[bool]
24+
"""If true, allows devbox egress to the MCP hub."""
25+
2026
allowed_hostnames: Optional[SequenceNotStr[str]]
2127
"""Updated DNS-based allow list with wildcard support.
2228

src/runloop_api_client/types/network_policy_view.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
class Egress(BaseModel):
1111
"""The egress rules for this policy."""
1212

13+
allow_ai_gateway: bool
14+
"""
15+
If true, allows devbox egress to the AI credential gateway for credential
16+
proxying.
17+
"""
18+
1319
allow_all: bool
1420
"""If true, all egress traffic is allowed and other fields are ignored.
1521
@@ -19,6 +25,9 @@ class Egress(BaseModel):
1925
allow_devbox_to_devbox: bool
2026
"""If true, allows traffic between the account's own devboxes via tunnels."""
2127

28+
allow_mcp_gateway: bool
29+
"""If true, allows devbox egress to the MCP hub for MCP server access."""
30+
2231
allowed_hostnames: List[str]
2332
"""DNS-based allow list with wildcard support.
2433

tests/api_resources/test_network_policies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ def test_method_create(self, client: Runloop) -> None:
3131
def test_method_create_with_all_params(self, client: Runloop) -> None:
3232
network_policy = client.network_policies.create(
3333
name="name",
34+
allow_ai_gateway=True,
3435
allow_all=True,
3536
allow_devbox_to_devbox=True,
37+
allow_mcp_gateway=True,
3638
allowed_hostnames=["string"],
3739
description="description",
3840
)
@@ -111,8 +113,10 @@ def test_method_update(self, client: Runloop) -> None:
111113
def test_method_update_with_all_params(self, client: Runloop) -> None:
112114
network_policy = client.network_policies.update(
113115
id="id",
116+
allow_ai_gateway=True,
114117
allow_all=True,
115118
allow_devbox_to_devbox=True,
119+
allow_mcp_gateway=True,
116120
allowed_hostnames=["string"],
117121
description="description",
118122
name="name",
@@ -240,8 +244,10 @@ async def test_method_create(self, async_client: AsyncRunloop) -> None:
240244
async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -> None:
241245
network_policy = await async_client.network_policies.create(
242246
name="name",
247+
allow_ai_gateway=True,
243248
allow_all=True,
244249
allow_devbox_to_devbox=True,
250+
allow_mcp_gateway=True,
245251
allowed_hostnames=["string"],
246252
description="description",
247253
)
@@ -320,8 +326,10 @@ async def test_method_update(self, async_client: AsyncRunloop) -> None:
320326
async def test_method_update_with_all_params(self, async_client: AsyncRunloop) -> None:
321327
network_policy = await async_client.network_policies.update(
322328
id="id",
329+
allow_ai_gateway=True,
323330
allow_all=True,
324331
allow_devbox_to_devbox=True,
332+
allow_mcp_gateway=True,
325333
allowed_hostnames=["string"],
326334
description="description",
327335
name="name",

0 commit comments

Comments
 (0)