Skip to content

docs: add SDK examples for updateNetwork in proxy configuration#583

Merged
Joffref merged 1 commit into
mainfrom
devin/1779930190-update-proxy-sdk-docs
May 28, 2026
Merged

docs: add SDK examples for updateNetwork in proxy configuration#583
Joffref merged 1 commit into
mainfrom
devin/1779930190-update-proxy-sdk-docs

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 28, 2026

Summary

Updates the "Update proxy configuration" section in Sandboxes/Proxy.mdx to showcase the new SDK methods:

  • TypeScript: SandboxInstance.updateNetwork(sandboxName, { network: {...} })
  • Python: SandboxInstance.update_network(sandbox_name, SandboxUpdateNetwork(network={...}))

The existing cURL example is preserved and wrapped in a <CodeGroup> alongside the new SDK examples.

Refs: ENG-2665

Review & Testing Checklist for Human

  • Verify the TypeScript example matches the actual updateNetwork method signature from sdk-typescript#313
  • Verify the Python example matches the actual update_network method signature from sdk-python#150
  • Preview the rendered MDX page to ensure <CodeGroup> tabs display correctly

Notes

The SDK methods were added in sdk-typescript#313 and sdk-python#150.

Link to Devin session: https://app.devin.ai/sessions/0f7a2e36861d46ecb6c11d4749803173
Requested by: @Joffref


Note

Adds TypeScript and Python SDK examples for updateNetwork/update_network to the "Update proxy configuration" section, wrapping all three examples (TypeScript, Python, cURL) in a <CodeGroup> component.

Written by Mendral for commit 7640167.

Update the 'Update proxy configuration' section to showcase the new
SandboxInstance.updateNetwork (TypeScript) and SandboxInstance.update_network
(Python) SDK methods alongside the existing cURL example.

Refs: ENG-2665
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor

@mendral-app mendral-app Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs attention — 1 issue in 1 file

The Python example passes a raw dict with camelCase keys ("allowedDomains", "routing") to SandboxUpdateNetwork(network={...}). If the SDK's Pydantic model uses snake_case field names (the Python convention), this will silently ignore or reject those keys at runtime — readers copying this example verbatim will get an empty/incorrect config. The PR checklist correctly flags signature verification as required before merge; that check must confirm the dict key casing is actually valid for the Python SDK.

Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.

<assessment>
The Python example passes a raw `dict` with camelCase keys (`"allowedDomains"`, `"routing"`) to `SandboxUpdateNetwork(network={...})`. If the SDK's Pydantic model uses snake_case field names (the Python convention), this will silently ignore or reject those keys at runtime — readers copying this example verbatim will get an empty/incorrect config. The PR checklist correctly flags signature verification as required before merge; that check must confirm the dict key casing is actually valid for the Python SDK.
</assessment>

<file name="Sandboxes/Proxy.mdx">
<issue location="Sandboxes/Proxy.mdx:251">
Python dict keys use camelCase (`allowedDomains`, `routing`) where the Python SDK likely expects snake_case (`allowed_domains`). If `SandboxUpdateNetwork` is a Pydantic model without camelCase aliases, these keys will be silently dropped, producing an empty network config.
</issue>
</file>

Tag @mendral-app with feedback or questions. View session

Comment thread Sandboxes/Proxy.mdx
Comment on lines +251 to +268
SandboxUpdateNetwork(network={
"allowedDomains": ["api.stripe.com", "api.openai.com", "api.anthropic.com"],
"proxy": {
"routing": [
{
"destinations": ["api.stripe.com"],
"headers": {"Authorization": "Bearer {{SECRET:stripe-key}}"},
"secrets": {"stripe-key": "sk_live_REPLACE_WITH_YOUR_KEY"},
},
{
"destinations": ["api.anthropic.com"],
"headers": {"x-api-key": "{{SECRET:anthropic-key}}"},
"secrets": {"anthropic-key": "REPLACE_WITH_YOUR_ANTHROPIC_KEY"},
},
],
},
}),
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug (P2): Python dict keys use camelCase (allowedDomains, routing) where the Python SDK likely expects snake_case (allowed_domains). If SandboxUpdateNetwork is a Pydantic model without camelCase aliases, these keys will be silently dropped, producing an empty network config.

Suggested change
Suggested change
SandboxUpdateNetwork(network={
"allowedDomains": ["api.stripe.com", "api.openai.com", "api.anthropic.com"],
"proxy": {
"routing": [
{
"destinations": ["api.stripe.com"],
"headers": {"Authorization": "Bearer {{SECRET:stripe-key}}"},
"secrets": {"stripe-key": "sk_live_REPLACE_WITH_YOUR_KEY"},
},
{
"destinations": ["api.anthropic.com"],
"headers": {"x-api-key": "{{SECRET:anthropic-key}}"},
"secrets": {"anthropic-key": "REPLACE_WITH_YOUR_ANTHROPIC_KEY"},
},
],
},
}),
)
await SandboxInstance.update_network(
"my-sandbox",
SandboxUpdateNetwork(network={
"allowed_domains": ["api.stripe.com", "api.openai.com", "api.anthropic.com"],
"proxy": {
"routing": [
{
"destinations": ["api.stripe.com"],
"headers": {"Authorization": "Bearer {{SECRET:stripe-key}}"},
"secrets": {"stripe-key": "sk_live_REPLACE_WITH_YOUR_KEY"},
},
{
"destinations": ["api.anthropic.com"],
"headers": {"x-api-key": "{{SECRET:anthropic-key}}"},
"secrets": {"anthropic-key": "REPLACE_WITH_YOUR_ANTHROPIC_KEY"},
},
],
},
}),
)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Sandboxes/Proxy.mdx, line 251:

<issue>
Python dict keys use camelCase (`allowedDomains`, `routing`) where the Python SDK likely expects snake_case (`allowed_domains`). If `SandboxUpdateNetwork` is a Pydantic model without camelCase aliases, these keys will be silently dropped, producing an empty network config.
</issue>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bug — the Python SDK integration tests use camelCase dict keys:

SandboxUpdateNetwork(network={"allowedDomains": ["httpbin.org", "*.httpbin.org"]})
SandboxUpdateNetwork(network={"forbiddenDomains": ["httpbin.org", "*.httpbin.org"]})

See tests/integration/core/sandbox/test_network.py. The network parameter accepts a Union[SandboxNetwork, Dict[str, Any]] — when a dict is passed, it goes through the API client which uses camelCase field names matching the REST API schema.

@Joffref Joffref marked this pull request as draft May 28, 2026 06:19
@Joffref Joffref marked this pull request as ready for review May 28, 2026 06:19
@Joffref Joffref merged commit 6e12502 into main May 28, 2026
8 checks passed
@Joffref Joffref deleted the devin/1779930190-update-proxy-sdk-docs branch May 28, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant