Skip to content

Agents

In Azure Logic Apps Automation, an agent is a workflow action that performs the following tasks:

  • Accept requests in plain language.
  • Interpret requests by using a large language model.
  • Follow system instructions that define the agent’s role.
  • Call tools that complete the tasks needed to fulfill the requests.

Some agents can also run code and scripts in a sandbox.

Like any other action, an agent produces structured outputs that subsequent workflow actions can use. However, an agent can accept freeform, unstructured, and unpredictable inputs.

For the decision guide and setup paths for each option, see The options and how to choose.

The designer’s Choose an Agent picker presents these options. Other quick-add menus can show a subset and use different labels. The available choices and connections can vary by environment.

The following synthetic example illustrates the picker; it might differ from your portal:

Agent picker with Workflow, Managed, Foundry prompt, and Foundry Hosted choices.

OptionWhen to consider it
Workflow agentDefine an agent in the workflow when you want to configure its prompts, context, and tools.
Managed agentWork with code, files, repositories, and skills in a sandboxed agent harness.
Foundry prompt agentUse a declarative Microsoft Foundry agent configured with prompts, a model, and tools.
Foundry Hosted agentUse an agent provisioned in a hosted container in a Foundry project. See Foundry Hosted Agents.

After you choose a type, follow the connection and configuration steps shown for that option. For a hosted agent, finish its setup before selecting it in a workflow.

Choose Workflow agent to configure an agent in the workflow. Select a model connection, or add the agent first and configure a connection in the editor. Set the system and user messages, and add the tools the agent needs. See Native agent concepts and components.

Choose Managed agent for work involving code and files. Review the model and harness choices offered by the designer, then configure the sandbox, repositories, skills, and input files needed for the task. Confirm your access and the available sandbox options before relying on them. See Sandbox setup overview.

Choose Foundry prompt agent to use an agent configured in Microsoft Foundry. Select or create a compatible Foundry Agent Service connection, then review the agent and its configuration in the editor. Its Built in tools options include Code interpreter and File search.

The following synthetic example shows an unsubmitted connection form with a fictional subscription:

Foundry connection fields with a fictional subscription and no project selected.

Choose Foundry Hosted agent to use a hosted agent from your Foundry project. Create and finish setting up the hosted agent before selecting it in the workflow. See Create and use a Foundry Hosted Agent.

For workflow patterns, see Ways of orchestrating agents.

Use the workflow to decide when an agent runs and what happens next:

  1. Pass data from a trigger or an earlier action to the agent’s user message.
  2. Configure any supported actions the agent needs as tools, with descriptions that explain when to use them.
  3. Use the agent’s output in a later workflow action. For a multi-agent workflow, pass the appropriate output to the next agent.
  4. Review the run history, including available agent and tool details, to understand the result.

Review the inputs, tool permissions, and outputs for each agent before relying on them.

The following table helps you choose whether to use an agent versus a deterministic workflow:

AgentDeterministic workflow
Run unpredictable actions based on input.Run predictable actions known in advance.
Handle unstructured or unpredictable inputs with variable behavior.Handle structured inputs with repeatable behavior.
Prioritize flexibility and reasoning.Prioritize cost and low latency.

The designer distinguishes Workflow and Managed agents from Foundry prompt and Foundry Hosted agents. Workflow agents are configured in the workflow, while Managed agents offer a sandboxed harness for tasks involving code and files. Foundry agents use resources in a Microsoft Foundry project.

For the four choices and their setup paths, see Choose an agent. Review the connection, tools, and settings offered for the type you select.

Choose from the following native agent types:

AreaWorkflow agentManaged Agent
Primary focusBusiness processesSoftware development, as a component in a larger automated process
Works withServices, systems, apps, data, approvalsRepositories, code, files, scripts, tests, development assets, and developer workflows.
ToolsConnectors, REST APIs, MCP servers, knowledge bases, other workflowsSandbox and repository capabilities, shells, runtimes, terminals, and developer tools
OptimizesBusiness outcomesSoftware artifacts
Common use casesOnboarding, support, operations, and financeGenerate and refactor code, create unit tests, review pull requests, and find repository defects

After you add an agent action to your workflow, set up the agent to work the way you want. The following table introduces agent-related configuration concepts and components:

Section labels can vary by editor layout and agent type.

TabSection or fieldDescription
ParametersAI modelReview the model or agent configuration offered for the agent type you selected.

For more information, see Native versus Foundry agents.
ParametersSystem messageThe description about the agent’s role, purpose, behavior, and constraints. Supports the full expression language.

For more information, see Best practices.
ParametersUser messageThe user prompt or question for the agent to answer.

This input usually originates from the workflow trigger or a preceding action as body content in expression format.

For more information, see Best practices.
ParametersInput files
(Managed Agent only)
Review the available input file settings for the agent.
ParametersBuilt-in toolsWorkflow agent: Code interpreter gives the agent a way to run JavaScript.
ParametersToolsThe actions, MCP servers, or workflows that the agent can call as tools.
Connect or ConnectionConnectionsThe configuration with the credentials and endpoint to access the model. You can create a connection or select an existing connection.
Run settings- Timeout
- Loop Count
- Secure Inputs
- Secure Outputs
Review the available timeout and iteration settings. Confirm what the secure input and output settings protect before relying on them.
Harness
(Managed Agent only)
- Execution environment
- Sandbox configuration
- Repository skills
Review the available harness and sandbox settings. For more information, see Sandboxes.
KnowledgeKnowledgeKnowledge sources an agent can use. For more information, see Knowledge bases.
CodeCode viewThe agent’s underlying JSON definition. Edit availability depends on the workflow mode and editor.

The following high-level process describes the steps that run for a native agent loop action:

  1. Send the system prompt and input to the model.
  2. If the model chooses a tool, the runtime calls the tool.
  3. The runtime feeds the results from the tool back to the model.
  4. Repeat until the model produces the final answer, or the loop reaches its iteration limit.
  5. Return the final answer plus structured outputs to the remaining workflow.

Downstream workflow actions can reference the agent’s outputs by using the following expressions:

@outputs('<agent-name>')['<structured-output>']?['<field-name>']
@outputs('<agent-name>')['<final-assistant-message>']

For sandbox setup guidance, see Sandbox setup overview.

  • Write unambiguous system messages and user messages. Agents work better with clear, specific, and detailed instructions, not vague intent.
  • Keep agent toolsets small. For example, fewer than 10 tools is better than 20 tools. Large toolsets increase the risk for model confusion.
  • Use verb-centric tool names, like get_current_time or find_order to help the model correctly choose tools.
  • Spend time on tool descriptions, which matter more than names to help the model choose tools.
  • For long-running or expensive tools, set a timeout or iteration limit that matches the expected task difficulty. That way, a stuck tool doesn’t burn up the agent’s iteration budget.
  • Rather than reparse the agent’s final answer, use the agent’s structured outputs instead in subsequent workflow actions.

You can enable or add the following tools to your native agent:

Tool typeDescription
Built-inFor Workflow agents, Code interpreter lets the model write and execute JavaScript. Confirm runtime restrictions and resource limits before use.
CustomAny built-in or managed connector action, MCP server, or workflow that you can call.

For a Workflow agent that needs to perform the following tasks, enable its code interpreter capability:

  • Calculate numbers, run algorithms, or transform complex data structures that the model can’t reliably handle.
  • Parse, filter, or reshape JSON and arrays returned from other tools.
  • Generate dynamic content such as regular expression extraction, templating, and formatting.

With the code interpreter enabled, the agent runs the following high-level steps:

  1. The model decides it needs to call the code interpreter tool by using the code argument.
  2. The runtime runs the JavaScript.
  3. The output flows back to the chat history as a tool result.
  4. The model reads the result.
  5. The model calls another tool or produces the final answer.

If you’re using a Managed Agent that needs a richer execution environment, create a sandbox, and then set up that sandbox in the agent’s Harness section.

Confirm the supported runtimes, network and file access, execution timeouts, and resource limits with your administrator before use. For additional execution options, review sandboxes.

You can create custom tools for an agent to use by using a built-in or managed connector action, MCP server, or workflow that you can call. Each tool needs the following items:

RequirementDescription
Tool nameThe agent uses this name to call the tool.
DescriptionThe agent uses this description to choose the correct tool.
Agent parametersThe agent uses these parameter names and descriptions as a schema to populate tool parameter arguments at run time.

When the model calls an agent’s custom tools, the model provides arguments based on the tool’s parameter schema. The agent uses this schema to feed parameter values to the tool at run time. To access these arguments inside a tool action, use the following expression with the agentParameters() function:

@agentParameters('orderId') // Return the value passed by the agent for the `orderId` parameter.
@agentParameters('limit') // Return the value passed by the agent for the `limit` parameter.

The @agentParameters('<parameter-name>') expression works as a bridge between the arguments that the model sends to the tool and the workflow that runs the tool.

A Workflow agent can use both the code interpreter tool and custom tools. The following table describes some example common patterns:

Real-world use caseTool use pattern
Get data, transform, and post resultQuery_Database → code_interpreter (transform) → HTTP_Post
Send daily reportcode_interpreter (aggregate) → Send_Email
Extract, Transform, Load (ETL)Query_Database → code_interpreter (transform) → Insert_Records
API submissioncode_interpreter (validate) → HTTP_Request (submit) → code_interpreter (parse response)

After an agent run, review the workflow run history and available chat or iteration details. Depending on the run and its settings, these details can include:

  • User and assistant messages.
  • Tool calls, arguments, and results.
  • Durations and other step details.

These details can help you understand how the agent reached its result.