Agents are rapidly evolving beyond chat. The first generation of agents waited for a person to send a message. Today, organizations want agents that can monitor work, respond to business events, and continue tasks over time. An agent might triage a newly opened GitHub issue, respond when a message appears in a Microsoft Teams channel, prepare a report every morning, or check back on a long-running process until it finishes.
Building that automation yourself is difficult. You need schedulers, event listeners, webhooks, queues, infrastructure, authentication, run history, and monitoring—before you can focus on the agent’s actual job. Today, we’re announcing the general availability of routines in Foundry Agent Service, a managed way to run agents on a schedule, at a specific time, or in response to an external event. The trigger, agent action, identity, connections, and run history live together in your Foundry project. You define when the agent should run and what it should do, and Foundry handles the rest.
Why build automated agents with Foundry?
Moving from a chatbot to an automated agent introduces a different set of engineering challenges. Suppose you want an agent to triage every new GitHub issue assigned to your team. The agent itself might already understand how to classify the issue, find related documentation, and recommend an owner. But something still needs to:
- Monitor GitHub for the right event.
- Authenticate to the repository.
- Deliver the event payload to the agent.
- Invoke the agent reliably.
- Authenticate the agent to its tools.
- Track whether the run succeeded.
- Preserve an audit trail.
A recurring agent creates similar work: a scheduler, hosting infrastructure, retry logic, credentials, and a database for execution history. Every new automation adds more infrastructure to deploy and maintain. Routines bring managed agent execution into Foundry Agent Service. Create a trigger, select an agent, provide its instructions, and start the routine. Foundry queues the invocation, runs the agent, and records the result for later inspection. Teams can spend less time assembling automation infrastructure and more time building the agent capabilities that differentiate their applications.
Run agents when work happens
Routines support several ways to start an agent:
| Trigger type | When it runs | Example uses |
|---|---|---|
| Timer | Once at a future date and time | Release-day preparation, deadline reminders, and scheduled follow-ups |
| Recurring | Repeatedly on a schedule | Daily summaries, weekly reports, compliance checks, backlog reviews, and operational monitoring |
| Event-based | When an event occurs in a connected system | GitHub issue triage and responses to new Microsoft Teams channel messages |
Timer routines are ideal for work that should happen at a specific moment. Recurring routines let you manage a schedule alongside the agent instead of maintaining a separate scheduler and invocation service. Event-based routines allow agents to react when something changes—not when someone remembers to ask. Initial integrations include GitHub issue events and new messages in Microsoft Teams channels, with more event sources planned.
When an event occurs, Foundry receives it through the configured connection and forwards its payload to the agent. The agent can reason over the event, use its tools, and take the next appropriate action. A GitHub agent can triage an issue as soon as it arrives, while a Teams agent can detect a support request, retrieve relevant context, and initiate a response without waiting for a separate chat interaction.
Build agents that can continue their own work
Some tasks cannot be completed in a single run. An agent might start a data export, request an approval, launch a deployment, or call an API that takes several minutes to finish. The agent needs to check back later swithout requiring a person to restart it. The reminder tool (preview) lets a Hosted Agent in Foundry Agent Service schedule itself to run again after a delay. When the reminder fires, Foundry invokes the same agent on the same conversation, preserving the context it needs to continue.
Consider an agent monitoring a long-running task:
- The agent starts the task and receives a task ID.
- It schedules a reminder for 15 minutes later.
- Foundry re-invokes it on the same session.
- The agent checks the task’s status.
- If the task is still running, it schedules another reminder.
- When the task finishes, the agent summarizes the result and notifies the user.
The agent decides when it needs to continue. Developers don’t need to build a polling service, persist conversational state separately, or write custom code to invoke the agent again. Together, routines and the reminder tool support both sides of automation: externally defined triggers that start an agent and agent-directed reminders that let it continue working over time.
Identity designed for unattended agents
Automation also raises a critical question: whose identity is being used? For every routine type—timer, recurring, or event-based—you can choose whether the agent and its tools are invoked using the routine creator’s identity or the agent’s identity.
- Creator identity lets the routine act with the creator’s delegated access, keeping actions within that person’s permissions and access boundaries. Use creator identity when you have tools configured to authenticate with user identity, such as Oauth.
- Agent identity lets the routine run as an independent agent using its own configured permissions in Microsoft Entra ID. Use Agent identity when all of your tools only need key-based or managed identity for authentication.
This flexibility lets you choose the identity model that fits the task, whether a routine runs once, repeats on a schedule, or responds to an external event. Foundry manages the underlying authentication and token exchange, helping keep identity plumbing out of agent code while making automated activity governable and auditable.
Quickstart: create a routine with Python
Install the required packages:
pip install azure-ai-projects azure-identity
The following example creates a recurring routine that invokes an agent every weekday at 7:00 AM UTC:
import os
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project = AIProjectClient(
endpoint=os.environ["PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)
routine = project.beta.routines.create_or_update(
routine_name="daily-summary",
description="Runs a daily summary agent on weekday mornings.",
enabled=True,
triggers={
"weekday-morning": {
"type": "schedule",
"cron_expression": "0 7 * * 1-5",
"time_zone": "UTC",
}
},
action={
"type": "invoke_agent_responses_api",
"agent_name": os.environ["AGENT_NAME"],
"input": "Summarize activity from the last 24 hours.",
},
)
print(f"Created routine: {routine.name}")
If you want to use the routine creator’s identity to authenticate with the agent and the following tool calls, you can follow the following samples:
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import RoutineAuthorization
from azure.identity import AzureCliCredential
project = AIProjectClient(
endpoint=os.environ["PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)
routine = project.beta.routines.create_or_update(
routine_name="daily-summary",
description="Runs a daily summary agent on weekday mornings.",
enabled=True,
authorization=RoutineAuthorization(identity="creator"),
triggers={
"weekday-morning": {
"type": "schedule",
"cron_expression": "0 7 * * 1-5",
"time_zone": "UTC",
}
},
action={
"type": "invoke_agent_responses_api",
"agent_name": os.environ["AGENT_NAME"],
"input": "Summarize activity from the last 24 hours.",
},
)
print(f"Created routine: {routine.name}")
Set PROJECT_ENDPOINT to your Foundry project endpoint and AGENT_NAME to the name of your deployed agent. You can also create and manage routines in the Microsoft Foundry portal or by using the REST API, the JavaScript and .NET SDKs, or the Azure Developer CLI. For an event-based routine, first create and authorize the corresponding project connection, then reference it when defining the trigger.
Start building automated agents today
The next generation of agents won’t wait in a chat window. They will notice when work happens, act with the right identity, use the right tools, and continue until the task is complete. With Routines in Microsoft Foundry, you can build that behavior without assembling and operating the surrounding automation infrastructure yourself. Explore the routines documentation, add the reminder tool to a hosted agent, or open the Microsoft Foundry portal to create your first routine.
0 comments
Be the first to start the discussion.