Skip to content

Commit 007a793

Browse files
authored
Update capability-hosts.md
1 parent 0b689c7 commit 007a793

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

articles/ai-foundry/agents/concepts/capability-hosts.md

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ When creating capability hosts, be aware of these important constraints to avoid
9696

9797
**How to avoid:**
9898
- **Monitor operation status** before making new requests
99-
- **Implement retry logic** with exponential backoff
10099
- **Wait for operations to complete** before starting new ones
101100

102101
### Best practices to prevent conflicts
@@ -109,33 +108,7 @@ Always check for existing capability hosts before attempting to create new ones:
109108
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts?api-version=2025-06-01
110109
```
111110

112-
**For project-level capability hosts:**
113-
```http
114-
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts?api-version=2025-06-01
115-
```
116-
117-
#### 2. **Implement proper retry logic**
118-
For 409 conflicts due to concurrent operations, implement exponential backoff:
119-
120-
```python
121-
import time
122-
import random
123-
124-
def create_capability_host_with_retry(max_retries=3):
125-
for attempt in range(max_retries):
126-
try:
127-
return create_capability_host()
128-
except requests.HTTPError as e:
129-
if e.response.status_code == 409 and "currently in non creating" in e.response.text:
130-
wait_time = (2 ** attempt) + random.uniform(0, 1)
131-
time.sleep(wait_time)
132-
continue
133-
else:
134-
raise # Different type of conflict, don't retry
135-
raise Exception("Max retries exceeded")
136-
```
137-
138-
#### 3. **Monitor long-running operations**
111+
#### 2. **Monitor long-running operations**
139112
Capability host operations are asynchronous. Always monitor operation status:
140113

141114
```http

0 commit comments

Comments
 (0)