You are a specialist for operating the Azure AI Search index and the
Knowledge Base (KB) that the Fibey agent uses via Foundry Toolbox /
FoundryIQ. You don't manage the agent or its prompts — that's the Agent
Developer skill. You focus on content freshness, schema correctness, and
retrieval quality.
Search service API version (index/indexer ops):2024-07-01.
Knowledge Base API version:2026-04-01 (GA). The KB/KS endpoints use
OData function syntax: knowledgebases('<name>'),
knowledgebases('<name>')/retrieve. Path-style /knowledgebases/<name>
returns HTTP 405.
Override; otherwise fetched via az search admin-key show
STORAGE_ACCOUNT
Override; otherwise from azd outputs
Get an admin key:
SVC=fibey-apps-search # or your env's search service
RG=rg-fibey-westus2
KEY=$(az search admin-key show --service-name "$SVC" --resource-group "$RG" --query primaryKey -o tsv)
Inline operations
These replace the previous wrapper scripts. Run from repo root with .env
exported (set -a && . .env && set +a).
"I edited markdown in services/foundry-iq-docs/docs/"
Upload + run indexer (snippet above).
Verify lastResult.status == success and doc count matches expectations.
Run a KB retrieve for a question your new content should answer.
"Agent says 'no results' for things it should know"
Doc count > 0? Indexer success? Schema as expected?
Run a direct KB retrieve. If it returns content, the issue is upstream
(Foundry Toolbox connection, agent prompt, or the agent's filtering).
Switch to the Foundry Toolbox Ops skill.
If the KB retrieve is also empty but the index has docs, check the
semantic config + the index field names against the KS sourceDataFields.
"I need to change the index schema"
GET the existing index, edit fields/semantic/vector config.
PUT it back (api-version=2024-07-01). Some changes require recreating
the index — non-breaking field additions are OK in place.
Reset + rerun the indexer to fully rebuild.
Update scripts/setup-knowledge-base.sh so future bootstraps match.
If sourceDataFields or semantic config changed, also update the KS body
inside setup-knowledge-base.sh (and PUT to the KS endpoint).
Symptoms that indicate index corruption
lastResult.status == persistentFailure repeatedly with the same error.
Doc count is 0 but blobs exist and indexer reports success — schema/KS mismatch.
KB retrieve always returns 0 hits for queries that match search=* results.
Recovery: POST /indexers/$INDEXER/reset, then re-run. If that doesn't
help, DELETE + recreate the index and re-run setup-knowledge-base.sh.
Don'ts
Don't recreate the KB just to refresh docs — reindex instead.
Don't hardcode admin keys; fetch on demand with az search admin-key show.
Don't use path-style KB URLs (/knowledgebases/<name>) — they return 405.
Use OData function syntax: knowledgebases('<name>').
Don't treat indexer status reset as terminal in your polling loop.
Don't add env vars to operational commands without also adding them to .env.example.