You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-ref-services/preview/ai-agents-readme.md
+12-21Lines changed: 12 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
2
title: Azure AI Agents client library for Python
3
3
keywords: Azure, python, SDK, API, azure-ai-agents, ai
4
-
ms.date: 05/13/2025
4
+
ms.date: 05/14/2025
5
5
ms.topic: reference
6
6
ms.devlang: python
7
7
ms.service: ai
8
8
---
9
9
<!-- PIPY LONG DESCRIPTION BEGIN -->
10
-
# Azure AI Agents client library for Python - version 1.0.0b2
10
+
# Azure AI Agents client library for Python - version 1.0.0b3
11
11
12
12
13
13
Use the AI Agents client library (in preview) to:
@@ -380,9 +380,9 @@ for message in messages:
380
380
381
381
You can enhance your Agents by defining callback functions as function tools. These can be provided to `create_agent` via either the `toolset` parameter or the combination of `tools` and `tool_resources`. Here are the distinctions:
382
382
383
-
For more details about requirements and specification of functions, refer to [Function Tool Specifications](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/FunctionTool.md)
383
+
For more details about requirements and specification of functions, refer to [Function Tool Specifications](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/FunctionTool.md)
384
384
385
-
Here is an example to use [user functions](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples/agents/user_functions.py) in `toolset`:
385
+
Here is an example to use [user functions](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples/agents/user_functions.py) in `toolset`:
For asynchronous functions, you must import `AgentsClient` from `azure.ai.agents.aio` and use `AsyncFunctionTool`. Here is an example using [asynchronous user functions](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples/agents/async_samples/user_async_functions.py):
404
+
For asynchronous functions, you must import `AgentsClient` from `azure.ai.agents.aio` and use `AsyncFunctionTool`. Here is an example using [asynchronous user functions](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples/agents/async_samples/user_async_functions.py):
Notice that if `enable_auto_function_calls` is called, the SDK will invoke the functions automatically during `create_and_process` or streaming. If you prefer to execute them manually, refer to [`sample_agents_stream_eventhandler_with_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_functions.py) or
Notice that if `enable_auto_function_calls` is called, the SDK will invoke the functions automatically during `create_and_process` or streaming. If you prefer to execute them manually, refer to [`sample_agents_stream_eventhandler_with_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_functions.py) or
To process your message, you can use `runs.create`, `runs.create_and_process`, or `runs.stream`.
894
894
895
-
`create_run` requests the Agent to process the message without polling for the result. If you are using `function tools` regardless as `toolset` or not, your code is responsible for polling for the result and acknowledging the status of `Run`. When the status is `requires_action`, your code is responsible for calling the function tools. For a code sample, visit [`sample_agents_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions.py).
895
+
`create_run` requests the Agent to process the message without polling for the result. If you are using `function tools` regardless as `toolset` or not, your code is responsible for polling for the result and acknowledging the status of `Run`. When the status is `requires_action`, your code is responsible for calling the function tools. For a code sample, visit [`sample_agents_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions.py).
896
896
897
897
Here is an example of `runs.create` and poll until the run is completed:
898
898
@@ -1004,7 +1004,7 @@ with agents_client.runs.stream(thread_id=thread.id, agent_id=agent.id, event_han
1004
1004
1005
1005
<!-- END SNIPPET -->
1006
1006
1007
-
As you can see, this SDK parses the events and produces various event types similar to OpenAI agents. In your use case, you might not be interested in handling all these types and may decide to parse the events on your own. To achieve this, please refer to [override base event handler](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_with_base_override_eventhandler.py).
1007
+
As you can see, this SDK parses the events and produces various event types similar to OpenAI agents. In your use case, you might not be interested in handling all these types and may decide to parse the events on your own. To achieve this, please refer to [override base event handler](https://github.com/Azure/azure-sdk-for-python/blob/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_with_base_override_eventhandler.py).
1008
1008
1009
1009
```
1010
1010
Note: Multiple streaming processes may be chained behind the scenes.
@@ -1152,15 +1152,6 @@ from azure.monitor.opentelemetry import configure_azure_monitor
print(f"Could not call `AIAgentsInstrumentor().instrument()`. Exception: {exc}")
1163
-
1164
1155
scenario = os.path.basename(__file__)
1165
1156
tracer = trace.get_tracer(__name__)
1166
1157
@@ -1243,7 +1234,7 @@ To report an issue with the client library, or request additional features, plea
1243
1234
1244
1235
## Next steps
1245
1236
1246
-
Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-agents_1.0.0b2/sdk/ai/azure-ai-projects/samples) folder, containing fully runnable Python code for synchronous and asynchronous clients.
1237
+
Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-agents_1.0.0b3/sdk/ai/azure-ai-projects/samples) folder, containing fully runnable Python code for synchronous and asynchronous clients.
1247
1238
1248
1239
Explore the [AI Starter Template](https://aka.ms/azsdk/azure-ai-projects/python/ai-starter-template). This template creates an Azure AI Foundry hub, project and connected resources including Azure OpenAI Service, AI Search and more. It also deploys a simple chat application to Azure Container Apps.
1249
1240
@@ -1268,9 +1259,9 @@ additional questions or comments.
0 commit comments