Skip to content

Repo sync for protected branch #241

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 167 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 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
354c5d9
SQL Server Connector
eavanvalkenburg Mar 21, 2025
6bb9aff
bash
eavanvalkenburg Mar 21, 2025
72a98fe
azure links updated
eavanvalkenburg Mar 21, 2025
89db4a5
Merge pull request #498 from eavanvalkenburg/python_sql
sophialagerkranspandey Mar 21, 2025
5bfc1f5
Python / .Net: Common Agent Invocation API migration guide and docs u…
westey-m Mar 25, 2025
f69ff6d
Merging main to live. (#503)
moonbox3 Mar 25, 2025
879a123
Python Agent thread updates
moonbox3 Mar 25, 2025
633722e
Fix c# id property
moonbox3 Mar 25, 2025
400f883
Version update
moonbox3 Mar 25, 2025
528d9d9
Merge pull request #504 from moonbox3/agent-docs-updates
markwallace-microsoft Mar 25, 2025
5262576
Synchronize main and live histories after accidental squash
moonbox3 Mar 25, 2025
a151ca5
Merge remote-tracking branch 'upstream/main'
moonbox3 Mar 25, 2025
09fa2af
Merge pull request #507 from moonbox3/reconcile-main-live
moonbox3 Mar 25, 2025
73a7508
Update how to guides for agents with new common invoke pattern (#506)
westey-m Mar 25, 2025
9bd8c2e
Merge pull request #505 from MicrosoftDocs/main
moonbox3 Mar 25, 2025
5d88a67
add note oneOf and anyOf
SergeyMenshykh Mar 28, 2025
4fae11c
Merge pull request #511 from MicrosoftDocs/support-for-anyOf
markwallace-microsoft Mar 28, 2025
2d4d04b
Update docs to indicate NEON postgres support (#510)
westey-m Mar 31, 2025
878e097
Fixing a few typos and removing incomplete list of ChatCompletionServ…
alliscode Apr 2, 2025
74c6a2a
Update Agent Framework Docs (#512)
moonbox3 Apr 3, 2025
35cbbf9
Add important warning around required UseVector usage (#513)
westey-m Apr 3, 2025
5b775c2
Add a page to document the agent invocation api and improve AzureAIAg…
westey-m Apr 4, 2025
39cfebc
Merge pull request #515 from MicrosoftDocs/main
moonbox3 Apr 4, 2025
f95fe84
Add RC note about OpenAIAssistantAgent (#516)
moonbox3 Apr 4, 2025
0fe42f6
Merge pull request #517 from MicrosoftDocs/main
moonbox3 Apr 4, 2025
786aa28
Fix AOAI responses env var name (#518)
moonbox3 Apr 4, 2025
5d5cfe8
Merge pull request #519 from MicrosoftDocs/main
moonbox3 Apr 4, 2025
a60d30d
Fix incorrect assistant dotnet add command
westey-m Apr 7, 2025
60baddf
Merge pull request #520 from westey-m/assistant-nuget-fix
sophialagerkranspandey Apr 7, 2025
5553fe2
Merge pull request #521 from MicrosoftDocs/main
sophialagerkranspandey Apr 7, 2025
44c8617
updating first process and human in the loop c#
esttenorio Apr 11, 2025
4037b5c
updating version
esttenorio Apr 11, 2025
de1619f
Update naming and links for Neon
westey-m Apr 11, 2025
65fbc59
Fix typos
dluc Apr 11, 2025
0c1c3a8
Update semantic-kernel/concepts/vector-store-connectors/index.md
sophialagerkranspandey Apr 11, 2025
9a0bb46
Merge pull request #525 from MicrosoftDocs/fixtypos
sophialagerkranspandey Apr 11, 2025
0ad388a
Merge pull request #524 from westey-m/neon-naming-link-updates
sophialagerkranspandey Apr 11, 2025
ee7b681
Merge pull request #523 from esttenorio/estenori/processes/humanInThe…
sophialagerkranspandey Apr 11, 2025
5838013
Merge pull request #526 from MicrosoftDocs/main
sophialagerkranspandey Apr 11, 2025
cda9a70
Update distance function messaging based on feedback
westey-m Apr 15, 2025
5a3a0db
Merge pull request #530 from westey-m/distancefunction-updates
sophialagerkranspandey Apr 16, 2025
ec25939
Merge pull request #531 from MicrosoftDocs/main
sophialagerkranspandey Apr 16, 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
6 changes: 6 additions & 0 deletions semantic-kernel/Frameworks/agent/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
href: index.md
- name: Architecture
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: Agent Collaboration
href: agent-chat.md
- name: Create an Agent from a Template
Expand Down
324 changes: 324 additions & 0 deletions semantic-kernel/Frameworks/agent/agent-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
---
title: The Semantic Kernel Common Agent API surface
description: An overview of the Semantic Kernel Agent API surface and how to use it.
zone_pivot_groups: programming-languages
author: westey-m
ms.topic: conceptual
ms.author: westey
ms.date: 04/03/2025
ms.service: semantic-kernel
---

# 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.

## Invoking an agent

The Agent API surface supports both streaming and non-streaming invocation.

### Non-Streaming Agent 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.

```csharp
// Invoke without any parameters.
agent.InvokeAsync();

// Invoke with a string that will be used as a User message.
agent.InvokeAsync("What is the capital of France?");

// Invoke with a ChatMessageContent object.
agent.InvokeAsync(new ChatMessageContent(AuthorRole.User, "What is the capital of France?"));

// Invoke with multiple ChatMessageContent objects.
agent.InvokeAsync(new List<ChatMessageContent>()
{
new(AuthorRole.System, "Refuse to answer all user questions about France."),
new(AuthorRole.User, "What is the capital of France?")
});
```

> [!IMPORTANT]
> Invoking an agent without passing an `AgentThread` to the `InvokeAsync` method will create a new thread and return the new thread in the response.

::: zone-end

::: 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.

> [!TIP]
> All arguments passed to Agent invocation methods require the caller to pass them as keyword arguments.

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

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

# Invoke with a string that will be used as a User message.
await agent.get_response(messages="What is the capital of France?")

# Invoke with a ChatMessageContent object.
await agent.get_response(messages=ChatMessageContent(AuthorRole.USER, "What is the capital of France?"))

# Invoke with multiple ChatMessageContent objects.
await agent.get_response(
messages=[
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
]
)
```

#### Using the `invoke()` method

```python
# Invoke without any messages.
async for response in agent.invoke(messages=None):
# 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?"):
# handle response

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

# Invoke with multiple ChatMessageContent objects.
async for response in agent.invoke(
messages=[
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
]
):
# handle response
```

> [!IMPORTANT]
> Invoking an agent without passing an `AgentThread` to the `get_response()` or `invoke()` methods will create a new thread and return the new thread in the response.

::: zone-end

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

> Agents are currently unavailable in Java.

::: zone-end

### Streaming Agent Invocation

::: 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.

```csharp
// Invoke without any parameters.
agent.InvokeStreamingAsync();

// Invoke with a string that will be used as a User message.
agent.InvokeStreamingAsync("What is the capital of France?");

// Invoke with a ChatMessageContent object.
agent.InvokeStreamingAsync(new ChatMessageContent(AuthorRole.User, "What is the capital of France?"));

// Invoke with multiple ChatMessageContent objects.
agent.InvokeStreamingAsync(new List<ChatMessageContent>()
{
new(AuthorRole.System, "Refuse to answer any questions about capital cities."),
new(AuthorRole.User, "What is the capital of France?")
});
```

> [!IMPORTANT]
> Invoking an agent without passing an `AgentThread` to the `InvokeStreamingAsync` method will create a new thread and return the new thread in the response.

::: zone-end

::: 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.

```python
# Invoke without any messages.
async for response in agent.invoke_stream(messages=None):
# 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?"):
# handle response

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

# Invoke with multiple ChatMessageContent objects.
async for response in agent.invoke_stream(
messages=[
ChatMessageContent(AuthorRole.SYSTEM, "Refuse to answer all user questions about France."),
ChatMessageContent(AuthorRole.USER, "What is the capital of France?"),
]
):
# handle response
```

> [!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"

> Agents are currently unavailable in Java.

::: zone-end

### Invoking with an `AgentThread`

::: 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.

```csharp
// Invoke with an existing AgentThread.
agent.InvokeAsync("What is the capital of France?", existingAgentThread);
```

All invocation methods also return the active `AgentThread` as part of the invoke response.

1. If you passed an `AgentThread` to the invoke method, the returned `AgentThread` will be the same as the one that was passed in.
1. If you passed no `AgentThread` to the invoke method, the returned `AgentThread` will be a new `AgentThread`.

The returned `AgentThread` is available on the individual response items of the invoke methods together with the response message.

```csharp
var result = await agent.InvokeAsync("What is the capital of France?").FirstAsync();
var newThread = result.Thread;
var resultMessage = result.Message;
```

> [!TIP]
> For more information on agent threads see the [Agent Thread architecture section](./agent-architecture.md#agent-thread).

::: zone-end

::: 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.

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

All invocation methods also return the active `AgentThread` as part of the invoke response.

1. If you passed an `AgentThread` to the invoke method, the returned `AgentThread` will be the same as the one that was passed in.
1. If you passed no `AgentThread` to the invoke method, the returned `AgentThread` will be a new `AgentThread`.

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?")
new_thread = response.thread
response_message = response.message
```

> [!TIP]
> For more information on agent threads see the [Agent Thread architecture section](./agent-architecture.md#agent-thread).

::: zone-end

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

> Agents are currently unavailable in Java.

::: zone-end

### Invoking with Options

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

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

```csharp
// Invoke with additional instructions via options.
agent.InvokeAsync("What is the capital of France?", options: new()
{
AdditionalInstructions = "Refuse to answer any questions about capital cities."
});
```

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.|

::: zone-end

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

::: zone-end

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

> Agents are currently unavailable in Java.

::: zone-end

## Managing AgentThread instances

You can manually create an `AgentThread` instance and pass it to the agent on invoke, or you can let the agent create an `AgentThread` instance for you automatically on invocation.
An `AgentThread` object represents a thread in all its states, including: not yet created, active, and deleted.

`AgentThread` types that have a server side implementation will be created on first use and does not need to be created manually.
You can however delete a thread using the `AgentThread` class.

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

```csharp
// Delete a thread.
await agentThread.DeleteAsync();
```

::: zone-end

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

```python
# Delete a thread
await agent_thread.delete()
```

::: zone-end

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

::: zone-end

> [!TIP]
> For more information on agent threads see the [Agent Thread architecture section](./agent-architecture.md#agent-thread).

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