{"id":3641,"date":"2026-03-18T10:49:36","date_gmt":"2026-03-18T17:49:36","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sdk\/?p=3641"},"modified":"2026-03-18T11:02:17","modified_gmt":"2026-03-18T18:02:17","slug":"azd-ai-agent-run-invoke","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sdk\/azd-ai-agent-run-invoke\/","title":{"rendered":"Azure Developer CLI (azd): Run and test AI agents locally with azd"},"content":{"rendered":"<p><em>You can now run an AI agent on your local machine and send it messages\u2014all from <code>azd<\/code>, no portal required.<\/em><\/p>\n<hr \/>\n<h2>What&#8217;s new?<\/h2>\n<p>The <a href=\"https:\/\/learn.microsoft.com\/azure\/developer\/azure-developer-cli\/extensions\/azure-ai-foundry-extension\"><code>azure.ai.agents<\/code> extension<\/a> adds two commands:<\/p>\n<ul>\n<li><code>azd ai agent run<\/code> starts your agent locally with automatic dependency detection and installation.<\/li>\n<li><code>azd ai agent invoke<\/code> sends a message to a running agent\u2014whether it&#8217;s local or deployed in Azure AI Foundry.<\/li>\n<\/ul>\n<h2>Why it matters<\/h2>\n<p>Developing AI agents often means having to switch between your editor, a terminal, and a cloud portal to test changes. Each round trip slows you down. With <code>run<\/code> and <code>invoke<\/code>, your inner development loop stays in the terminal. Start your agent, send it a prompt, see the streamed response, and iterate\u2014all without leaving your workflow.<\/p>\n<h2>How to use it<\/h2>\n<p>To start your agent locally, use <code>azd ai agent run<\/code>. The command detects your project type (Python, Node.js, etc.), installs dependencies, and launches the agent process. If you have multiple agents in your project, specify one by name. To send a message to your agent, use <code>azd ai agent invoke<\/code>. By default, <code>invoke<\/code> targets the remote Foundry endpoint; add <code>--local<\/code> to talk to a locally running agent instead.<\/p>\n<pre><code class=\"language-bash\">azd ai agent run                          # Start the agent locally\r\nazd ai agent run my-agent                 # Start a specific agent by name\r\nazd ai agent invoke \"Summarize this doc\"  # Send a message to the remote endpoint\r\nazd ai agent invoke \"Hello\" --local       # Send a message to a locally running agent<\/code><\/pre>\n<p>Session and conversation identifiers persist across invocations, so you can carry on a multi-turn conversation without extra flags.<\/p>\n<h2>Try it out<\/h2>\n<p>These commands are available in the <code>azure.ai.agents<\/code> extension <strong>v0.1.14-preview<\/strong>. To upgrade an existing installation:<\/p>\n<pre><code class=\"language-bash\">azd extension upgrade azure.ai.agents<\/code><\/pre>\n<p>New to <code>azd<\/code>? <a href=\"https:\/\/learn.microsoft.com\/azure\/developer\/azure-developer-cli\/install-azd\">Install it<\/a>, then run <code>azd ai agent init<\/code> to get started.<\/p>\n<h2>Feedback<\/h2>\n<p>Have questions or ideas? File an issue or start a discussion on <a href=\"https:\/\/github.com\/Azure\/azure-dev\">GitHub<\/a>. Want to help shape the future of <code>azd<\/code>? <a href=\"https:\/\/aka.ms\/azd-user-research-signup\">Sign up for user research<\/a>.<\/p>\n<hr \/>\n<p><em>This feature was introduced in <a href=\"https:\/\/github.com\/Azure\/azure-dev\/pull\/7026\">PR #7026<\/a> and contributed by Travis Angevine(https:\/\/github.com\/trangevi).<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>New azd ai agent run and invoke commands let you start and test AI agents from your terminal\u2014locally or in the cloud.<\/p>\n","protected":false},"author":111321,"featured_media":3642,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[908,864],"class_list":["post-3641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-sdk","tag-azd","tag-azure-developer-cli"],"acf":[],"blog_post_summary":"<p>New azd ai agent run and invoke commands let you start and test AI agents from your terminal\u2014locally or in the cloud.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/3641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/users\/111321"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/comments?post=3641"}],"version-history":[{"count":1,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/3641\/revisions"}],"predecessor-version":[{"id":3643,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/posts\/3641\/revisions\/3643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/media\/3642"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/media?parent=3641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/categories?post=3641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sdk\/wp-json\/wp\/v2\/tags?post=3641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}