Skip to main content
You can establish a Continuous Integration and Continuous Deployment (CI/CD) pipeline for a hosted agent in Microsoft Foundry project. This quickstart helps enterprise hosted agent developers validate code changes after they update agent source code. The pipeline performs two tasks:
  1. Deploy the updated hosted agent code.
  2. Invoke the agent and verify that it returns a response.
This quickstart focuses on GitHub Actions. The pipeline template includes comments for values that vary by project, such as the hosted agent code root folder, Foundry project endpoint, model deployment, and test prompt. Update those values to match your repository and environment layout.

Set up a GitHub pipeline for hosted agents

You can use GitHub Actions with Azure Developer CLI (azd) to deploy and validate hosted agent changes. The workflow uses GitHub OpenID Connect (OIDC) to sign in to Azure, configures the azd environment, deploys the agent, shows the hosted agent status, and sends a smoke-test message.

Prerequisites

Set up pipeline with GitHub

  1. Create a .github/workflows/hosted-agent-cd.yml file in your repository with the following content:
  2. In GitHub, go to Settings > Secrets and variables > Actions and add the following repository variables:
    • AZURE_CLIENT_ID
    • AZURE_TENANT_ID
    • AZURE_SUBSCRIPTION_ID
    • AZURE_LOCATION
    • FOUNDRY_PROJECT_ENDPOINT
    • AZURE_AI_PROJECT_ID
    • FOUNDRY_MODEL_NAME
    Except for AZURE_CLIENT_ID, which comes from your OIDC application registration, you can find these values in your project .azure/<project-name>/.env file. You can also get the project endpoint, project ID, and model deployment name from the corresponding agent details page in the Foundry portal.
  3. Add any additional variables or secrets required by your hosted agent project.
  4. Update the workflow placeholders. In hosted-agent-cd.yml, update the following values:
    • AGENT_PROJECT_DIR: The repository-relative path to the root folder for your hosted agent code.
    • AZD_ENV_NAME: The staging azd environment name for deployment.
    • AGENT_TEST_PROMPT: A smoke-test prompt that should produce a reliable response from your agent.
    • Optional azd env set lines: Any additional environment values required by your agent.
  5. Run the pipeline. Push code to the main branch or run the workflow manually from the GitHub Actions page.
After the pipeline executes successfully, the log shows that the hosted agent was deployed, the agent status was returned, and the smoke-test invocation returned a non-empty response.

See also