Skip to content

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

Draft
calvinmclean wants to merge 11 commits intoobot-platform:mainfrom
calvinmclean:feature/provider-config
Draft

Use Nanobot's new config format + model provider dialects#6246
calvinmclean wants to merge 11 commits intoobot-platform:mainfrom
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 (via lookupProviderDialect) rather than inferring the LLM client type from model name heuristics
  • 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 on lines -223 to +226
webhookDefinitions := make(map[string][]string, len(webhooks))
mcpServers := make(map[string]nanobotConfigMCPServer, len(webhooks)+1)
hookTargets := make(map[string][]string, len(webhooks))
mcpServers := make(map[string]mcp.Server, len(webhooks)+1)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed these to be compatible with the Nanobot types, but not really sure what it does or how to test it at the moment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like the is functionally the same because of custom Marshal/Unmarshal logic for the Hooks type

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.

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.

github.com/obot-platform/obot/logger => ./logger
)

replace github.com/nanobot-ai/nanobot => github.com/calvinmclean/nanobot v0.0.0-20260408174919-d7f157a83d0c
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO

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