Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/azd/extensions/azure.ai.agents/internal/cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Comment thread
v1212 marked this conversation as resolved.
// Disable Go's transparent gzip handling so the dumped headers
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
v1212 marked this conversation as resolved.

httpClient := &http.Client{}
Expand Down Expand Up @@ -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)

Comment thread
v1212 marked this conversation as resolved.
resp, err := c.pipeline.Do(req)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down Expand Up @@ -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", "")
}

Expand Down
Loading