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
source venv/bin/activate # On Windows: venv\Scripts\activate
78
+
python -m venv .venv
79
+
source.venv/bin/activate # On Windows: .venv\Scripts\activate
77
80
```
78
81
79
82
4. Install the requirements:
@@ -82,63 +85,11 @@ A related option is VS Code Dev Containers, which will open the project in your
82
85
pip install -r requirements.txt
83
86
```
84
87
85
-
## Running the Python examples
86
-
87
-
You can run the examples in this repository by executing the scripts in the `examples` directory. Each script demonstrates a different AI agent pattern or framework.
88
-
89
-
### Microsoft Agent Framework
90
-
91
-
| Example | Description |
92
-
| ------- | ----------- |
93
-
| [agentframework_basic.py](examples/agentframework_basic.py) | Uses Agent Framework to build a basic informational agent. |
94
-
| [agentframework_tool.py](examples/agentframework_tool.py) | Uses Agent Framework to build an agent with a single weather tool. |
95
-
| [agentframework_tools.py](examples/agentframework_tools.py) | Uses Agent Framework to build a weekend planning agent with multiple tools. |
96
-
| [agentframework_supervisor.py](examples/agentframework_supervisor.py) | Uses Agent Framework with a supervisor orchestrating activity and recipe sub-agents. |
97
-
98
-
### Langchain v1 and LangGraph
99
-
100
-
| Example | Description |
101
-
| ------- | ----------- |
102
-
| [langchainv1_basic.py](examples/langchainv1_basic.py) | Uses LangChain v1 to build a basic informational agent. |
103
-
| [langchainv1_tool.py](examples/langchainv1_tool.py) | Uses LangChain v1 to build an agent with a single weather tool. |
104
-
| [langchainv1_tools.py](examples/langchainv1_tools.py) | Uses LangChain v1 to build a weekend planning agent with multiple tools. |
105
-
| [langchainv1_supervisor.py](examples/langchainv1_supervisor.py) | Uses LangChain v1 with a supervisor orchestrating activity and recipe sub-agents. |
106
-
| [langchainv1_quickstart.py](examples/langchainv1_quickstart.py) | Uses LangChain v1 to build an assistant with tool calling, structured output, and memory. Based off official Quickstart docs. |
107
-
| [langchainv1_mcp_github.py](examples/langchainv1_mcp_github.py) | Uses Langchain v1 agent with GitHub MCP server to triage repository issues. |
108
-
| [langchainv1_mcp_http.py](examples/langchainv1_mcp_github.py) | Uses Langchain v1 agent with tools from local MCP HTTP server. |
109
-
| [langgraph_agent.py](examples/langgraph_agent.py) | Builds LangGraph graph for an agent to play songs. |
110
-
| [langgraph_mcp.py](examples/langgraph_mcp.py) | Builds Langgraph graph that uses tools from MCP HTTP server. |
111
-
112
-
### OpenAI and OpenAI-Agents
113
-
114
-
| Example | Description |
115
-
| ------- | ----------- |
116
-
| [openai_githubmodels.py](examples/openai_githubmodels.py) | Basic setup for using GitHub models with the OpenAI API. |
117
-
| [openai_functioncalling.py](examples/openai_functioncalling.py) | Uses OpenAI Function Calling to call functions based on LLM output. |
118
-
| [openai_agents_basic.py](examples/openai_agents_basic.py) | Uses the OpenAI Agents framework to build a single agent. |
119
-
| [openai_agents_handoffs.py](examples/openai_agents_handoffs.py) | Uses the OpenAI Agents framework to handoff between several agents with tools. |
120
-
| [openai_agents_tools.py](examples/openai_agents_tools.py) | Uses the OpenAI Agents framework to build a weekend planner with tools. |
121
-
| [openai_agents_mcp_http.py](examples/openai_agents_mcp_http.py) | Uses the OpenAI Agents framework with an MCP HTTP server (travel planning tools). |
122
-
123
-
### PydanticAI
124
-
125
-
| Example | Description |
126
-
| ------- | ----------- |
127
-
| [pydanticai_basic.py](examples/pydanticai_basic.py) | Uses PydanticAI to build a basic single agent (Spanish tutor). |
128
-
| [pydanticai_multiagent.py](examples/pydanticai_multiagent.py) | Uses PydanticAI to build a two-agent sequential workflow (flight + seat selection). |
129
-
| [pydanticai_graph.py](examples/pydanticai_graph.py) | Uses PydanticAI with pydantic-graph to build a small question/answer evaluation graph. |
130
-
| [pydanticai_tools.py](examples/pydanticai_tools.py) | Uses PydanticAI with multiple Python tools for weekend activity planning. |
131
-
| [pydanticai_mcp_http.py](examples/pydanticai_mcp_http.py) | Uses PydanticAI with an MCP HTTP server toolset for travel planning (hotel search). |
132
-
| [pydanticai_mcp_github.py](examples/pydanticai_mcp_github.py) | Uses PydanticAI with an MCP GitHub server toolset to triage repository issues. |
133
-
134
-
### Other frameworks
88
+
## Configuring model providers
135
89
136
-
| Example | Description |
137
-
| ------- | ----------- |
138
-
| [llamaindex.py](examples/llamaindex.py) | Uses LlamaIndex to build a ReAct agent for RAG on multiple indexes. |
139
-
| [smolagents_codeagent.py](examples/smolagents_codeagent.py) | Uses SmolAgents to build a question-answering agent that can search the web and run code. |
90
+
These examples can be run with Azure OpenAI account, OpenAI.com, local Ollama server, or GitHub models, depending on the environment variables you set. All the scripts reference the environment variables from a `.env` file, and an example `.env.sample` file is provided. Host-specific instructions are below.
140
91
141
-
## Configuring GitHub Models
92
+
## Using GitHub Models
142
93
143
94
If you open this repository in GitHub Codespaces, you can run the scripts forfree using GitHub Models without any additional steps, as your `GITHUB_TOKEN` is already configuredin the Codespaces environment.
144
95
@@ -158,9 +109,9 @@ If you want to run the scripts locally, you need to set up the `GITHUB_TOKEN` en
158
109
export GITHUB_TOKEN=your_personal_access_token
159
110
```
160
111
161
-
10. Optionally, you can use a model other than "gpt-4o" by setting the `GITHUB_MODEL` environment variable. Use a model that supports function calling, such as: `gpt-4o`, `gpt-4o-mini`, `o3-mini`, `AI21-Jamba-1.5-Large`, `AI21-Jamba-1.5-Mini`, `Codestral-2501`, `Cohere-command-r`, `Ministral-3B`, `Mistral-Large-2411`, `Mistral-Nemo`, `Mistral-small`
112
+
10. Optionally, you can use a model other than "gpt-4o" by setting the `GITHUB_MODEL` environment variable. Use a model that supports function calling, such as: `gpt-5`, `gpt-5-mini`, `gpt-4o`, `gpt-4o-mini`, `o3-mini`, `AI21-Jamba-1.5-Large`, `AI21-Jamba-1.5-Mini`, `Codestral-2501`, `Cohere-command-r`, `Ministral-3B`, `Mistral-Large-2411`, `Mistral-Nemo`, `Mistral-small`
162
113
163
-
## Provisioning Azure AI resources
114
+
## Using Azure OpenAI models
164
115
165
116
You can run all examples in this repository using GitHub Models. If you want to run the examples using models from Azure OpenAI instead, you need to provision the Azure AI resources, which will incur costs.
166
117
@@ -195,12 +146,113 @@ This project includes infrastructure as code (IaC) to provision Azure OpenAI dep
195
146
azd down
196
147
```
197
148
149
+
## Using OpenAI.com models
150
+
151
+
1. Create a `.env` file by copying the `.env.sample` file and updating it with your OpenAI API key and desired model name.
152
+
153
+
```bash
154
+
cp .env.sample .env
155
+
```
156
+
157
+
2. Update the `.env` file with your OpenAI API key and desired model name:
158
+
159
+
```bash
160
+
API_HOST=openai
161
+
OPENAI_API_KEY=your_openai_api_key
162
+
OPENAI_MODEL=gpt-4o-mini
163
+
```
164
+
165
+
## Using Ollama models
166
+
167
+
1. Install [Ollama](https://ollama.com/) and follow the instructions to set it up on your local machine.
168
+
2. Pull a model, for example:
169
+
170
+
```shell
171
+
ollama pull qwen3:30b
172
+
```
173
+
174
+
Note that most models do not support tool calling to the extent required by agents frameworks, so choose a model accordingly.
175
+
176
+
3. Create a `.env` file by copying the `.env.sample` file and updating it with your Ollama endpoint and model name.
177
+
178
+
```bash
179
+
cp .env.sample .env
180
+
```
181
+
182
+
4. Update the `.env` file with your Ollama endpoint and model name (any model you've pulled):
183
+
184
+
```bash
185
+
API_HOST=ollama
186
+
OLLAMA_ENDPOINT=http://localhost:11434/v1
187
+
OLLAMA_MODEL=llama3.1
188
+
```
189
+
190
+
## Running the Python examples
191
+
192
+
You can run the examples in this repository by executing the scripts in the `examples` directory. Each script demonstrates a different AI agent pattern or framework.
193
+
194
+
### Microsoft Agent Framework
195
+
196
+
| Example | Description |
197
+
| ------- | ----------- |
198
+
| [agentframework_basic.py](examples/agentframework_basic.py) | Uses Agent Framework to build a basic informational agent. |
199
+
| [agentframework_tool.py](examples/agentframework_tool.py) | Uses Agent Framework to build an agent with a single weather tool. |
200
+
| [agentframework_tools.py](examples/agentframework_tools.py) | Uses Agent Framework to build a weekend planning agent with multiple tools. |
201
+
| [agentframework_supervisor.py](examples/agentframework_supervisor.py) | Uses Agent Framework with a supervisor orchestrating activity and recipe sub-agents. |
202
+
| [agentframework_magenticone.py](examples/agentframework_magenticone.py) | Uses Agent Framework to build a MagenticOne agent. |
203
+
| [agentframework_workflow.py](examples/agentframework_workflow.py) | Uses Agent Framework to build a workflow-based agent. |
204
+
205
+
### Langchain v1 and LangGraph
206
+
207
+
| Example | Description |
208
+
| ------- | ----------- |
209
+
| [langchainv1_basic.py](examples/langchainv1_basic.py) | Uses LangChain v1 to build a basic informational agent. |
210
+
| [langchainv1_tool.py](examples/langchainv1_tool.py) | Uses LangChain v1 to build an agent with a single weather tool. |
211
+
| [langchainv1_tools.py](examples/langchainv1_tools.py) | Uses LangChain v1 to build a weekend planning agent with multiple tools. |
212
+
| [langchainv1_supervisor.py](examples/langchainv1_supervisor.py) | Uses LangChain v1 with a supervisor orchestrating activity and recipe sub-agents. |
213
+
| [langchainv1_quickstart.py](examples/langchainv1_quickstart.py) | Uses LangChain v1 to build an assistant with tool calling, structured output, and memory. Based off official Quickstart docs. |
214
+
| [langchainv1_mcp_github.py](examples/langchainv1_mcp_github.py) | Uses Langchain v1 agent with GitHub MCP server to triage repository issues. |
215
+
| [langchainv1_mcp_http.py](examples/langchainv1_mcp_http.py) | Uses Langchain v1 agent with tools from local MCP HTTP server. |
216
+
| [langgraph_agent.py](examples/langgraph_agent.py) | Builds LangGraph graph for an agent to play songs. |
217
+
| [langgraph_mcp.py](examples/langgraph_mcp.py) | Builds Langgraph graph that uses tools from MCP HTTP server. |
218
+
219
+
### OpenAI and OpenAI-Agents
220
+
221
+
| Example | Description |
222
+
| ------- | ----------- |
223
+
| [openai_githubmodels.py](examples/openai_githubmodels.py) | Basic setup for using GitHub models with the OpenAI API. |
224
+
| [openai_functioncalling.py](examples/openai_functioncalling.py) | Uses OpenAI Function Calling to call functions based on LLM output. |
225
+
| [openai_agents_basic.py](examples/openai_agents_basic.py) | Uses the OpenAI Agents framework to build a single agent. |
226
+
| [openai_agents_handoffs.py](examples/openai_agents_handoffs.py) | Uses the OpenAI Agents framework to handoff between several agents with tools. |
227
+
| [openai_agents_tools.py](examples/openai_agents_tools.py) | Uses the OpenAI Agents framework to build a weekend planner with tools. |
228
+
| [openai_agents_mcp_http.py](examples/openai_agents_mcp_http.py) | Uses the OpenAI Agents framework with an MCP HTTP server (travel planning tools). |
229
+
230
+
### PydanticAI
231
+
232
+
| Example | Description |
233
+
| ------- | ----------- |
234
+
| [pydanticai_basic.py](examples/pydanticai_basic.py) | Uses PydanticAI to build a basic single agent (Spanish tutor). |
235
+
| [pydanticai_multiagent.py](examples/pydanticai_multiagent.py) | Uses PydanticAI to build a two-agent sequential workflow (flight + seat selection). |
236
+
| [pydanticai_supervisor.py](examples/pydanticai_supervisor.py) | Uses PydanticAI with a supervisor orchestrating multiple agents. |
237
+
| [pydanticai_graph.py](examples/pydanticai_graph.py) | Uses PydanticAI with pydantic-graph to build a small question/answer evaluation graph. |
238
+
| [pydanticai_tools.py](examples/pydanticai_tools.py) | Uses PydanticAI with multiple Python tools for weekend activity planning. |
239
+
| [pydanticai_mcp_http.py](examples/pydanticai_mcp_http.py) | Uses PydanticAI with an MCP HTTP server toolset for travel planning (hotel search). |
240
+
| [pydanticai_mcp_github.py](examples/pydanticai_mcp_github.py) | Uses PydanticAI with an MCP GitHub server toolset to triage repository issues. |
241
+
242
+
### Other frameworks
243
+
244
+
| Example | Description |
245
+
| ------- | ----------- |
246
+
| [llamaindex.py](examples/llamaindex.py) | Uses LlamaIndex to build a ReAct agent for RAG on multiple indexes. |
247
+
| [smolagents_codeagent.py](examples/smolagents_codeagent.py) | Uses SmolAgents to build a question-answering agent that can search the web and run code. |
instructions=("You are a helpful assistant that can suggest authentic and interesting local activities ""or places to visit for a user and can utilize any context information provided."),
57
+
instructions=(
58
+
"You are a helpful assistant that can suggest authentic and interesting local activities "
59
+
"or places to visit for a user and can utilize any context information provided."
60
+
),
57
61
name="local_agent",
58
62
description="A local assistant that can suggest local activities or places to visit.",
0 commit comments