Skip to content

Add agent-openai-basic template - #262

Open
elainemwang wants to merge 12 commits into
databricks:mainfrom
elainemwang:add-agent-openai-local-template
Open

Add agent-openai-basic template#262
elainemwang wants to merge 12 commits into
databricks:mainfrom
elainemwang:add-agent-openai-local-template

Conversation

@elainemwang

@elainemwang elainemwang commented Aug 21, 2026

Copy link
Copy Markdown

Adds agent-openai-basic, a lean OpenAI Agents SDK agent backend for Databricks Apps.

  • Local-first: runs with no database and no setup beyond a Databricks auth profile (uv run start-server). Sessions use local SQLite.
  • API-first: no bundled UI — exposes the OpenAI Responses API (POST /responses, POST /invocations).
  • Easy to extend: drop a @function_tool file in agent/tools/ (auto-collected); add MCP servers in agent/mcps.py.
  • Opt-in durability & tracing: managed session store, long-running background mode via Lakebase, and MLflow tracing — all off by default, each enabled by an env var, no code change.

trace example: https://eng-ml-inference.staging.cloud.databricks.com/ml/experiments/4023724100406459/traces?o=1653573648247579&selectedEvaluationId=tr-8b96a9e6b738b5605074bbae43e7ff6d

@elainemwang
elainemwang force-pushed the add-agent-openai-local-template branch from 0f34179 to 7ee174b Compare August 21, 2026 20:41
Comment thread agent-openai-basic/server/start_server.py Outdated
@elainemwang
elainemwang force-pushed the add-agent-openai-local-template branch 12 times, most recently from 77c0c13 to 36fe0ae Compare August 24, 2026 17:39
@elainemwang
elainemwang marked this pull request as ready for review August 24, 2026 18:41
@elainemwang
elainemwang force-pushed the add-agent-openai-local-template branch 9 times, most recently from a14e86e to 4553e4e Compare August 24, 2026 22:46
A lean OpenAI Agents SDK agent backend for Databricks Apps: runs locally with no
database and no setup beyond a Databricks auth profile. Lakebase durability and
MLflow tracing are opt-in. API-first (no bundled UI); exposes the OpenAI Responses API.
@elainemwang
elainemwang force-pushed the add-agent-openai-local-template branch from 4553e4e to bbf59ff Compare August 24, 2026 22:47
Co-authored-by: Isaac <no-reply@databricks.com>
Comment thread agent-openai-basic/agent/mason/session_store.py
Comment thread agent-openai-basic/agent/mason/wire/inbound.py
Comment thread agent-openai-basic/.github/workflows/deploy.yml
Comment thread agent-openai-basic/agent/tools/memory.py Outdated
elainemwang and others added 8 commits August 25, 2026 00:35
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
… at call time

Co-authored-by: Isaac <no-reply@databricks.com>
Removes the import-time env gate; create_agent composes [*all_tools(), *memory_tools()].
memory_tools() returns [] unless AGENT_MEMORY_STORE is set, so the model is only offered
memory tools when configured. Swap the import for a databricks-openai helper when it ships.

Co-authored-by: Isaac <no-reply@databricks.com>
tracing._enabled is now set at startup instead of import, so the agent import chain is
side-effect-free. load_dotenv can move below the imports, removing the ruff E402 suppression.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
build_mcp_servers() (the user knob) stays in agent/mcps.py; the connect()/MCPServerManager
plumbing moves to mason/ with the other SDK-migration candidates. Also drops a dead json
import and applies safe ruff fixes to the moved files.

Co-authored-by: Isaac <no-reply@databricks.com>
# (local dev, no Lakebase) it's None, so the server serves in-request over the local SQLite store.
agent_server = LongRunningAgentServer(
"ResponsesAgent",
db_autoscaling_endpoint=os.getenv("LAKEBASE_AUTOSCALING_ENDPOINT"),

@elainemwang elainemwang Aug 25, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will update post local db backed LongRunningAgentServer to remove the currently required db_autoscaling_endpoint param. cc @shivam5

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

will also use resume_strategy=ResumeStrategy.AGENT_SESSION after databricks/databricks-ai-bridge#467

elainemwang and others added 2 commits August 25, 2026 20:30
Co-authored-by: Isaac <no-reply@databricks.com>
Enable tracing when a destination (MLFLOW_TRACKING_URI or MLFLOW_TRACING_DESTINATION) and an
experiment (MLFLOW_EXPERIMENT_ID or MLFLOW_EXPERIMENT_NAME) are both present, in whichever form
the user or Apps resource binding provides. MLflow resolves the specific value.

Co-authored-by: Isaac <no-reply@databricks.com>

``inbound``: Responses request -> agent-SDK run input. ``outbound``: agent-SDK stream events ->
Responses wire events. SDK-specific — a different harness would replace this layer.
"""

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.

is there supposed to be content here?

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.

2 participants