diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go index 16c62eb2ae2..350ce18846f 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go @@ -954,6 +954,7 @@ func (a *InvokeAction) responsesRemote(ctx context.Context) error { } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+rc.bearerToken) + req.Header.Set("Foundry-Features", "HostedAgents=V1Preview") applyIsolationHeaders(req, &a.flags.isolationHeaderFlags) if raw { // Disable Go's transparent gzip handling so the dumped headers and @@ -1181,6 +1182,7 @@ func (a *InvokeAction) invocationsRemote(ctx context.Context) error { } req.Header.Set("Content-Type", contentTypeForBody(body)) req.Header.Set("Authorization", "Bearer "+rc.bearerToken) + req.Header.Set("Foundry-Features", "HostedAgents=V1Preview") applyIsolationHeaders(req, &a.flags.isolationHeaderFlags) if raw { // Disable Go's transparent gzip handling so the dumped headers and @@ -1525,6 +1527,7 @@ func handleInvocationLRO( if bearerToken != "" { req.Header.Set("Authorization", "Bearer "+bearerToken) } + req.Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Header) if raw { // Disable Go's transparent gzip handling so the dumped headers @@ -1645,6 +1648,7 @@ func createConversation( } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+bearerToken) + req.Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Header) client := &http.Client{Timeout: 30 * time.Second} diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go index 4db3f79e9ad..2beb166641f 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_test.go @@ -1664,6 +1664,9 @@ func assertPollRequestsHaveHeaders( if got := r.Header.Get("Authorization"); got != "Bearer token" { t.Errorf("poll %d: Authorization = %q, want Bearer token", pollNumber, got) } + if got := r.Header.Get("Foundry-Features"); got != "HostedAgents=V1Preview" { + t.Errorf("poll %d: Foundry-Features = %q, want HostedAgents=V1Preview", pollNumber, got) + } if got := r.Header.Get(agent_api.AgentUserIsolationKeyHeader); got != wantUser { t.Errorf("poll %d: %s = %q, want %q", pollNumber, agent_api.AgentUserIsolationKeyHeader, got, wantUser) } @@ -1832,6 +1835,9 @@ func TestCreateConversation_PropagatesIsolationHeaders(t *testing.T) { } request := <-reqCh + if got := request.Header.Get("Foundry-Features"); got != "HostedAgents=V1Preview" { + t.Errorf("Foundry-Features = %q, want HostedAgents=V1Preview", got) + } if got := request.Header.Get(agent_api.AgentUserIsolationKeyHeader); got != "user-1" { t.Errorf("%s = %q, want user-1", agent_api.AgentUserIsolationKeyHeader, got) } diff --git a/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go b/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go index a9e29b83118..8d966d63fdf 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go +++ b/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go @@ -816,6 +816,7 @@ func (c *AgentClient) GetAgentSessionLogStream( req.Header.Set("Authorization", "Bearer "+token.Token) req.Header.Set("User-Agent", fmt.Sprintf("azd-ext-azure-ai-agents/%s", version.Version)) + req.Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Header) httpClient := &http.Client{} @@ -1189,7 +1190,7 @@ func (c *AgentClient) CreateSession( return nil, fmt.Errorf("failed to set request body: %w", err) } - req.Raw().Header.Set("Foundry-Features", "AgentEndpoints=V1Preview") + req.Raw().Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Raw().Header) resp, err := c.pipeline.Do(req) @@ -1240,7 +1241,7 @@ func (c *AgentClient) GetSession( return nil, fmt.Errorf("failed to create request: %w", err) } - req.Raw().Header.Set("Foundry-Features", "AgentEndpoints=V1Preview") + req.Raw().Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Raw().Header) resp, err := c.pipeline.Do(req) @@ -1291,7 +1292,7 @@ func (c *AgentClient) DeleteSession( return fmt.Errorf("failed to create request: %w", err) } - req.Raw().Header.Set("Foundry-Features", "AgentEndpoints=V1Preview") + req.Raw().Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Raw().Header) resp, err := c.pipeline.Do(req) @@ -1340,7 +1341,7 @@ func (c *AgentClient) ListSessions( return nil, fmt.Errorf("failed to create request: %w", err) } - req.Raw().Header.Set("Foundry-Features", "AgentEndpoints=V1Preview") + req.Raw().Header.Set("Foundry-Features", "HostedAgents=V1Preview") options.ApplyHeaders(req.Raw().Header) resp, err := c.pipeline.Do(req) diff --git a/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go b/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go index 0bd745b8efc..4506f9d5b1b 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go +++ b/cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations_test.go @@ -391,6 +391,7 @@ func TestSessionLifecycleOperations_ApplyIsolationHeaders(t *testing.T) { require.NoError(t, tt.call(client, options)) require.Len(t, transport.requests, 1) + require.Equal(t, "HostedAgents=V1Preview", transport.requests[0].Header.Get("Foundry-Features")) requireIsolationHeaders(t, transport.requests[0], "user-1", "chat-1", tt.wantSession) }) } @@ -555,6 +556,7 @@ func TestGetAgentSessionLogStream_ApplyIsolationHeaders(t *testing.T) { } require.NotNil(t, request) require.Equal(t, "Bearer test-token", request.Header.Get("Authorization")) + require.Equal(t, "HostedAgents=V1Preview", request.Header.Get("Foundry-Features")) requireIsolationHeaders(t, request, "user-1", "chat-1", "") }