|
1 | | -# Foundry Chat Client Examples |
| 1 | +# Foundry Agent Examples |
2 | 2 |
|
3 | | -This folder contains examples demonstrating different ways to use the `FoundryChatClient` from the `agent_framework.foundry` package. |
| 3 | +This folder contains examples demonstrating different ways to create and use agents with the Foundry chat client from the `agent_framework.foundry` package. |
4 | 4 |
|
5 | 5 | ## Examples |
6 | 6 |
|
7 | | -### 1. `foundry_basic.py` |
8 | | -The simplest way to use FoundryChatClient. It automatically handles all configuration using environment variables. |
9 | | - |
10 | | -### 2. `foundry_with_explicit_settings.py` |
11 | | -Shows how to explicitly configure the FoundryChatClient with custom settings, including project endpoint, model deployment, credentials, and agent name. |
12 | | - |
13 | | -### 3. `foundry_with_existing_client.py` |
14 | | -Demonstrates how to use an existing `AIProjectClient` instance with FoundryChatClient, giving you more control over the underlying Azure AI client. |
15 | | - |
16 | | -### 4. `foundry_with_existing_agent.py` |
17 | | -Shows how to work with a pre-existing agent by providing the agent ID to FoundryChatClient. This example also demonstrates proper cleanup of manually created agents. |
| 7 | +| File | Description | |
| 8 | +|------|-------------| |
| 9 | +| [`foundry_basic.py`](foundry_basic.py) | The simplest way to create an agent using `ChatClientAgent` with `FoundryChatClient`. It automatically handles all configuration using environment variables. | |
| 10 | +| [`foundry_with_explicit_settings.py`](foundry_with_explicit_settings.py) | Shows how to create an agent with explicitly configured `FoundryChatClient` settings, including project endpoint, model deployment, credentials, and agent name. | |
| 11 | +| [`foundry_with_existing_agent.py`](foundry_with_existing_agent.py) | Shows how to work with a pre-existing agent by providing the agent ID to the Foundry chat client. This example also demonstrates proper cleanup of manually created agents. | |
| 12 | +| [`foundry_with_function_tools.py`](foundry_with_function_tools.py) | Demonstrates how to use function tools with agents. Shows both agent-level tools (defined when creating the agent) and query-level tools (provided with specific queries). | |
| 13 | +| [`foundry_with_code_interpreter.py`](foundry_with_code_interpreter.py) | Shows how to use the HostedCodeInterpreterTool with Foundry agents to write and execute Python code. Includes helper methods for accessing code interpreter data from response chunks. | |
| 14 | +| [`foundry_with_thread.py`](foundry_with_thread.py) | Demonstrates thread management with Foundry agents, including automatic thread creation for stateless conversations and explicit thread management for maintaining conversation context across multiple interactions. | |
18 | 15 |
|
19 | 16 | ## Environment Variables |
20 | 17 |
|
21 | 18 | Make sure to set the following environment variables before running the examples: |
22 | 19 |
|
23 | 20 | - `FOUNDRY_PROJECT_ENDPOINT`: Your Azure AI Foundry project endpoint |
24 | 21 | - `FOUNDRY_MODEL_DEPLOYMENT_NAME`: The name of your model deployment |
25 | | - |
26 | | -## Running the Examples |
27 | | - |
28 | | -Each example can be run independently: |
29 | | - |
30 | | -```bash |
31 | | -# Run the basic example |
32 | | -python samples/getting_started/agents/foundry/foundry_basic.py |
33 | | - |
34 | | -# Run the explicit settings example |
35 | | -python samples/getting_started/agents/foundry/foundry_with_explicit_settings.py |
36 | | - |
37 | | -# Run the existing client example |
38 | | -python samples/getting_started/agents/foundry/foundry_with_existing_client.py |
39 | | - |
40 | | -# Run the existing agent example |
41 | | -python samples/getting_started/agents/foundry/foundry_with_existing_agent.py |
42 | | -``` |
43 | | - |
44 | | -All examples use the same weather tool function that returns mock weather data. |
0 commit comments