-
-
Notifications
You must be signed in to change notification settings - Fork 14
Connections
Rasmus Wulff Jensen edited this page Dec 25, 2025
·
8 revisions
All providers of AgentFactories and EmbeddingFactories need credentials to authenticate against the underlying services.
Often, such credentials are a single api-key (or an endpoint + api-key) that can be given to a factory:
//Sample: Creating an OpenAI Agent Factory
OpenAIAgentFactory agentFactory = new OpenAIAgentFactory("<api-key>");Caution
Remember to always store secrets like api-key in UserSecrets, Environment Variables, Key Vaults, or similar; NEVER directly in the code!
In more advanced cases, however, you might need additional settings for the connection, such as timeouts, endpoints, in which case you make a provider-specific Connection object:
//Sample: Creating an OpenAI Connection
OpenAIConnection connection = new OpenAIConnection
{
ApiKey = "<api-key>",
NetworkTimeout = TimeSpan.FromMinutes(5), //Set call timeout
});
//Pass connection to Factory instead of simple api-key
OpenAIAgentFactory agentFactory = new OpenAIAgentFactory(connection);| Property | Decription & Notes | Supported Providers |
|---|---|---|
ApiKey |
The API-Key to authenticate against the LLM - GitHub's api-key is called AccessToken- AzureOpenAI offer an RBAC alternative |
All |
NetworkTimeout |
Timeout Settings (if your LLM Calls take longer than the default HTTP Timeout) | All but Google
|
DefaultClientType |
Control if Agents created should use ChatClient or Responses API protocol if not specified specifically by the Agent - Default is ChatClient
|
AzureOpenAI, OpenAI, OpenRouter, XAI
|
Endpoint |
Control the Endpoint the LLM Talk to - Mandatory for AzureOpenAI; for the rest, this is optional- Can be used in OpenAI to implement 3rd party OpenAI providers |
AzureOpenAI, OpenAI, OpenRouter, XAI
|
AdditionalOpenAIClientOptions |
Option to set additional OpenAIClientOptions - Used for not out of the box scenarios for this toolkit |
OpenAI, OpenRouter, XAI
|
Credentials (TokenCredentials) |
Azure Role Based Access Control - Use Standard Azure RBAC like example AzureCliCredential
|
AzureOpenAI |
AdditionalAzureOpenAIClientOptions |
Option to set additional AzureOpenAIClientOptions - Used for not out of the box scenarios for this toolkit |
AzureOpenAI |
AdditionalAzureAIInferenceClientOptions |
Option to set additional AzureAIInferenceClientOptions - Used for not out of the box scenarios for this toolkit |
GitHub |
Adapter (IPlatformAdapter) |
Option to set additional Google specific connection details AzureAIInferenceClientOptions | Google |