Repository navigation
Conversation
Provide a native Environment backed by a Databricks sandbox for the v1.0 (codex-harness) SDK. A localhost WSS gateway relays the SDK executor connection to the sandbox exec-server over the databricks-sdk streaming command API; databricks_sandbox_environment provisions the gateway and yields a configured Environment. Add a databricks optional-dependency extra, unit tests for the relay and bearer auth, a runnable example, and a package README. The README flags two prerequisites to confirm against a live sandbox: exec-server stdio mode in the image, and bidirectional streaming via execute_command. Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Draft integration that backs the native
Environment(v1.0 /feat/codex-harness)with a Databricks sandbox, so an agent driven by this SDK runs
exec_command/write_stdin/apply_patchinside the sandbox.This PR is opened inside a personal fork (base
feat/codex-harness, headhsingtang/databricks-codex) for Databricks and OpenAI folks to review beforeanything is proposed upstream. It is not a contribution request to
openai/openai-agents-pythonyet.Approach
The native
Environmentdials an authenticatedwss://executor and relays theexec-server protocol over it; a Databricks sandbox runs that exec-server in
stdio mode, reached through the
databricks-sdkstreaming command API(
WorkspaceClient.sandbox.execute_command). Nothing in the SDK speaks stdio andnothing in the sandbox speaks WebSocket, so a small localhost gateway bridges
them - it terminates the WebSocket, authenticates the bearer token at the HTTP
handshake, opens the exec-server's stdio, and relays bytes both ways. Because
execute_commandreaches the sandbox outbound through the Databricks controlplane, the gateway runs on loopback next to the application and the sandbox
needs no inbound ingress. The agent loop runs in-process via
NativeProvider,which is what makes the
Environmentapproval / transform /NetworkPolicyhooks available.
Contents
src/agents/extensions/sandbox/databricks/-SandboxExecServerGateway(relay + self-signed loopback TLS helper) and
databricks_sandbox_environment(async context manager that provisions the gateway and yields a configured
Environment).pyproject.toml- adatabricksoptional-dependency extra(
databricks-sdk[sandbox],websockets,cryptography,certifi) and amypy override. This reintroduces
[project.optional-dependencies], which thev1.0 tree had dropped.
SSL_CERT_FILEtrust-bundle helper.examples/databricks/runner.pyand a packageREADME.md.Open items (please review)
These assumptions are documented in the README and need confirming against a
live sandbox:
codexbinary servesexec-serverin stdio mode (thedefault command is
("codex", "exec-server", "stdio")). The SDK's ownoffline_docker.pyprovesexec-server stdiois valid; the Databrickscookbook exercised only the outbound
--remotemode.execute_command(CommandProcess) is a suitable bidirectionalbinary stdio stream for the exec-server protocol under load.
(the relay does not preserve per-message frame boundaries).
Validation
ruff checkandruff format --checkpass on all new files.pytestandmypywere not run here: the v1.0 SDK is a GitHub prerelease wheel (off PyPI) with a
compiled native runtime, which is not installable through the available package
proxy. The tests are written to run where that preview wheel is installed.
This pull request and its description were written by Isaac.