Skip to content

Repo sync for protected branch #233

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

Open
wants to merge 126 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
648dd7c
Add python process how-to guides
moonbox3 Feb 13, 2025
2b565e2
Improve Python agent learn site samples.
moonbox3 Feb 13, 2025
f1b1b6c
Fix spurious zone-end tag
gewarren Feb 13, 2025
b5eb15b
Ingestion -> injection
gewarren Feb 13, 2025
277688d
Merge pull request #460 from gewarren/patch-3
sophialagerkranspandey Feb 13, 2025
e397edf
Merge pull request #459 from gewarren/patch-2
sophialagerkranspandey Feb 13, 2025
9cbc014
Merge pull request #458 from gewarren/sync
sophialagerkranspandey Feb 13, 2025
00900dc
Merge pull request #461 from MicrosoftDocs/main
sophialagerkranspandey Feb 13, 2025
3465088
Include links to repo code.
moonbox3 Feb 14, 2025
a2d9cd0
Remove fixed locale from link
moonbox3 Feb 14, 2025
40075fb
Fix python sample resource link
moonbox3 Feb 14, 2025
4bea51e
Use site relative links for learn site links. They don't need to be a…
moonbox3 Feb 14, 2025
d635b45
Fix media link
moonbox3 Feb 14, 2025
78ad2e7
Scope link per language
moonbox3 Feb 14, 2025
fa534a9
More cleanup
moonbox3 Feb 14, 2025
7666b33
Add prompt template config import. Remove view from link in Python co…
moonbox3 Feb 16, 2025
c03c058
Updates to callout reserved param names with Python function calling.
moonbox3 Feb 17, 2025
039d3cd
updated filters page
eavanvalkenburg Feb 17, 2025
6ddea4c
Merge pull request #457 from moonbox3/update-py-sample-code
moonbox3 Feb 17, 2025
39f9534
Python: merge Python docs updates from live to main (#464)
moonbox3 Feb 17, 2025
ae1e457
Merge branch 'main' into py-processes-how-to
moonbox3 Feb 17, 2025
84cf4bd
Add Python processes sample code.
moonbox3 Feb 17, 2025
03244ed
fixed headings
eavanvalkenburg Feb 18, 2025
4f90961
removed heading
eavanvalkenburg Feb 18, 2025
fa77efc
added notes on ordering
eavanvalkenburg Feb 18, 2025
26e2b72
try inline zone
eavanvalkenburg Feb 18, 2025
436e9cc
fix bullet
eavanvalkenburg Feb 18, 2025
9c91c54
single line zone
eavanvalkenburg Feb 18, 2025
9d59fc2
small text updates
eavanvalkenburg Feb 18, 2025
4043083
added new sample links
eavanvalkenburg Feb 19, 2025
c408c4f
fix indentation
eavanvalkenburg Feb 19, 2025
7d9f07a
polish
eavanvalkenburg Feb 19, 2025
e70f690
Merge pull request #462 from eavanvalkenburg/filters
sophialagerkranspandey Feb 19, 2025
32f9d84
Merge pull request #466 from MicrosoftDocs/main
sophialagerkranspandey Feb 19, 2025
f0d5d11
Update semantic-kernel/Frameworks/process/examples/example-cycles.md
alliscode Feb 25, 2025
57b1890
Merge pull request #465 from moonbox3/py-processes-how-to
alliscode Feb 25, 2025
b754b73
Update semantic-kernel/Frameworks/process/examples/example-cycles.md
sophialagerkranspandey Feb 25, 2025
1db60e2
Update semantic-kernel/Frameworks/process/examples/example-first-proc…
sophialagerkranspandey Feb 25, 2025
50864c0
Update semantic-kernel/Frameworks/process/examples/example-cycles.md
sophialagerkranspandey Feb 25, 2025
1ba50f2
Merge pull request #467 from MicrosoftDocs/main
sophialagerkranspandey Feb 25, 2025
a97ebdb
OpenAI not Open AI (#468)
eric-urban Feb 26, 2025
20fdca6
Fix unsupported distance functions in samples
westey-m Feb 26, 2025
d7d91a3
updated table
eavanvalkenburg Feb 17, 2025
e5bc203
adding mssing stores
eavanvalkenburg Feb 17, 2025
65270c5
updated a whole bunch
eavanvalkenburg Feb 26, 2025
ed29edc
fixes
eavanvalkenburg Feb 26, 2025
f37d616
initial version of realtime docs
eavanvalkenburg Feb 26, 2025
2891764
extra info in table
eavanvalkenburg Feb 26, 2025
02978db
added link
eavanvalkenburg Feb 26, 2025
fe3433d
Merge pull request #470 from westey-m/fix-distance-func-in-docs
sophialagerkranspandey Feb 26, 2025
558bcd7
Merge pull request #472 from MicrosoftDocs/main
sophialagerkranspandey Feb 26, 2025
26fa909
Update Agent Framework related doc and code samples. Add migration co…
moonbox3 Feb 28, 2025
24962d0
Update Agent Framework related doc and code samples. Add migration co…
moonbox3 Feb 28, 2025
8d59c5c
Update title (#474)
moonbox3 Feb 28, 2025
575b53e
Proper migration guide title
moonbox3 Feb 28, 2025
88646f4
Merge pull request #476 from MicrosoftDocs/merge-live-into-main
moonbox3 Feb 28, 2025
e96632d
Merge main to live: updating Migration Guide title (#477)
moonbox3 Feb 28, 2025
b6343d8
Merge pull request #463 from eavanvalkenburg/memory_python
sophialagerkranspandey Feb 28, 2025
bdb6118
Update semantic-kernel/concepts/vector-store-connectors/out-of-the-bo…
sophialagerkranspandey Feb 28, 2025
3f2fcdb
Update semantic-kernel/concepts/vector-store-connectors/out-of-the-bo…
sophialagerkranspandey Feb 28, 2025
76657f9
Update semantic-kernel/concepts/vector-store-connectors/out-of-the-bo…
sophialagerkranspandey Feb 28, 2025
24c208a
Update semantic-kernel/concepts/vector-store-connectors/out-of-the-bo…
sophialagerkranspandey Feb 28, 2025
91d12bb
Merge pull request #478 from MicrosoftDocs/main
sophialagerkranspandey Feb 28, 2025
4616882
extended docs
eavanvalkenburg Mar 4, 2025
7f46bae
fixed link
eavanvalkenburg Mar 4, 2025
6941538
fixed header
eavanvalkenburg Mar 4, 2025
095cf4c
Merge pull request #471 from eavanvalkenburg/realtime
sophialagerkranspandey Mar 4, 2025
8d55583
Sync fork to branch
crickman Mar 5, 2025
1e2bd83
ChatCompletion tweak
crickman Mar 5, 2025
469b32f
Assistant overview update
crickman Mar 5, 2025
dd3cb77
Update assistant "howto"
crickman Mar 5, 2025
aed7121
Update assistant retrieval with template
crickman Mar 5, 2025
f3e12a0
Merge branch 'main' into repo_sync_working_branch
crickman Mar 5, 2025
092ed5d
Merge pull request #482 from MicrosoftDocs/repo_sync_working_branch
crickman Mar 5, 2025
1d23a87
Merge branch 'main' into agent-framework-updates-shared
crickman Mar 5, 2025
fbaaf72
Update semantic-kernel/concepts/ai-services/realtime.md
sophialagerkranspandey Mar 6, 2025
fcdaeea
Merge pull request #479 from MicrosoftDocs/main
sophialagerkranspandey Mar 6, 2025
fa45498
add some agent language
eavanvalkenburg Mar 6, 2025
d740612
Adding migration guide and making updates to other parts of the docs …
westey-m Mar 6, 2025
b55c451
Adding Hybrid search page
westey-m Mar 6, 2025
1f520a4
Make small improvements to march25 updates
westey-m Mar 6, 2025
eb10199
Improve Python plugin docs part 1
TaoChenOSU Mar 6, 2025
79e8f9c
Updated AzureAIAgent and consistency updates
crickman Mar 6, 2025
588d7a5
Improve Python plugin docs part 2
TaoChenOSU Mar 6, 2025
6dd3777
remove empty line
TaoChenOSU Mar 6, 2025
c001471
Fix errors
crickman Mar 6, 2025
39ef038
Merge pull request #485 from MicrosoftDocs/taochen/improve-python-plu…
sophialagerkranspandey Mar 6, 2025
129c980
Update semantic-kernel/concepts/ai-services/realtime.md
sophialagerkranspandey Mar 6, 2025
6896824
Merge pull request #483 from eavanvalkenburg/realtime_p2
sophialagerkranspandey Mar 6, 2025
108f1b9
Merge pull request #486 from MicrosoftDocs/main
sophialagerkranspandey Mar 6, 2025
b3b3786
Fix link
crickman Mar 7, 2025
fc59523
Cleanup
moonbox3 Mar 7, 2025
3ec294c
update next step actions
moonbox3 Mar 7, 2025
b53ab3e
Merge branch 'main' into vector-store-march25-updates
westey-m Mar 7, 2025
beeb9d1
Add is hybrid supported setting to each connector page
westey-m Mar 7, 2025
c6f9a2d
Add changes page to TOC
westey-m Mar 7, 2025
74f7a7a
Rename migration guide and update custom mapper page
westey-m Mar 7, 2025
0aa0b61
Remove java pieces for qdrant, since it's not supported
westey-m Mar 7, 2025
7809f24
Improve build your own instructions
westey-m Mar 7, 2025
9fd01ca
Update semantic-kernel/Frameworks/agent/agent-templates.md
crickman Mar 7, 2025
34768c3
Update semantic-kernel/Frameworks/agent/chat-completion-agent.md
crickman Mar 7, 2025
6cd0488
Update example namespaces
crickman Mar 7, 2025
21a0f24
Update semantic-kernel/Frameworks/agent/chat-completion-agent.md
crickman Mar 7, 2025
bdcd976
Merge pull request #481 from MicrosoftDocs/agent-framework-updates-sh…
sophialagerkranspandey Mar 7, 2025
b44baf6
Merge pull request #487 from MicrosoftDocs/main
sophialagerkranspandey Mar 7, 2025
96197c2
agent update
sophiapandey Mar 10, 2025
71e0c97
Merge pull request #488 from MicrosoftDocs/main
sophialagerkranspandey Mar 10, 2025
d588100
Update Python API links for agents (#489)
moonbox3 Mar 11, 2025
6b64494
Add missing forward slash (#491)
moonbox3 Mar 11, 2025
7c6ef5d
Update Python API links for agents (#489) (#490)
moonbox3 Mar 11, 2025
f96f665
Update Python Chat Completion Agent sample code (#492)
moonbox3 Mar 11, 2025
b96f06b
Merge main to live - agent framework updates. (#493)
moonbox3 Mar 11, 2025
28f8c3e
Apply suggestions from code review
westey-m Mar 11, 2025
c6fe721
Merge pull request #484 from westey-m/vector-store-march25-updates
sophialagerkranspandey Mar 12, 2025
3ec3d19
Merge pull request #494 from MicrosoftDocs/main
sophialagerkranspandey Mar 12, 2025
3796685
added faiss page and updated pinecone
eavanvalkenburg Mar 13, 2025
8dde11e
toc and some edits
eavanvalkenburg Mar 13, 2025
b78eb15
added faiss link
eavanvalkenburg Mar 13, 2025
5aba9e0
fix GRPC abbr
eavanvalkenburg Mar 13, 2025
9235173
added support matrix for dotnet
eavanvalkenburg Mar 13, 2025
9c49453
removed grpc from dotnet
eavanvalkenburg Mar 13, 2025
5f4148a
clarified embedding setup
eavanvalkenburg Mar 13, 2025
6136683
updated all pages
eavanvalkenburg Mar 13, 2025
5a85021
Merge pull request #495 from eavanvalkenburg/faiss_pinecone
sophialagerkranspandey Mar 13, 2025
0f3e987
Merge pull request #496 from MicrosoftDocs/main
sophialagerkranspandey Mar 13, 2025
f69ff6d
Merging main to live. (#503)
moonbox3 Mar 25, 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
2 changes: 2 additions & 0 deletions semantic-kernel/Frameworks/agent/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
href: chat-completion-agent.md
- name: OpenAI Assistant Agent
href: assistant-agent.md
- name: Azure AI Agent
href: azure-ai-agent.md
- name: Agent Collaboration
href: agent-chat.md
- name: Create an Agent from a Template
Expand Down
23 changes: 19 additions & 4 deletions semantic-kernel/Frameworks/agent/agent-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Agents can either be invoked directly to perform tasks or orchestrated within an

#### Deep Dive:

- [`AzureAIAgent`](./azure-ai-agent.md)
- [`ChatCompletionAgent`](./chat-completion-agent.md)
- [`OpenAIAssistantAgent`](./assistant-agent.md)

Expand All @@ -61,10 +62,23 @@ Agents can either be invoked directly to perform tasks or orchestrated within an
## Agent Exensibility
-->

## Agent Thread

The abstract `AgentThread` class serves as the core abstraction for threads or conversation state.
It abstracts away the different ways in which convesation state may be managed for different agents.

Stateful agent services often store conversation state in the service, and you can interact with it via an id.
Other agents may require the entire chat history to be passed to the agent on each invocation, in which
case the conversation state is managed locally in the application.

Stateful agents typically only work with a matching `AgentThread` implementation, while other types of agents could work with more than one `AgentThread` type.
For example, `AzureAIAgent` requires a matching `AzureAIAgentThread`.
This is because the Azure AI Agent service stores conversations in the service, and requires specific service calls to create a thread and update it.
If a different agent thread type was used with `AzureAIAgent`, no thread would be created in the Azure AI Agent service and invoke calls would fail.

## Agent Chat

The [`AgentChat`](./agent-chat.md) class serves as the foundational component that enables agents of any type to engage in a specific conversation. This class provides the essential capabilities for managing agent interactions within a chat environment. Building on this, the [`AgentGroupChat`](./agent-chat.md#creating-an-agentgroupchat) class extends these capabilities by offering a stategy-based container, which allows multiple agents to collaborate across numerous interactions within the same conversation.
The [`AgentChat`](./agent-chat.md) class serves as the foundational component that enables agents of any type to engage in a specific conversation. This class provides the essential capabilities for managing agent interactions within a chat environment. Building on this, the [`AgentGroupChat`](./agent-chat.md#creating-an-agentgroupchat) class extends these capabilities by offering a stategy-based container, which allows multiple agents to collaborate across numerous interactions within the same conversation.

This structure facilitates more complex, multi-agent scenarios where different agents can work together, share information, and dynamically respond to evolving conversations, making it an ideal solution for advanced use cases such as customer support, multi-faceted task management, or collaborative problem-solving environments.

Expand Down Expand Up @@ -94,7 +108,7 @@ The _Agent Channel_ class enables agents of various types to participate in an [

::: zone-end

## Agent Alignment with _Semantic Kernel_ Features
## Agent Alignment with Semantic Kernel Features

The `Agent Framework` is built on the foundational concepts and features that many developers have come to know within the _Semantic Kernel_ ecosystem. These core principles serve as the building blocks for the Agent Framework’s design. By leveraging the familiar structure and capabilities of the _Semantic Kernel_, the Agent Framework extends its functionality to enable more advanced, autonomous agent behaviors, while maintaining consistency with the broader _Semantic Kernel_ architecture. This ensures a smooth transition for developers, allowing them to apply their existing knowledge to create intelligent, adaptable agents within the framework.

Expand All @@ -103,8 +117,9 @@ The `Agent Framework` is built on the foundational concepts and features that ma

At the heart of the Semantic Kernel ecosystem is the [`Kernel`](../../concepts/kernel.md), which serves as the core object that drives AI operations and interactions. To create any agent within this framework, a _Kernel instance_ is required as it provides the foundational context and capabilities for the agent’s functionality. The `Kernel` acts as the engine for processing instructions, managing state, and invoking the necessary AI services that power the agent's behavior.

The [`ChatCompletionAgent`](./chat-completion-agent.md) and [`OpenAIAssistantAgent`](./assistant-agent.md) articles provide specific details on how to create each type of agent.
These resources offer step-by-step instructions and highlight the key configurations needed to tailor the agents to different conversational or task-based applications, demonstrating how the Kernel enables dynamic and intelligent agent behaviors across diverse use cases.
The [`AzureAIAgent`](./azure-ai-agent.md), [`ChatCompletionAgent`](./chat-completion-agent.md) and [`OpenAIAssistantAgent`](./assistant-agent.md) articles provide specific details on how to create each type of agent.

These resources offer step-by-step instructions and highlight the key configurations needed to tailor the agents to different conversational or task-based applications, demonstrating how the Kernel enables dynamic and intelligent agent behaviors across diverse use cases.

#### Related API's:

Expand Down
4 changes: 2 additions & 2 deletions semantic-kernel/Frameworks/agent/agent-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Detailed API documentation related to this discussion is available at:

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

- [`agent_chat`](/python/api/semantic-kernel/semantic_kernel.agents.group_chat.agent_chat)
- [`agent_group_chat`](/python/api/semantic-kernel/semantic_kernel.agents.group_chat.agent_group_chat)
- [`AgentChat`](/python/api/semantic-kernel/semantic_kernel.agents.group_chat.agent_chat.agentchat)
- [`AgentGroupChat`](/python/api/semantic-kernel/semantic_kernel.agents.group_chat.agent_group_chat.agentgroupchat)

::: zone-end

Expand Down
62 changes: 38 additions & 24 deletions semantic-kernel/Frameworks/agent/agent-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,42 +58,49 @@ The `Agent Framework` supports _streamed_ responses when using [`AgentChat`](./a

### Streamed response from `ChatCompletionAgent`

When invoking a streamed response from a [`ChatCompletionAgent`](./chat-completion-agent.md), the `ChatHistory` is updated after the full response is received. Although the response is streamed incrementally, the history records only the complete message. This ensures that the `ChatHistory` reflects fully formed responses for consistency.
When invoking a streamed response from a [`ChatCompletionAgent`](./chat-completion-agent.md), the `ChatHistory` in the `AgentThread` is updated after the full response is received. Although the response is streamed incrementally, the history records only the complete message. This ensures that the `ChatHistory` reflects fully formed responses for consistency.

::: zone pivot="programming-language-csharp"
```csharp
// Define agent
ChatCompletionAgent agent = ...;

// Create a ChatHistory object to maintain the conversation state.
ChatHistory chat = [];
ChatHistoryAgentThread agentThread = new();

// Add a user message to the conversation
chat.Add(new ChatMessageContent(AuthorRole.User, "<user input>"));
// Create a user message
var message = ChatMessageContent(AuthorRole.User, "<user input>");

// Generate the streamed agent response(s)
await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsync(chat))
await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsync(message, agentThread))
{
// Process streamed response(s)...
}

// It's also possible to read the messages that were added to the ChatHistoryAgentThread.
await foreach (ChatMessageContent response in agentThread.GetMessagesAsync())
{
// Process messages...
}
```
::: zone-end

::: zone pivot="programming-language-python"
```python
from semantic_kernel.agents import ChatCompletionAgent, ChatHistoryAgentThread

# Define agent
agent = ChatCompletionAgent(...)

# Create a ChatHistory object to maintain the conversation state.
chat = ChatHistory()

# Add a user message to the conversation
chat.add_message(ChatMessageContent(AuthorRole.USER, "<user input>"))
# Create a thread object to maintain the conversation state.
# If no thread is provided one will be created and returned with
# the initial response.
thread: ChatHistoryAgentThread = None

# Generate the streamed agent response(s)
async for response in agent.invoke_stream(chat)
async for response in agent.invoke_stream(messages="user input", thread=thread)
{
# Process streamed response(s)...
thread = response.thread
}
```
::: zone-end
Expand All @@ -106,44 +113,51 @@ async for response in agent.invoke_stream(chat)

### Streamed response from `OpenAIAssistantAgent`

When invoking a streamed response from an [`OpenAIAssistantAgent`](./assistant-agent.md), an optional `ChatHistory` can be provided to capture the complete messages for further analysis if needed. Since the assistant maintains the conversation state as a remote thread, capturing these messages is not always necessary. The decision to store and analyze the full response depends on the specific requirements of the interaction.
When invoking a streamed response from an [`OpenAIAssistantAgent`](./assistant-agent.md), the assistant maintains the conversation state as a remote thread. It is possible to read the messages from the remote thread if required.

::: zone pivot="programming-language-csharp"
```csharp
// Define agent
OpenAIAssistantAgent agent = ...;

// Create a thread for the agent conversation.
string threadId = await agent.CreateThreadAsync();
OpenAIAssistantAgentThread agentThread = new(assistantClient);

// Add a user message to the conversation
chat.Add(threadId, new ChatMessageContent(AuthorRole.User, "<user input>"));
// Cerate a user message
var message = new ChatMessageContent(AuthorRole.User, "<user input>");

// Generate the streamed agent response(s)
await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsync(threadId))
await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsync(message, agentThread))
{
// Process streamed response(s)...
}

// It's possible to read the messages from the remote thread.
await foreach (ChatMessageContent response in agentThread.GetMessagesAsync())
{
// Process messages...
}

// Delete the thread when it is no longer needed
await agent.DeleteThreadAsync(threadId);
await agentThread.DeleteAsync();
```
::: zone-end

::: zone pivot="programming-language-python"
```python
from semantic_kernel.agents import AssistantAgentThread, AzureAssistantAgent, OpenAIAssistantAgent
# Define agent
agent = OpenAIAssistantAgent(...)
agent = OpenAIAssistantAgent(...) # or = AzureAssistantAgent(...)

# Create a thread for the agent conversation.
thread_id = await agent.create_thread()

# Add user message to the conversation
await agent.add_chat_message(message="<user input>")
# If no thread is provided one will be created and returned with
# the initial response.
thread: AssistantAgentThread = None

# Generate the streamed agent response(s)
async for response in agent.invoke_stream(thread_id=thread_id):
async for response in agent.invoke_stream(messages="user input", thread=thread):
# Process streamed response(s)...
thread = response.thread
```
::: zone-end

Expand Down
56 changes: 29 additions & 27 deletions semantic-kernel/Frameworks/agent/agent-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ ChatCompletionAgent agent =

::: zone pivot="programming-language-python"
```python
kernel = Kernel()

agent = ChatCompletionAgent(
kernel=kernel,
service=AzureChatCompletion(), # or other supported AI Services
name="StoryTeller",
instructions="Tell a story about {{$topic}} that is {{$length}} sentences long.",
arguments=KernelArguments(topic="Dog", length="2"),
Expand All @@ -100,24 +98,34 @@ Templated instructions are especially powerful when working with an [`OpenAIAssi
::: zone pivot="programming-language-csharp"
```csharp
// Retrieve an existing assistant definition by identifier
OpenAIAssistantAgent agent =
await OpenAIAssistantAgent.RetrieveAsync(
this.GetClientProvider(),
"<stored agent-identifier>",
new Kernel(),
new KernelArguments()
{
{ "topic", "Dog" },
{ "length", "3" },
});
AzureOpenAIClient client = OpenAIAssistantAgent.CreateAzureOpenAIClient(new AzureCliCredential(), new Uri("<your endpoint>"));
AssistantClient assistantClient = client.GetAssistantClient();
Assistant assistant = await client.GetAssistantAsync();
OpenAIAssistantAgent agent = new(assistant, assistantClient, new KernelPromptTemplateFactory(), PromptTemplateConfig.SemanticKernelTemplateFormat)
{
Arguments = new KernelArguments()
{
{ "topic", "Dog" },
{ "length", "3" },
}
}
```
::: zone-end

::: zone pivot="programming-language-python"
```python
agent = await OpenAIAssistantAgent.retrieve(
id=<assistant_id>,
kernel=Kernel(),
# Create the client using Azure OpenAI resources and configuration
client, model = AzureAssistantAgent.setup_resources()

# Retrieve the assistant definition from the server based on the assistant ID
definition = await client.beta.assistants.retrieve(
assistant_id="your-assistant-id",
)

# Create the AzureAssistantAgent instance using the client and the assistant definition
agent = AzureAssistantAgent(
client=client,
definition=definition,
arguments=KernelArguments(topic="Dog", length="3"),
)
```
Expand All @@ -130,10 +138,9 @@ agent = await OpenAIAssistantAgent.retrieve(
::: zone-end


## Agent Definition from a _Prompt Template_

The same _Prompt Template Config_ used to create a _Kernel Prompt Function_ can also be leveraged to define an agent. This allows for a unified approach in managing both prompts and agents, promoting consistency and reuse across different components. By externalizing agent definitions from the codebase, this method simplifies the management of multiple agents, making them easier to update and maintain without requiring changes to the underlying logic. This separation also enhances flexibility, enabling developers to modify agent behavior or introduce new agents by simply updating the configuration, rather than adjusting the code itself.
## Agent Definition from a Prompt Template

The same Prompt Template Config used to create a Kernel Prompt Function can also be leveraged to define an agent. This allows for a unified approach in managing both prompts and agents, promoting consistency and reuse across different components. By externalizing agent definitions from the codebase, this method simplifies the management of multiple agents, making them easier to update and maintain without requiring changes to the underlying logic. This separation also enhances flexibility, enabling developers to modify agent behavior or introduce new agents by simply updating the configuration, rather than adjusting the code itself.
#### YAML Template

```yaml
Expand Down Expand Up @@ -192,7 +199,7 @@ data = yaml.safe_load(generate_story_yaml)
prompt_template_config = PromptTemplateConfig(**data)

agent = ChatCompletionAgent(
kernel=_create_kernel_with_chat_completion(),
service=AzureChatCompletion(), # or other supported AI services
prompt_template_config=prompt_template_config,
arguments=KernelArguments(topic="Dog", length="3"),
)
Expand Down Expand Up @@ -228,9 +235,6 @@ ChatCompletionAgent agent =
}
};

// Create a ChatHistory object to maintain the conversation state.
ChatHistory chat = [];

KernelArguments overrideArguments =
new()
{
Expand All @@ -239,7 +243,7 @@ KernelArguments overrideArguments =
});

// Generate the agent response(s)
await foreach (ChatMessageContent response in agent.InvokeAsync(chat, overrideArguments))
await foreach (ChatMessageContent response in agent.InvokeAsync([], options: new() { KernelArguments = overrideArguments }))
{
// Process agent response(s)...
}
Expand All @@ -249,10 +253,8 @@ await foreach (ChatMessageContent response in agent.InvokeAsync(chat, overrideAr
::: zone pivot="programming-language-python"

```python
kernel = Kernel()

agent = ChatCompletionAgent(
kernel=kernel,
service=AzureChatCompletion(),
name="StoryTeller",
instructions="Tell a story about {{$topic}} that is {{$length}} sentences long.",
arguments=KernelArguments(topic="Dog", length="2"),
Expand Down
Loading