mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-28 07:19:08 +01:00
[management,proxy] Add agentgateway integration (#7274)
* [management] Add agentgateway provider catalog entry Allow Agent Network providers to target an operator-supplied agentgateway proxy while stamping trusted NetBird identity headers. Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> * [proxy] Allow trusted Agent Network identity headers Permit only the built-in identity injector to replace the two reserved agentgateway attribution headers while keeping them blocked for every other middleware. Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> * [management,proxy] Add multi-vendor gateway routing Let one Agent Network route declare multiple parser surfaces while preserving the existing singular vendor wire field. Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> * [management] Update router test for model policies Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> * [proxy] Cover reserved header policy Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> * [management] Add agentgateway model discovery Use agentgateway's OpenAI-compatible models endpoint and omit wildcard patterns until NetBird can authorize and price them consistently. Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io> --------- Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
This commit is contained in:
@@ -59,6 +59,13 @@ const openAIListing = `{"object":"list","data":[
|
||||
{"id":"gpt-4o","object":"model","created":1715367049,"owned_by":"system"}
|
||||
]}`
|
||||
|
||||
const agentgatewayListing = `{"object":"list","data":[
|
||||
{"id":"gpt-4o-mini","object":"model","created":1785166485,"owned_by":"openai"},
|
||||
{"id":"claude-haiku-4-5","object":"model","created":1785166485,"owned_by":"anthropic"},
|
||||
{"id":"openai/*","object":"model","created":1785166485,"owned_by":"openai"},
|
||||
{"id":"*-latest","object":"model","created":1785166485,"owned_by":"openai"}
|
||||
]}`
|
||||
|
||||
const anthropicListing = `{"data":[
|
||||
{"type":"model","id":"claude-haiku-4-5-20251001","display_name":"Claude Haiku 4.5"},
|
||||
{"type":"model","id":"claude-sonnet-4-6","display_name":"Claude Sonnet 4.6"}
|
||||
@@ -97,6 +104,26 @@ func TestFetchOpenAIListing(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchAgentgatewayListing(t *testing.T) {
|
||||
cl, tr := newStubClient(http.StatusOK, agentgatewayListing)
|
||||
|
||||
models, err := cl.Fetch(context.Background(), Request{
|
||||
CatalogID: "agentgateway",
|
||||
UpstreamURL: "https://gateway.example.com",
|
||||
APIKey: "virtual-key",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, "https://gateway.example.com/v1/models", tr.got.URL.String())
|
||||
assert.Equal(t, "Bearer virtual-key", tr.got.Header.Get("Authorization"),
|
||||
"agentgateway model discovery must use the configured virtual key")
|
||||
assert.Equal(t, []string{"gpt-4o-mini", "claude-haiku-4-5"}, ids(models),
|
||||
"model patterns must not be offered as exact NetBird authorization rows")
|
||||
for _, m := range models {
|
||||
assert.True(t, m.PricingKnown, "known upstream model must use NetBird catalog pricing: %s", m.ID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchAnthropicSendsTheVersionHeader(t *testing.T) {
|
||||
cl, tr := newStubClient(http.StatusOK, anthropicListing)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user