Add configurable Mason server and durable runtime modes - #550
Conversation
dc9e40c to
555f5b7
Compare
555f5b7 to
778a210
Compare
| ) | ||
| @click.option( | ||
| "--durability", | ||
| "--server", |
There was a problem hiding this comment.
qq: should we use these flag or just specify something like --template which fills in integrations/mason/templates/TEMPLATE ?
There was a problem hiding this comment.
I would not prefer going with template because then the developer has to read our templates, reason about them, and then select one.
If we are going with --template, then we should remove the all --framework, etc knobs. But would not prefer that.
There was a problem hiding this comment.
hmm that makes sense, but then we need to add new flags for new templates. I feel like it's fine to keep the other templates less discoverable with documentation for the --template flag, especially if we want to push new users to use our sdk provided server.
There was a problem hiding this comment.
yeah that does make sense, but i would argue we should not expose a lot of templates as well.
It violates the principal that mason --help should be self sufficient.
I would defer adding --templates to a later pr, when we really need it.
There was a problem hiding this comment.
then can we remove the --durability and --server flags too? the other templates can just serve as examples until we have a need to expose them.
There was a problem hiding this comment.
makes sense, will remove the durability for now. I think --server can be of value since custom serves the cuj of just porting existing agent and deploying on runtime
What changed
databricks_mason.AgentApp, the Mason HTTP server for foreground, streaming, and background invocations.AgentApp()uses process-local state;AgentApp(durable_runtime=True)adds Lakebase persistence, heartbeats, and crash recovery.mason initto three user-facing modes for both LangGraph and OpenAI:mason init my-agentAgentAppmason init my-agent --no-durable-runtimeAgentAppmason init my-agent --server customAgentApp@app.on_recoveryonly whenDURABLE_RUNTIMEis enabled.databricks_mason.workspace_client()andworkspace_headers()in custom templates for account-host workspace routing without usingAgentApp.agent.tomlcontains[durability] enabled = true. The process-local and custom modes do not provision it.runtime/main.pythin: configure the agent, construct the app, register hooks, and install the optional UI.Validation
Validated through commit
fe86e628e6f3297b056504674c458a964af9afea.400 passedruff format,ruff check,ty check,uv build, andgit diff --check: passedmasoncommandmason devand completed a real model invocation using explicit profilee2-dogfood26 passed, 1 skippedlanggraph durable ok26 passed, 1 skippedlanggraph-local ok2 passedlanggraph-custom ok27 passed, 1 skippedopenai-durable ok27 passed, 1 skippedopenai-local ok2 passedopenai-custom okInstall and scaffold all six modes
Run tests, builds, and local servers
For each generated directory:
Mason server request:
Custom FastAPI request:
Deployed durable-runtime evidence
The durable LangGraph path was deployed to
e2-dogfoodwith one instance and an app-owned Lakebase database:Validated foreground, foreground SSE, background polling, background persisted SSE, UUID idempotency, multi-turn sessions, and HITL. A background invocation was then interrupted by stopping the app and recovered after restart:
Lakebase retained the attempt-1 lifecycle/tool-call events and added attempt-2
run.started, streamed deltas/messages, andrun.completed. The OpenAI durable path was also deployed and validated for foreground and SSE responses.