Skip to content

feat: Multi-agent architecture proposal#10

Open
stuart-gano wants to merge 5 commits intomainfrom
multi-agent-architecture
Open

feat: Multi-agent architecture proposal#10
stuart-gano wants to merge 5 commits intomainfrom
multi-agent-architecture

Conversation

@stuart-gano
Copy link
Copy Markdown
Collaborator

@stuart-gano stuart-gano commented Mar 10, 2026

Summary

  • Proposes refactoring the monolithic Workbench backend (~10K lines Python) into 5 discoverable sub-agents using @app_agent (dbx-agent-app) + AI Dev Kit (databricks-tools-core)
  • Adds architecture proposal doc, agents.yaml deployment config, and skeleton app.py + app.yaml for each agent
  • Implements concrete solutions for all 5 integration challenges identified in the proposal
  • Additive only — no existing monolith code is modified

Agent Decomposition

Agent Responsibility LLM? Streaming?
genie-scorer IQ scanning, score history, stars No No
genie-analyzer Deep LLM analysis + synthesis Yes Yes (SSE)
genie-creator Conversational space creation wizard (16 tools) Yes Yes (SSE)
genie-optimizer Optimization from benchmark feedback Yes Heartbeat
genie-fixer AI-generated config patches Yes Yes (SSE)
supervisor React SPA + routes to sub-agents No Proxy

Integration Challenge Solutions

# Challenge Solution File
1 Three disconnected auth systems need the same OBO token obo_context() context manager bridges all 3 in one with block agents/_shared/auth_bridge.py
2 generate_config has 11 params with 4-5 nesting levels; 580 lines of hand-written JSON schema 80 lines of Pydantic models that auto-generate JSON Schema + validate at runtime agents/creator/schemas.py
3 React SPA makes 28 API calls that now route to 5 different sub-agents Ordered prefix-matching proxy with glob support and SSE stream detection agents/supervisor/proxy.py
4 SP fallback pattern duplicated across genie_client.py and spaces.py @with_sp_fallback decorator + genie_api_call() convenience function agents/_shared/sp_fallback.py
5 Multiple agents need Lakebase but run as separate apps Shared pool lifecycle with idempotent per-agent DDL and in-memory fallback agents/_shared/lakebase_client.py

Estimated Impact

  • ~30% backend code reduction (eliminating tool definition boilerplate, OBO middleware, utility wrappers)
  • 5 free MCP servers + A2A discovery (auto-generated by @app_agent)
  • mlflow.genai.evaluate() support via eval bridge
  • 8-phase migration path, ordered by extraction risk (scorer first → creator last)

Files

New — shared utilities

  • agents/_shared/auth_bridge.py — OBO auth context manager
  • agents/_shared/sp_fallback.py — SP fallback decorator
  • agents/_shared/lakebase_client.py — Shared Lakebase pool
  • agents/creator/schemas.py — Pydantic models for complex tool schemas
  • agents/supervisor/proxy.py — Frontend-transparent proxy

New — agent scaffolds

  • agents/scorer/app.py — scorer agent (wired up with auth_bridge, sp_fallback, lakebase)
  • agents/analyzer/app.py — analyzer agent scaffold
  • agents/creator/app.py — creator agent (uses Pydantic schema override)
  • agents/optimizer/app.py — optimizer agent scaffold
  • agents/fixer/app.py — fixer agent scaffold
  • agents.yaml — multi-agent deployment config

Docs

  • docs/architecture-proposal.md — full proposal with concrete integration solutions

Test plan

  • Review docs/architecture-proposal.md for completeness and accuracy
  • Verify Pydantic schema output matches current hand-written JSON schemas
  • Verify proxy route table covers all 28 frontend API paths (verified locally)
  • Confirm agent decomposition boundaries make sense for the codebase
  • Validate migration phase ordering (scorer → fixer → analyzer → optimizer → creator)
  • Review OBO auth bridge for streaming generator edge cases

@stuart-gano stuart-gano force-pushed the multi-agent-architecture branch from 2f40724 to f7038f8 Compare March 10, 2026 16:37
Proposes refactoring the monolithic Workbench backend (~10K lines) into
5 discoverable sub-agents using @app_agent + AI Dev Kit, with a thin
supervisor routing frontend API calls. Additive only — no existing code
is modified.

New files:
- docs/architecture-proposal.md: full proposal with migration phases
- agents.yaml: multi-agent deployment config
- agents/{scorer,analyzer,creator,optimizer,fixer}/app.py: agent scaffolds
- agents/{scorer,analyzer,creator,optimizer,fixer}/app.yaml: per-agent config
Includes project development guide and the GenieRX analysis/recommendation
framework specification.
- Updated line counts (10,178 total backend)
- Documented SP fallback pattern (get_service_principal_client +
  _is_scope_error) added in PR #7 as new integration challenge (#4)
- Documented genie_client.py scope-error retry pattern in pain points
- Updated scorer scaffold with notes on field name changes (space_id/title)
  and space_url addition from PR #6
- Noted SP fallback in get_space_detail from PR #7
…tecture

Add shared utilities and agent-specific modules that solve the 5 integration
challenges identified in the architecture proposal:

1. OBO Auth Bridge (agents/_shared/auth_bridge.py): Context manager that
   bridges @app_agent UserContext into both monolith ContextVar auth and
   databricks-tools-core ContextVars in a single `with` block.

2. Complex Tool Schemas (agents/creator/schemas.py): Pydantic models that
   auto-generate JSON Schema for @app_agent tool registration, replacing
   ~580 lines of hand-written schema in create_agent_tools.py.

3. Frontend Transparent Proxy (agents/supervisor/proxy.py): Ordered route
   table mapping all 28 frontend API paths to sub-agents with SSE stream
   detection and glob support for path parameters.

4. SP Fallback Decorator (agents/_shared/sp_fallback.py): Extracts the
   _is_scope_error + retry-with-SP pattern from genie_client.py into a
   reusable decorator and convenience function.

5. Shared Lakebase Client (agents/_shared/lakebase_client.py): Connection
   pool lifecycle with idempotent DDL per agent and in-memory fallback.

Also updates scorer/app.py and creator/app.py scaffolds to demonstrate
the integration patterns, and updates the proposal doc with concrete
solutions replacing the placeholder descriptions.
@stuart-gano stuart-gano force-pushed the multi-agent-architecture branch from 8045f4f to e2bebc3 Compare March 13, 2026 16:59
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