Skip to content

Repo sync for protected branch #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9618421
Version update
crickman May 21, 2025
75e39f3
Merge branch 'main' into update-foundry-version
crickman May 21, 2025
699d1f4
Merge pull request #569 from MicrosoftDocs/update-foundry-version
markwallace-microsoft May 21, 2025
4552105
Merge pull request #570 from MicrosoftDocs/main
crickman May 21, 2025
704026c
Fix
crickman May 21, 2025
8dd720d
Merge pull request #571 from MicrosoftDocs/fix-foundry-packages
crickman May 21, 2025
b83e78e
Merge pull request #572 from MicrosoftDocs/main
crickman May 21, 2025
a1e7695
Merge pull request #574 from MicrosoftDocs/repo_sync_working_branch
westey-m May 22, 2025
3e757a7
Merge pull request #575 from MicrosoftDocs/main
moonbox3 May 22, 2025
eb3f886
Agent docs update for multi-agent orchestration (#561)
TaoChenOSU May 23, 2025
ac30af8
Merge pull request #576 from MicrosoftDocs/main
moonbox3 May 23, 2025
79cd136
Include kwarg for get_response with thread (#577)
moonbox3 May 23, 2025
c899085
AgentGroupChat migration guide (#578)
TaoChenOSU May 23, 2025
09cd903
Replace the OrchestrationMonitor in samples (#579)
TaoChenOSU May 23, 2025
6f6eca0
Update Foundry tracing UI doc (#580)
TaoChenOSU May 26, 2025
20fbf5e
Merge pull request #581 from MicrosoftDocs/main
moonbox3 May 26, 2025
05487b5
ITextEmbeddingGenerator migration guide
RogerBarreto May 27, 2025
e7ec3a6
Update semantic-kernel/support/migration/text-embedding-obsolete-migr…
RogerBarreto May 28, 2025
2bae827
Address PR feedback
RogerBarreto May 28, 2025
e374e73
Merge branch 'features/migration-guide-textembeddingobsolete' of http…
RogerBarreto May 28, 2025
21297cb
Merge pull request #582 from MicrosoftDocs/features/migration-guide-t…
RogerBarreto May 28, 2025
0f5c853
Python: Add agent declarative spec content, update AzureAIAgent Bing …
moonbox3 May 28, 2025
7248066
Merge pull request #586 from MicrosoftDocs/main
moonbox3 May 28, 2025
c78393b
Add Bedrock agent docs (#587)
moonbox3 May 29, 2025
2acb247
Merge pull request #588 from MicrosoftDocs/main
moonbox3 May 29, 2025
48253e4
Fix redirect links (#589)
TaoChenOSU May 29, 2025
22f2581
Merge pull request #590 from MicrosoftDocs/main
crickman May 29, 2025
bb8476f
AI agent generated content
SergeyMenshykh May 30, 2025
965167e
add main example
SergeyMenshykh May 30, 2025
71e2ecf
update the main sample
SergeyMenshykh May 30, 2025
dc358bd
Add context size section
SergeyMenshykh May 30, 2025
3307aac
add Customizing Context Embedding Value section
SergeyMenshykh May 30, 2025
a663e74
add the Customizing Function Embedding Source Value section
SergeyMenshykh May 30, 2025
bb1a383
add ## Vector Store section
SergeyMenshykh May 30, 2025
ffd9d16
Add ## Specifying Functions section
SergeyMenshykh May 30, 2025
810b441
add ## Next steps section
SergeyMenshykh May 30, 2025
70d94cf
polish
SergeyMenshykh May 30, 2025
1024881
remove accidently pushed file
SergeyMenshykh May 30, 2025
811cb15
removed extra empty lines
SergeyMenshykh May 30, 2025
4cef525
small restructuring
SergeyMenshykh May 30, 2025
e310f35
add zone element
SergeyMenshykh May 30, 2025
1834931
polishing
SergeyMenshykh Jun 3, 2025
10527da
Python: Update docs on how to install base azure dependencies (#592)
moonbox3 Jun 3, 2025
7dd9a4f
Merge pull request #594 from MicrosoftDocs/main
moonbox3 Jun 3, 2025
a9369e3
Update semantic-kernel/Frameworks/agent/agent-contextual-function-sel…
SergeyMenshykh Jun 4, 2025
6d27ecd
Update semantic-kernel/Frameworks/agent/agent-contextual-function-sel…
SergeyMenshykh Jun 4, 2025
e3703ba
Merge pull request #593 from MicrosoftDocs/contextual-function-selection
SergeyMenshykh Jun 4, 2025
82432bd
Merge pull request #595 from MicrosoftDocs/main
SergeyMenshykh Jun 4, 2025
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
41 changes: 38 additions & 3 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -777,17 +777,52 @@
},
{
"source_path": "semantic-kernel/frameworks/agent/agent-framework.md",
"redirect_url": "semantic-kernel/frameworks/agent",
"redirect_url": "/semantic-kernel/frameworks/agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/agents.md",
"redirect_url": "semantic-kernel/frameworks/agent",
"redirect_url": "/semantic-kernel/frameworks/agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/personas.md",
"redirect_url": "semantic-kernel/frameworks/agent",
"redirect_url": "/semantic-kernel/frameworks/agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/assistant-agent.md",
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/assistant-agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/chat-completion-agent.md",
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/chat-completion-agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/azure-ai-agent.md",
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/azure-ai-agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/copilot-studio-agent.md",
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/copilot-studio-agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/responses-agent.md",
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/responses-agent",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/agent-chat.md",
"redirect_url": "/semantic-kernel/support/archive/agent-chat",
"redirect_document_id": false
},
{
"source_path": "semantic-kernel/Frameworks/agent/examples/example-agent-collaboration.md",
"redirect_url": "/semantic-kernel/support/archive/agent-chat-example",
"redirect_document_id": false
}
]
Expand Down
22 changes: 8 additions & 14 deletions semantic-kernel/Frameworks/agent/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
href: agent-architecture.md
- name: Common Agent Invocation API
href: agent-api.md
- name: Chat Completion Agent
href: chat-completion-agent.md
- name: OpenAI Assistant Agent
href: assistant-agent.md
- name: Azure AI Agent
href: azure-ai-agent.md
- name: OpenAI Responses Agent
href: responses-agent.md
- name: Copilot Studio Agent
href: copilot-studio-agent.md
- name: Agent Collaboration
href: agent-chat.md
- name: Create an Agent from a Template
href: agent-templates.md
- name: Configuring Agents with Plugins
href: agent-functions.md
- name: Contextual Function Selection
href: agent-contextual-function-selection.md
- name: Create an Agent from a Template
href: agent-templates.md
- name: Streaming Agent Responses
href: agent-streaming.md
- name: Supported Agent Types
href: agent-types/TOC.yml
- name: Agent Orchestration
href: agent-orchestration/TOC.yml
- name: How-To with Agents
href: examples/TOC.yml
92 changes: 42 additions & 50 deletions semantic-kernel/Frameworks/agent/agent-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ ms.date: 04/03/2025
ms.service: semantic-kernel
---

# The Semantic Kernel Common Agent API surface
# The Semantic Kernel Common Agent API Surface

Semantic Kernel agents share a common interface for invoking agents.
This allows for common code to be written, that works against any agent type and allows for easily switching agents as required, without needing to change the bulk of your code.
Semantic Kernel agents implement a unified interface for invocation, enabling shared code that operates seamlessly across different agent types. This design allows you to switch agents as needed without modifying the majority of your application logic.

## Invoking an agent

Expand All @@ -22,9 +21,7 @@ The Agent API surface supports both streaming and non-streaming invocation.

::: zone pivot="programming-language-csharp"

Semantic Kernel supports four non-streaming agent invocation overloads that allows for passing messages in different ways.
One of these also allows invoking the agent with no messages.
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
Semantic Kernel supports four non-streaming agent invocation overloads that allows for passing messages in different ways. One of these also allows invoking the agent with no messages. This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.

```csharp
// Invoke without any parameters.
Expand All @@ -51,18 +48,16 @@ agent.InvokeAsync(new List<ChatMessageContent>()

::: zone pivot="programming-language-python"

Semantic Kernel supports two non-streaming agent invocation methods that allows for passing messages in different ways.
It is also possible to invoke the agent with no messages.
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
Semantic Kernel supports two non-streaming agent invocation methods that allows for passing messages in different ways. It is also possible to invoke the agent with no messages. This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.

> [!TIP]
> All arguments passed to Agent invocation methods require the caller to pass them as keyword arguments.
> All arguments passed to Agent invocation methods require the caller to pass them as keyword arguments, except for the first positional argument, `messages`. You may invoke with either a positional or a keyword argument for `messages`. For example, both `await agent.get_response("What is the capital of France?")` and `await agent.get_response(messages="What is the capital of France?")` are supported. All other parameters must be passed as keyword arguments.

#### Using the `get_response()` method

```python
# Invoke without any messages.
await agent.get_response(messages=None)
await agent.get_response()

# Invoke with a string that will be used as a User message.
await agent.get_response(messages="What is the capital of France?")
Expand All @@ -83,15 +78,15 @@ await agent.get_response(

```python
# Invoke without any messages.
async for response in agent.invoke(messages=None):
async for response in agent.invoke():
# handle response

# Invoke with a string that will be used as a User message.
async for response in agent.invoke(messages="What is the capital of France?"):
async for response in agent.invoke("What is the capital of France?"):
# handle response

# Invoke with a ChatMessageContent object.
async for response in agent.invoke(messages=ChatMessageContent(AuthorRole.USER, "What is the capital of France?")):
async for response in agent.invoke(ChatMessageContent(AuthorRole.USER, "What is the capital of France?")):
# handle response

# Invoke with multiple ChatMessageContent objects.
Expand All @@ -111,9 +106,7 @@ async for response in agent.invoke(

::: zone pivot="programming-language-java"

Semantic Kernel supports three non-streaming agent invocation overloads that allows for passing messages in different ways.
One of these also allows invoking the agent with no messages.
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
Semantic Kernel supports three non-streaming agent invocation overloads that allows for passing messages in different ways. One of these also allows invoking the agent with no messages. This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.

```java
// Invoke without any parameters.
Expand Down Expand Up @@ -141,9 +134,7 @@ agent.invokeAsync(List.of(

::: zone pivot="programming-language-csharp"

Semantic Kernel supports four streaming agent invocation overloads that allows for passing messages in different ways.
One of these also allows invoking the agent with no messages.
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
Semantic Kernel supports four streaming agent invocation overloads that allows for passing messages in different ways. One of these also allows invoking the agent with no messages. This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.

```csharp
// Invoke without any parameters.
Expand All @@ -170,17 +161,15 @@ agent.InvokeStreamingAsync(new List<ChatMessageContent>()

::: zone pivot="programming-language-python"

Semantic Kernel supports one streaming agent invocation method that allows for passing messages in different ways.
It is also possible to invoke the agent stream with no messages.
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
Semantic Kernel supports one streaming agent invocation method that allows for passing messages in different ways. It is also possible to invoke the agent stream with no messages. This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.

```python
# Invoke without any messages.
async for response in agent.invoke_stream(messages=None):
async for response in agent.invoke_stream():
# handle response

# Invoke with a string that will be used as a User message.
async for response in agent.invoke_stream(messages="What is the capital of France?"):
async for response in agent.invoke_stream("What is the capital of France?"):
# handle response

# Invoke with a ChatMessageContent object.
Expand All @@ -200,7 +189,6 @@ async for response in agent.invoke_stream(
> [!IMPORTANT]
> Invoking an agent without passing an `AgentThread` to the `invoke_stream()` method will create a new thread and return the new thread in the response.


::: zone-end

::: zone pivot="programming-language-java"
Expand All @@ -213,8 +201,7 @@ async for response in agent.invoke_stream(

::: zone pivot="programming-language-csharp"

All invocation method overloads allow passing an `AgentThread` parameter.
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
All invocation method overloads allow passing an `AgentThread` parameter. This is useful for scenarios where you have an existing conversation with the agent that you want to continue.

```csharp
// Invoke with an existing AgentThread.
Expand All @@ -241,12 +228,11 @@ var resultMessage = result.Message;

::: zone pivot="programming-language-python"

All invocation method keyword arguments allow passing an `AgentThread` parameter.
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
All invocation method keyword arguments allow passing an `AgentThread` parameter. This is useful for scenarios where you have an existing conversation with the agent that you want to continue.

```python
# Invoke with an existing AgentThread.
agent.get_response(messages="What is the capital of France?", existing_agent_thread)
agent.get_response("What is the capital of France?", thread=existing_agent_thread)
```

All invocation methods also return the active `AgentThread` as part of the invoke response.
Expand All @@ -257,7 +243,7 @@ All invocation methods also return the active `AgentThread` as part of the invok
The returned `AgentThread` is available on the individual response items of the invoke methods together with the response message.

```python
response = await agent.get_response(messages="What is the capital of France?")
response = await agent.get_response("What is the capital of France?")
new_thread = response.thread
response_message = response.message
```
Expand All @@ -269,8 +255,7 @@ response_message = response.message

::: zone pivot="programming-language-java"

Two invocation method overloads allow passing an `AgentThread` parameter.
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
Two invocation method overloads allow passing an `AgentThread` parameter. This is useful for scenarios where you have an existing conversation with the agent that you want to continue.

```java
// Invoke with an existing AgentThread.
Expand All @@ -295,10 +280,10 @@ var resultMessage = result.getMessage();

::: zone-end

### Invoking with Options

::: zone pivot="programming-language-csharp"

### Invoking with Options

All invocation method overloads allow passing an `AgentInvokeOptions` parameter.
This options class allows providing any optional settings.

Expand All @@ -312,12 +297,12 @@ agent.InvokeAsync("What is the capital of France?", options: new()

Here is the list of the supported options.

|Option Property|Description|
|-|-|
|Kernel|Override the default kernel used by the agent for this invocation.|
|KernelArguments|Override the default kernel arguments used by the agent for this invocation.|
|AdditionalInstructions|Provide any instructions in addition to the original agent instruction set, that only apply for this invocation.|
|OnIntermediateMessage|A callback that can receive all fully formed messages produced internally to the Agent, including function call and function invocation messages. This can also be used to receive full messages during a streaming invocation.|
| Option Property | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Kernel | Override the default kernel used by the agent for this invocation. |
| KernelArguments | Override the default kernel arguments used by the agent for this invocation. |
| AdditionalInstructions | Provide any instructions in addition to the original agent instruction set, that only apply for this invocation. |
| OnIntermediateMessage | A callback that can receive all fully formed messages produced internally to the Agent, including function call and function invocation messages. This can also be used to receive full messages during a streaming invocation. |

::: zone-end

Expand All @@ -327,12 +312,14 @@ Here is the list of the supported options.

::: zone pivot="programming-language-java"

### Invoking with Options

One invocation method overloads allow passing an `AgentInvokeOptions` parameter.
This options class allows providing any optional settings.

```java
// Invoke with additional instructions via options.
agent.invokeAsync("What is the capital of France?",
agent.invokeAsync("What is the capital of France?",
null, // null AgentThread
AgentInvokeOptions.builder()
.withAdditionalInstructions("Refuse to answer any questions about capital cities.")
Expand All @@ -342,12 +329,12 @@ agent.invokeAsync("What is the capital of France?",

Here is the list of the supported options.

|Option Property|Description|
|-|-|
|Kernel|Override the default kernel used by the agent for this invocation.|
|KernelArguments|Override the default kernel arguments used by the agent for this invocation.|
|AdditionalInstructions|Provide any instructions in addition to the original agent instruction set, that only apply for this invocation.|
|InvocationContext|Override the default invocation context the agent uses for this invocation.|
| Option Property | Description |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Kernel | Override the default kernel used by the agent for this invocation. |
| KernelArguments | Override the default kernel arguments used by the agent for this invocation. |
| AdditionalInstructions | Provide any instructions in addition to the original agent instruction set, that only apply for this invocation. |
| InvocationContext | Override the default invocation context the agent uses for this invocation. |

::: zone-end

Expand Down Expand Up @@ -389,5 +376,10 @@ agentThread.deleteAsync().block();
> [!TIP]
> For more information on agent threads see the [Agent Thread architecture section](./agent-architecture.md#agent-thread).

## Next steps

> [!div class="nextstepaction"]
> [Configure agents with plugins](./agent-functions.md)

> [!div class="nextstepaction"]
> [Explore the Chat Completion Agent](./chat-completion-agent.md)
> [Explore the Chat Completion Agent](./agent-types/chat-completion-agent.md)
Loading