Items marked preview in this article are currently in preview. This preview is provided without a service-level agreement, and Microsoft doesn’t recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
azd) and its azd ai agent extension give you a single command-line workflow to go from idea to a production-ready agent on Microsoft Foundry. You can develop code-based hosted agents and declarative prompt-based voice agents. This article explains the developer journey, the files that define an agent, and the core concepts you encounter along the way.
This article is for developers who prefer a terminal-first, scriptable workflow over the Foundry portal or language SDKs.
The developer journey
Theazd ai workflow follows the same lifecycle whether you build a small prototype or a production agent. You scaffold a project once, then mix and match commands as your project grows.
Agent types
Theazd ai agent extension supports code-based and declarative agent types.
Hosted agents give you full control over the runtime, framework, and tool integrations, while Foundry handles infrastructure, scaling, and session management.
Prompt-based voice agents don’t require a custom container. If you need to run
a custom speech-to-speech or cascaded audio pipeline in your own container,
build a voice agent with a hosted agent and
use the
invocations_ws protocol.
To keep conversation logic in a hosted text agent while Voice Live handles audio, use the hosted voice wrapper workflow. The wrapper and target are separate services in the same azure.yaml project. This flow doesn’t replace the existing custom invocations_ws audio-pipeline flow.
Before using the public-preview voice CLI options, check your installed extension as described in the voice agent quickstart prerequisites.
Configuration files
A hosted agent project uses oneazure.yaml file at the project root to declare both the agent and its provisioning and deployment model. The file uses a split-service model, where each named service has a host value such as azure.ai.project, azure.ai.agent, azure.ai.connection, azure.ai.toolbox, azure.ai.skill, or azure.ai.routine.
The
azure.ai.agent service defines your hosted agent inline and uses uses: to reference other services, such as the project, connections, toolboxes, skills, and routines. There is no standalone agent.yaml or agent.manifest.yaml file in the current hosted-agent azd project model.
For a prompt-based voice agent, azure.yaml stores the declarative agent
definition, including kind: prompt-voice, the model, the model type, and the
agent name. It doesn’t include a hosted-agent container runtime. To customize
instructions, audio, turn detection, transcription, voice output, tools, and
greetings, see
Configure a voice agent.
For a hosted voice wrapper, conversationEngine.name references the hosted target’s service name. The wrapper’s uses dependency orders deployment, and conversationEngine.version defaults to the version deployed by the current environment. See the voice service reference for the configuration fields.
Variable substitution
Use${VAR_NAME} in azure.yaml for values that differ by azd environment. The placeholder resolves from .azure/<env>/.env at deploy or run time, so the same azure.yaml works across environments such as dev, staging, and production.
Where the CLI runs
Theazd ai commands work both inside and outside an azd project directory:
- Inside an
azdproject, commands resolve the Foundry project endpoint from the activeazdenvironment. - Outside an
azdproject, set the active context once withazd ai project set <endpoint>, or pass--project-endpointon an individual resource command (connection,toolbox,skill, orroutine). As a fallback,azd aireads theFOUNDRY_PROJECT_ENDPOINTenvironment variable. - An in-project environment always takes precedence over the global context, so changing directories into a project retargets the CLI at that project’s endpoint.
Protocols
A protocol defines the HTTP contract between Foundry and your agent container. Your agent listens on port 8088 and serves a health probe, regardless of protocol.
For the full specification, see Hosted agent runtime contract.
These protocol settings apply to hosted-agent containers. Prompt-based voice
agents don’t configure a hosted-agent protocol.
azd ai agent invoke doesn’t implement voice conversations for prompt-based voice agents or hosted voice wrappers. For the CLI behavior and testing guidance, see Voice agent limitations.
Sessions and conversations
Sessions are identified by a
session_id. When you run azd ai agent invoke, Foundry reuses the session from your last invocation by default. Use --new-session to start fresh, or --session-id <id> to target a specific session.
Resources on a Foundry project
A Foundry project hosts more than agents. It also holds shared resources that agents reference at runtime. The CLI manages each one through a dedicated command group.
These resources are shared across developers and agents on the same project. Each command group exposes the standard
create, update, delete, show, and list verbs.
Evaluate and improve an agent
After an agent runs, two related workflows help you measure and improve its quality:- Evaluation runs your agent against a dataset, scores the responses with one or more evaluators, and reports an aggregate quality signal. You manage it with
azd ai agent eval. - Optimization iteratively rewrites your agent’s prompt to lift an evaluation signal. It uses an evaluation as its objective function and produces a candidate prompt that you review and accept. You manage it with
azd ai agent optimize.