File tree Expand file tree Collapse file tree 3 files changed +16979
-2
lines changed
samples/python/hosted-agents/agent_framework/web-search-agent Expand file tree Collapse file tree 3 files changed +16979
-2
lines changed Original file line number Diff line number Diff line change 1+ # Web Search Agent
2+
3+ A hosted agent that uses Bing Grounding to search the web for current information.
4+
5+ ## Local Development
6+
7+ ### Prerequisites
8+
9+ - Python 3.10+
10+ - Azure CLI logged in (` az login ` )
11+ - An Azure AI Foundry project with:
12+ - A model deployment (e.g., ` gpt-4.1-mini ` )
13+ - A Bing Grounding connection
14+
15+ ### Setup
16+
17+ 1 . Create a virtual environment and install dependencies:
18+
19+ ``` bash
20+ python -m venv .venv
21+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
22+ pip install -r requirements.txt
23+ ```
24+
25+ 2 . Create a ` .env ` file with the following environment variables:
26+
27+ ``` bash
28+ AZURE_AI_PROJECT_ENDPOINT=https://< your-foundry-account> .services.ai.azure.com/api/projects/< your-project>
29+ AZURE_AI_MODEL_DEPLOYMENT_NAME=< your-model-deployment> # e.g., gpt-4.1-mini
30+ BING_GROUNDING_CONNECTION_ID=/subscriptions/< subscription-id> /resourceGroups/< resource-group> /providers/Microsoft.CognitiveServices/accounts/< foundry-account> /projects/< project> /connections/< bing-connection-name>
31+ ```
32+
33+ ### Run the agent locally
34+
35+ ``` bash
36+ python main.py
37+ ```
38+
39+ The server will start on ` http://localhost:8088 ` .
40+
41+ ### Test the agent
42+
43+ ``` bash
44+ curl -X POST http://localhost:8088/responses \
45+ -H " Content-Type: application/json" \
46+ -d ' {"input": "What is the latest news in AI?"}' | jq .
47+ ```
48+
149## Troubleshooting
250
351### Images built on Apple Silicon or other ARM64 machines do not work on our service
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ def create_agent() -> ChatAgent:
1717 )
1818
1919 chat_client = AzureAIAgentClient (
20- endpoint = os .environ ["AZURE_AI_PROJECT_ENDPOINT" ],
21- async_credential = DefaultAzureCredential (),
20+ project_endpoint = os .environ ["AZURE_AI_PROJECT_ENDPOINT" ],
21+ credential = DefaultAzureCredential (),
2222 )
2323
2424 bing_search_tool = HostedWebSearchTool (
You can’t perform that action at this time.
0 commit comments