Skip to content

feat(models): Adding support for claude/anthropic models on Azure Foundry - #2424

Open
marosset wants to merge 1 commit into
kagent-dev:mainfrom
marosset:foundry-anthropic
Open

feat(models): Adding support for claude/anthropic models on Azure Foundry#2424
marosset wants to merge 1 commit into
kagent-dev:mainfrom
marosset:foundry-anthropic

Conversation

@marosset

Copy link
Copy Markdown
Contributor

Follow up to #2091

Adding support for configuring Anthropic chat models on Azure Foundry.
These changes re-use the same Azure authentication logic and workflows that was implemented in 2091
These changes are currently go only (just like the previous work on Foundry).
I will follow up with python support for Azure Foundry models in the future.

Signed-off-by: Mark Rossetti <marosset@microsoft.com>
Copilot AI lite review requested due to automatic review settings August 11, 2026 18:42

Copilot AI left a comment

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.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds Azure AI Foundry support for Claude/Anthropic chat models by introducing an apiFormat discriminator and wiring it through CRDs, translation layers, runtime dispatch, tracing, and new Anthropic client support.

Changes:

  • Add spec.foundry.apiFormat (OpenAI default vs Anthropic) to CRD/UI types and propagate it through the Go controller → ADK translation.
  • Implement Foundry Anthropic (Messages API) client construction + implicit auth (API key or Entra token) and route Foundry models accordingly at runtime.
  • Extend supported model listings, tracing provider attribution, and add unit/e2e tests for the Anthropic format path.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ui/src/types/index.ts Adds apiFormat to Foundry config typing for UI clients.
helm/kagent-crds/templates/kagent.dev_modelconfigs.yaml Updates Helm CRD schema with apiFormat enum/default and clarifies apiVersion behavior.
go/core/test/e2e/foundry_test.go Adds e2e coverage for Foundry Anthropic chat round-trip using a mock Messages endpoint.
go/core/internal/httpserver/handlers/models.go Lists Claude models as supported and documents apiFormat=Anthropic.
go/core/internal/controller/translator/agent/foundry_test.go Adds unit test ensuring Foundry Anthropic format is translated correctly; asserts OpenAI default.
go/core/internal/controller/translator/agent/adk_api_translator.go Maps CRD APIFormat to ADK wire field on Foundry models.
go/core/internal/a2a/trace_test.go Adds tests for provider-name resolution including Foundry Anthropic vs OpenAI format.
go/core/internal/a2a/trace.go Switches resolver to client.Reader and attributes Foundry Anthropic spans to anthropic; adds Foundry provider mapping.
go/api/v1alpha2/modelconfig_types.go Introduces FoundryAPIFormat type and adds apiFormat to FoundryConfig with defaults/enum.
go/api/config/crd/bases/kagent.dev_modelconfigs.yaml Updates generated CRD base with apiFormat and apiVersion docs.
go/api/adk/types.go Adds api_format field to ADK Foundry model plus string constants.
go/adk/pkg/models/foundry_test.go Adds comprehensive unit tests for Foundry Anthropic client auth paths and passthrough behavior.
go/adk/pkg/models/foundry.go Implements NewFoundryAnthropicModelWithLogger and updates Foundry docs/dispatch assumptions.
go/adk/pkg/internal/azureai/azureai_test.go Expands tests for scoped token acquisition, implicit auth resolver, and new Anthropic client.
go/adk/pkg/internal/azureai/azureai.go Adds scope selection, shared implicit auth resolver, and Foundry Anthropic client construction.
go/adk/pkg/agent/agent.go Routes Foundry models with apiFormat=anthropic to an Anthropic model implementation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +193 to +199
_, _ = client.Messages.New(context.Background(), anthropic.MessageNewParams{
Model: anthropic.Model("dep"),
MaxTokens: 16,
Messages: []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("hi")),
},
})
Comment on lines +228 to +234
_, _ = client.Messages.New(context.Background(), anthropic.MessageNewParams{
Model: anthropic.Model("dep"),
MaxTokens: 16,
Messages: []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("hi")),
},
})
Comment thread go/adk/pkg/agent/agent.go
Comment on lines +378 to +382
cfg := &models.AnthropicConfig{
TransportConfig: transportConfigFromBase(m.BaseModel, nil),
Model: m.Model,
}
return models.NewFoundryAnthropicModelWithLogger(ctx, cfg, m.Endpoint, m.Deployment, nil, log)
Comment on lines +126 to +131
if ep == "" {
return nil, fmt.Errorf("FOUNDRY_ENDPOINT environment variable is not set")
}
if dep == "" {
return nil, fmt.Errorf("FOUNDRY_DEPLOYMENT environment variable is not set")
}
@github-actions github-actions Bot added the enhancement New feature or request label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants