Skip to content

Use Nanobot's new config format + model provider dialects#6246

Merged
calvinmclean merged 22 commits intoobot-platform:feature/llm-providersfrom
calvinmclean:feature/provider-config
Apr 16, 2026
Merged

Use Nanobot's new config format + model provider dialects#6246
calvinmclean merged 22 commits intoobot-platform:feature/llm-providersfrom
calvinmclean:feature/provider-config

Conversation

@calvinmclean
Copy link
Copy Markdown
Contributor

@calvinmclean calvinmclean commented Apr 8, 2026

This PR updates Obot to consume Nanobot's new provider dialect and llmProviders config format introduced in nanobot-ai/nanobot#263.

Addresses #6195

What Changed

Provider dialect support

  • Reads the dialect field from model provider tool metadata rather than inferring the LLM client type from model name
  • Adds Dialect field to CommonProviderMetadata in the API types

Per-agent provider config

  • Introduces NANOBOT_PROVIDER_CONFIG as a dynamic file credential injected into nanobot agent containers
  • Builds a nanobot.yaml-format provider config containing only the LLM providers actually used by the agent (no more unconditionally injecting both OPENAI_API_KEY and ANTHROPIC_API_KEY)
  • The config is written into .nanobot/nanobot.yaml inside the agent workspace volume via an init container (Docker and Kubernetes)

Type consolidation in MCP backend

  • Replaces locally defined nanobot config structs with imported types from github.com/nanobot-ai/nanobot/pkg/types and pkg/mcp

Dependencies

Comment thread pkg/mcp/backend.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Obot to integrate Nanobot's new provider dialect system and per-agent provider configuration format. The changes enable Obot to read LLM provider dialects from tool metadata rather than relying on heuristics, and to dynamically configure only the providers actually needed by each agent.

Changes:

  • Replaces locally-defined nanobot config structs with imported types from github.com/nanobot-ai/nanobot/pkg/types
  • Adds Dialect field to CommonProviderMetadata in API types for declaring provider API formats
  • Introduces per-agent provider configuration via NANOBOT_PROVIDER_CONFIG dynamic file credential
  • Adds init containers to inject provider configs into agent workspaces (Docker and Kubernetes)
  • Refactors model resolution to capture provider info and dialect for each LLM model
  • Updates function names from generic "constructNanobotYAML" to specific "constructMCPServerNanobotYAML" for clarity

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/mcp/backend.go Replaces local types with nanobot pkg types; consolidates nanobot config construction logic
pkg/mcp/docker.go Adds init container support for provider config injection; refactors repetitive init container code
pkg/mcp/kubernetes.go Adds init container for provider config injection into agent workspaces
pkg/controller/handlers/nanobotagent/nanobotagent.go Refactors model resolution to include provider and dialect info; builds provider-specific config YAML
pkg/controller/handlers/nanobotagent/nanobotagent_test.go Updates tests to work with new resolvedLLMModel return type
apiclient/types/modelprovider.go Adds Dialect field to CommonProviderMetadata
go.mod Updates dependencies and adds local replace directive for nanobot (temporary)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/mcp/backend.go
Comment thread go.mod Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

pkg/mcp/docker.go:1

  • workspaceCreated is returned as true even when VolumeCreate returns AlreadyExists (race with another creator). That defeats the “only run for initial creation” gating and can cause unexpected init behavior. Return false on AlreadyExists (or re-check existence and set workspaceCreated accordingly) so the boolean accurately reflects whether this call created the volume.
package mcp

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go Outdated
Comment thread go.mod
Comment thread pkg/mcp/docker.go
Comment thread pkg/mcp/kubernetes.go Outdated
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go Outdated
@calvinmclean calvinmclean changed the base branch from main to feature/llm-providers April 13, 2026 19:53
@calvinmclean calvinmclean requested a review from Copilot April 13, 2026 21:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apiclient/types/model.go
Comment thread pkg/mcp/docker.go Outdated
Comment thread pkg/mcp/kubernetes.go Outdated
Comment thread pkg/mcp/kubernetes.go Outdated
Comment thread go.mod
@calvinmclean calvinmclean marked this pull request as ready for review April 13, 2026 21:49
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go
Comment thread pkg/mcp/docker.go
@g-linville
Copy link
Copy Markdown
Member

Oh, also, for message policies: right now there is nothing there that would handle chat completions, but it should work with Responses and Anthropic (and OpenResponses if it is identical to Responses). I don't think it necessarily needs to be made to work with chat completions in this same PR, but I wanted to call that out because it is something that will need to get done.

@calvinmclean
Copy link
Copy Markdown
Contributor Author

Oh, also, for message policies: right now there is nothing there that would handle chat completions, but it should work with Responses and Anthropic (and OpenResponses if it is identical to Responses). I don't think it necessarily needs to be made to work with chat completions in this same PR, but I wanted to call that out because it is something that will need to get done.

@g-linville I didn't think we wanted to support chat completions. Maybe I misunderstood

@g-linville
Copy link
Copy Markdown
Member

@calvinmclean Oh, I'm not sure if we want to or not. I was assuming that we were because I saw it was one of the dialect types. But if we aren't going to actually support it with any model providers, then yeah we don't need to do it for message policies.

Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go Outdated
Comment thread pkg/mcp/kubernetes.go Outdated
Comment thread pkg/mcp/backend.go
Comment thread pkg/mcp/docker.go
Comment thread pkg/mcp/docker.go Outdated
@calvinmclean calvinmclean force-pushed the feature/provider-config branch from d692436 to 3cd0a61 Compare April 14, 2026 19:06
@calvinmclean calvinmclean force-pushed the feature/provider-config branch from 3cd0a61 to 0124b53 Compare April 14, 2026 19:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/api/handlers/nanobotagent.go Outdated
Comment thread pkg/mcp/docker.go
Comment thread pkg/controller/handlers/nanobotagent/nanobotagent.go
Comment thread pkg/api/handlers/nanobotagent.go Outdated
Comment thread pkg/mcp/docker.go
@calvinmclean calvinmclean merged commit 002da94 into obot-platform:feature/llm-providers Apr 16, 2026
@calvinmclean calvinmclean deleted the feature/provider-config branch April 16, 2026 14:47
calvinmclean added a commit that referenced this pull request Apr 16, 2026
* Write .nanobot/nanobot.yaml llmProviders

* Simplify docker volume/container inits with runInitContainer

* Update some naming to make it clear it is MCP config only

* Use Nanobot types when building config

* Dynamically build the nanobot.yaml for selected model

* Derive Dialect from provider meta

* Fix name shadowing

* Update go.mod using remote branch

* Generate

* Fix default proxy for ChatCompletions and add tests

* Fix provider config reload with symbolic link

* Improve function naming

* Improve function naming and other minor changes

* Improve ensureCredentials refresh logic

* Add Dialect to ModelManifest

* regenerate

* Always run link for docker

* Revert use of nanobottypes

* PR comments

* Move all config setup to nanobotagent.go

* fix boolean condition per copilot comment

* Fix error retry check
calvinmclean added a commit that referenced this pull request Apr 17, 2026
* Write .nanobot/nanobot.yaml llmProviders

* Simplify docker volume/container inits with runInitContainer

* Update some naming to make it clear it is MCP config only

* Use Nanobot types when building config

* Dynamically build the nanobot.yaml for selected model

* Derive Dialect from provider meta

* Fix name shadowing

* Update go.mod using remote branch

* Generate

* Fix default proxy for ChatCompletions and add tests

* Fix provider config reload with symbolic link

* Improve function naming

* Improve function naming and other minor changes

* Improve ensureCredentials refresh logic

* Add Dialect to ModelManifest

* regenerate

* Always run link for docker

* Revert use of nanobottypes

* PR comments

* Move all config setup to nanobotagent.go

* fix boolean condition per copilot comment

* Fix error retry check
calvinmclean added a commit that referenced this pull request Apr 20, 2026
* Write .nanobot/nanobot.yaml llmProviders

* Simplify docker volume/container inits with runInitContainer

* Update some naming to make it clear it is MCP config only

* Use Nanobot types when building config

* Dynamically build the nanobot.yaml for selected model

* Derive Dialect from provider meta

* Fix name shadowing

* Update go.mod using remote branch

* Generate

* Fix default proxy for ChatCompletions and add tests

* Fix provider config reload with symbolic link

* Improve function naming

* Improve function naming and other minor changes

* Improve ensureCredentials refresh logic

* Add Dialect to ModelManifest

* regenerate

* Always run link for docker

* Revert use of nanobottypes

* PR comments

* Move all config setup to nanobotagent.go

* fix boolean condition per copilot comment

* Fix error retry check
calvinmclean added a commit that referenced this pull request Apr 22, 2026
* Use Nanobot's new config format + model provider dialects (#6246)

* Write .nanobot/nanobot.yaml llmProviders

* Simplify docker volume/container inits with runInitContainer

* Update some naming to make it clear it is MCP config only

* Use Nanobot types when building config

* Dynamically build the nanobot.yaml for selected model

* Derive Dialect from provider meta

* Fix name shadowing

* Update go.mod using remote branch

* Generate

* Fix default proxy for ChatCompletions and add tests

* Fix provider config reload with symbolic link

* Improve function naming

* Improve function naming and other minor changes

* Improve ensureCredentials refresh logic

* Add Dialect to ModelManifest

* regenerate

* Always run link for docker

* Revert use of nanobottypes

* PR comments

* Move all config setup to nanobotagent.go

* fix boolean condition per copilot comment

* Fix error retry check

* Add Bifrost provider dialect and enable model providers in UI (#6358)

* Add Bifrost provider dialect

* Enable bedrock provider in UI

* Enable Ollama in UI

* Enable Azure, AzureEntra in UI

* Update docs

* Update Nanobot branch

* Improve docs for Azure Entra

* fix go mod issue

* Resolve PR comments

* fix go mod

* Improve Ollama networking doc for linux users

* Remaining changes: message policies, dependencies, etc.

WIP deps

Rename NANOBOT_CONFIG_PATH => NANOBOT_CONFIG

Fix MessagePolicy for Bifrost

Extract and reuse message policies code

Include env in BackPopulateModels

- This allows the Azure provider to get updated deployments

Update kinm + nah

improve docs

lint

generate

Improve URL handling

* Update pkg/gateway/server/llmproxy.go

Co-authored-by: Donnie Adams <donnie@obot.ai>

* fix after suggestion applied

* Revert "Update pkg/gateway/server/llmproxy.go"

This reverts commit 320a47b.

* Revert "fix after suggestion applied"

This reverts commit 0281a84.

* Update Nanobot

---------

Co-authored-by: Donnie Adams <donnie@obot.ai>
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.

4 participants