Skip to content

Commit 9a5efa0

Browse files
authored
Merge pull request #272 from MicrosoftDocs/main638850800223816318sync_temp
Repo sync for protected branch
2 parents 7d3eea4 + 5ee1888 commit 9a5efa0

51 files changed

Lines changed: 5394 additions & 796 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.openpublishing.redirection.json

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,17 +777,52 @@
777777
},
778778
{
779779
"source_path": "semantic-kernel/frameworks/agent/agent-framework.md",
780-
"redirect_url": "semantic-kernel/frameworks/agent",
780+
"redirect_url": "/semantic-kernel/frameworks/agent",
781781
"redirect_document_id": false
782782
},
783783
{
784784
"source_path": "semantic-kernel/Frameworks/agent/agents.md",
785-
"redirect_url": "semantic-kernel/frameworks/agent",
785+
"redirect_url": "/semantic-kernel/frameworks/agent",
786786
"redirect_document_id": false
787787
},
788788
{
789789
"source_path": "semantic-kernel/Frameworks/agent/personas.md",
790-
"redirect_url": "semantic-kernel/frameworks/agent",
790+
"redirect_url": "/semantic-kernel/frameworks/agent",
791+
"redirect_document_id": false
792+
},
793+
{
794+
"source_path": "semantic-kernel/Frameworks/agent/assistant-agent.md",
795+
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/assistant-agent",
796+
"redirect_document_id": false
797+
},
798+
{
799+
"source_path": "semantic-kernel/Frameworks/agent/chat-completion-agent.md",
800+
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/chat-completion-agent",
801+
"redirect_document_id": false
802+
},
803+
{
804+
"source_path": "semantic-kernel/Frameworks/agent/azure-ai-agent.md",
805+
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/azure-ai-agent",
806+
"redirect_document_id": false
807+
},
808+
{
809+
"source_path": "semantic-kernel/Frameworks/agent/copilot-studio-agent.md",
810+
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/copilot-studio-agent",
811+
"redirect_document_id": false
812+
},
813+
{
814+
"source_path": "semantic-kernel/Frameworks/agent/responses-agent.md",
815+
"redirect_url": "/semantic-kernel/frameworks/agent/agent-types/responses-agent",
816+
"redirect_document_id": false
817+
},
818+
{
819+
"source_path": "semantic-kernel/Frameworks/agent/agent-chat.md",
820+
"redirect_url": "/semantic-kernel/support/archive/agent-chat",
821+
"redirect_document_id": false
822+
},
823+
{
824+
"source_path": "semantic-kernel/Frameworks/agent/examples/example-agent-collaboration.md",
825+
"redirect_url": "/semantic-kernel/support/archive/agent-chat-example",
791826
"redirect_document_id": false
792827
}
793828
]

semantic-kernel/Frameworks/agent/TOC.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@
44
href: agent-architecture.md
55
- name: Common Agent Invocation API
66
href: agent-api.md
7-
- name: Chat Completion Agent
8-
href: chat-completion-agent.md
9-
- name: OpenAI Assistant Agent
10-
href: assistant-agent.md
11-
- name: Azure AI Agent
12-
href: azure-ai-agent.md
13-
- name: OpenAI Responses Agent
14-
href: responses-agent.md
15-
- name: Copilot Studio Agent
16-
href: copilot-studio-agent.md
17-
- name: Agent Collaboration
18-
href: agent-chat.md
19-
- name: Create an Agent from a Template
20-
href: agent-templates.md
217
- name: Configuring Agents with Plugins
228
href: agent-functions.md
9+
- name: Contextual Function Selection
10+
href: agent-contextual-function-selection.md
11+
- name: Create an Agent from a Template
12+
href: agent-templates.md
2313
- name: Streaming Agent Responses
2414
href: agent-streaming.md
15+
- name: Agent Memory
16+
href: agent-memory.md
17+
- name: Agent Text Search (RAG)
18+
href: agent-rag.md
19+
- name: Supported Agent Types
20+
href: agent-types/TOC.yml
21+
- name: Agent Orchestration
22+
href: agent-orchestration/TOC.yml
2523
- name: How-To with Agents
2624
href: examples/TOC.yml

semantic-kernel/Frameworks/agent/agent-api.md

Lines changed: 42 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ ms.date: 04/03/2025
99
ms.service: semantic-kernel
1010
---
1111

12-
# The Semantic Kernel Common Agent API surface
12+
# The Semantic Kernel Common Agent API Surface
1313

14-
Semantic Kernel agents share a common interface for invoking agents.
15-
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.
14+
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.
1615

1716
## Invoking an agent
1817

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

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

25-
Semantic Kernel supports four non-streaming agent invocation overloads that allows for passing messages in different ways.
26-
One of these also allows invoking the agent with no messages.
27-
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
24+
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.
2825

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

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

54-
Semantic Kernel supports two non-streaming agent invocation methods that allows for passing messages in different ways.
55-
It is also possible to invoke the agent with no messages.
56-
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
51+
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.
5752

5853
> [!TIP]
59-
> All arguments passed to Agent invocation methods require the caller to pass them as keyword arguments.
54+
> 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.
6055
6156
#### Using the `get_response()` method
6257

6358
```python
6459
# Invoke without any messages.
65-
await agent.get_response(messages=None)
60+
await agent.get_response()
6661

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

8479
```python
8580
# Invoke without any messages.
86-
async for response in agent.invoke(messages=None):
81+
async for response in agent.invoke():
8782
# handle response
8883

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

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

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

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

114-
Semantic Kernel supports three non-streaming agent invocation overloads that allows for passing messages in different ways.
115-
One of these also allows invoking the agent with no messages.
116-
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
109+
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.
117110

118111
```java
119112
// Invoke without any parameters.
@@ -141,9 +134,7 @@ agent.invokeAsync(List.of(
141134

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

144-
Semantic Kernel supports four streaming agent invocation overloads that allows for passing messages in different ways.
145-
One of these also allows invoking the agent with no messages.
146-
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
137+
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.
147138

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

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

173-
Semantic Kernel supports one streaming agent invocation method that allows for passing messages in different ways.
174-
It is also possible to invoke the agent stream with no messages.
175-
This is valuable for scenarios where the agent instructions already have all the required context to provide a useful response.
164+
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.
176165

177166
```python
178167
# Invoke without any messages.
179-
async for response in agent.invoke_stream(messages=None):
168+
async for response in agent.invoke_stream():
180169
# handle response
181170

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

186175
# Invoke with a ChatMessageContent object.
@@ -200,7 +189,6 @@ async for response in agent.invoke_stream(
200189
> [!IMPORTANT]
201190
> 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.
202191
203-
204192
::: zone-end
205193

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

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

216-
All invocation method overloads allow passing an `AgentThread` parameter.
217-
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
204+
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.
218205

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

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

244-
All invocation method keyword arguments allow passing an `AgentThread` parameter.
245-
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
231+
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.
246232

247233
```python
248234
# Invoke with an existing AgentThread.
249-
agent.get_response(messages="What is the capital of France?", existing_agent_thread)
235+
agent.get_response("What is the capital of France?", thread=existing_agent_thread)
250236
```
251237

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

259245
```python
260-
response = await agent.get_response(messages="What is the capital of France?")
246+
response = await agent.get_response("What is the capital of France?")
261247
new_thread = response.thread
262248
response_message = response.message
263249
```
@@ -269,8 +255,7 @@ response_message = response.message
269255

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

272-
Two invocation method overloads allow passing an `AgentThread` parameter.
273-
This is useful for scenarios where you have an existing conversation with the agent that you want to continue.
258+
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.
274259

275260
```java
276261
// Invoke with an existing AgentThread.
@@ -295,10 +280,10 @@ var resultMessage = result.getMessage();
295280
296281
::: zone-end
297282

298-
### Invoking with Options
299-
300283
::: zone pivot="programming-language-csharp"
301284

285+
### Invoking with Options
286+
302287
All invocation method overloads allow passing an `AgentInvokeOptions` parameter.
303288
This options class allows providing any optional settings.
304289

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

313298
Here is the list of the supported options.
314299

315-
|Option Property|Description|
316-
|-|-|
317-
|Kernel|Override the default kernel used by the agent for this invocation.|
318-
|KernelArguments|Override the default kernel arguments used by the agent for this invocation.|
319-
|AdditionalInstructions|Provide any instructions in addition to the original agent instruction set, that only apply for this invocation.|
320-
|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.|
300+
| Option Property | Description |
301+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
302+
| Kernel | Override the default kernel used by the agent for this invocation. |
303+
| KernelArguments | Override the default kernel arguments used by the agent for this invocation. |
304+
| AdditionalInstructions | Provide any instructions in addition to the original agent instruction set, that only apply for this invocation. |
305+
| 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. |
321306

322307
::: zone-end
323308

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

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

315+
### Invoking with Options
316+
330317
One invocation method overloads allow passing an `AgentInvokeOptions` parameter.
331318
This options class allows providing any optional settings.
332319

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

343330
Here is the list of the supported options.
344331

345-
|Option Property|Description|
346-
|-|-|
347-
|Kernel|Override the default kernel used by the agent for this invocation.|
348-
|KernelArguments|Override the default kernel arguments used by the agent for this invocation.|
349-
|AdditionalInstructions|Provide any instructions in addition to the original agent instruction set, that only apply for this invocation.|
350-
|InvocationContext|Override the default invocation context the agent uses for this invocation.|
332+
| Option Property | Description |
333+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
334+
| Kernel | Override the default kernel used by the agent for this invocation. |
335+
| KernelArguments | Override the default kernel arguments used by the agent for this invocation. |
336+
| AdditionalInstructions | Provide any instructions in addition to the original agent instruction set, that only apply for this invocation. |
337+
| InvocationContext | Override the default invocation context the agent uses for this invocation. |
351338

352339
::: zone-end
353340

@@ -389,5 +376,10 @@ agentThread.deleteAsync().block();
389376
> [!TIP]
390377
> For more information on agent threads see the [Agent Thread architecture section](./agent-architecture.md#agent-thread).
391378
379+
## Next steps
380+
381+
> [!div class="nextstepaction"]
382+
> [Configure agents with plugins](./agent-functions.md)
383+
392384
> [!div class="nextstepaction"]
393-
> [Explore the Chat Completion Agent](./chat-completion-agent.md)
385+
> [Explore the Chat Completion Agent](./agent-types/chat-completion-agent.md)

0 commit comments

Comments
 (0)