Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static async Task<ChatClientAgent> GetAIAgentAsync(
AgentRecord agentRecord = await GetAgentRecordByNameAsync(aiProjectClient, options.Name, cancellationToken).ConfigureAwait(false);
var agentVersion = agentRecord.Versions.Latest;

var agentOptions = CreateChatClientAgentOptions(agentVersion, options, requireInvocableTools: true);
var agentOptions = CreateChatClientAgentOptions(agentVersion, options, requireInvocableTools: options.UseProvidedChatClientAsIs != true);
Comment thread
rogerbarreto marked this conversation as resolved.
Outdated
Comment thread
rogerbarreto marked this conversation as resolved.
Outdated

return AsChatClientAgent(
aiProjectClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,32 @@ public async Task GetAIAgentAsync_WithUseProvidedChatClientAsIs_PreservesSetting
Assert.NotNull(agent);
}

/// <summary>
/// Verify that GetAIAgentAsync with UseProvidedChatClientAsIs=true skips tool validation
/// and does not throw even when server-side function tools exist without matching invocable tools.
/// </summary>
[Fact]
public async Task GetAIAgentAsync_WithUseProvidedChatClientAsIs_SkipsToolValidationAsync()
{
// Arrange
PromptAgentDefinition definition = new("test-model") { Instructions = "Test" };
definition.Tools.Add(ResponseTool.CreateFunctionTool("required_function", BinaryData.FromString("{}"), strictModeEnabled: false));

AIProjectClient client = this.CreateTestAgentClient(agentDefinitionResponse: definition);
var options = new ChatClientAgentOptions
{
Name = "test-agent",
ChatOptions = new ChatOptions { Instructions = "Test" },
UseProvidedChatClientAsIs = true
};

// Act - should not throw even without tools when UseProvidedChatClientAsIs is true
ChatClientAgent agent = await client.GetAIAgentAsync(options);

// Assert
Assert.NotNull(agent);
}

Comment thread
rogerbarreto marked this conversation as resolved.
#endregion

#region Empty Version and ID Handling Tests
Expand Down
Loading