Repository navigation
[databricks-openai] Add a sandbox example runner - #837
Merged
shaotong-db merged 3 commits intoNov 2, 2026
Merged
Conversation
Add integrations/openai/examples/sandbox_runner.py: a runnable example that provisions a Databricks sandbox via DatabricksSandboxClient, runs a SandboxAgent's shell tool inside it against a Databricks model-serving endpoint, and prints the agent's answer. Mirrors the hosted sandbox extension examples in the OpenAI Agents SDK. Co-authored-by: Isaac <no-reply@databricks.com>
Point the default question at explicit shell commands (ls -la, cat) so the example demonstrates the sandbox command-execution path and surfaces it in the output, while keeping the agent instructions general rather than hardcoding the shell (future backends may add non-shell command APIs). Co-authored-by: Isaac <no-reply@databricks.com>
Separate the assistant's text from the sandbox tool calls while streaming: print each shell command on its own [tool: ...] line so the text before and after the commands no longer runs together. Co-authored-by: Isaac <no-reply@databricks.com>
HsingTang
marked this pull request as ready for review
November 2, 2026 20:50
shaotong-db
approved these changes
Nov 2, 2026
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.
What did you change, and why?
Add a runnable example,
integrations/openai/examples/sandbox_runner.py, for the Databricks sandbox backend shipped indatabricks-openai. It provisions a Databricks sandbox viaDatabricksSandboxClient, runs aSandboxAgent's shell tool inside it against a Databricks model-serving endpoint, and prints the agent's answer - mirroring the hosted sandbox extension examples in the OpenAI Agents SDK.The model is built with
AsyncDatabricksOpenAI, so it authenticates to/serving-endpointswith a refreshing bearer token (PAT, OAuth, or M2M) and needs no OpenAI API key.How do you know it works?
ruff check(imports/pyflakes) andruff format --checkclean.config.tokenAsyncOpenAIclient toAsyncDatabricksOpenAI).