Subchapter 47.27
foundry-agent/create/references/re-host.mdMarkdown3 KBView on GitHub
Resolve two independent choices before initialization or edits:
Infer these choices from the user’s request and current code. Ask only for information that remains unclear; skip questions when the intent is explicit or evident, such as an existing Foundry model integration. Do not switch or deploy a model, or migrate the framework, without user intent.
To scaffold a Foundry agent project with existing agent codes, run:
azd ai agent init --no-prompt \
--src ./src/my-agent \
--agent-name my-agent \
--deploy-mode code \
--runtime python_3_13 \
--entry-point <entry-point>Use --deploy-mode code by default. --runtime and --entry-point are required with --deploy-mode code --no-prompt. Use the existing executable entry point, or a new adapter file only when one is intentionally added. Runtimes: python_3_13, python_3_14, dotnet_10. --deploy-mode container builds from Dockerfile. For an existing Foundry project, add --project-id "<resourceId>".
After scaffolding, you must use azd ai agent sample list --language <language> --output json and follow the azd Sample Selection Guidance to find the closest relevant samples for adapter, protocol, and deployment guidance. Treat samples as boundary patterns, not replacement applications. Browse the relevant samples as code references.
For reference, here are some awesome samples for re-hosting scenarios:
If users use a Foundry model, you must wire the Foundry model to the agent.
Set startupCommand in azure.yaml.
Once the agent is configured as a Foundry hosted agent, make the requested changes, return to create-hosted, and continue with Step 5.
azd env set AZURE_SUBSCRIPTION_ID "<id>"
azd env set AZURE_LOCATION "<region>"
azd env set AZURE_AI_MODEL_DEPLOYMENT_NAME "<model name>"Read Foundry Model Reference and follow the steps in it when you want to query model related data.