Skip to main content

What is a prompt agent?

Updated 5 min readMarkdown
What is a prompt agent?

Imagine you’re the intake officer in an oversight office. You open the inbox on Monday morning and find a message with the subject line Collecting my certificate.

It’s three sentences long. I went to collect my certificate. The person at counter 3 asked me for ₹500 in cash. I asked for a receipt, and they said they couldn’t give me one.

Your first job is to record what the person told you. One word matters here: asked. If you write “the person paid ₹500,” you’ve added something the writer never said. And although you opened the email on Monday, you still don’t know when the visit happened.

Here’s one way to write an intake note for this fictional complaint.

Field Draft note
What was reported The writer says the person at counter 3 asked for ₹500 in cash to collect a certificate and said a receipt could not be issued.
Where Counter 3. Office name not provided.
When Not provided.

Now imagine a second complaint arrives. The details will change. You still want the same three fields and the same care with the writer’s words. Could you give an AI those instructions once and reuse them for each new message?

In Microsoft Foundry, a prompt agent pairs a model with instructions you save under a name. The model reads and writes the text. Your instructions describe the job and what a good answer should contain. You can also give an agent tools. For this job, everything it needs is in the message.

Our agent’s job is simple: “Draft an intake note. Use the writer’s account, keep the details they gave, and mark what’s missing.” Each time the officer sends a complaint, the agent applies those instructions to that message. The officer reads the draft alongside the original before filing it.

Saved instructions and one incoming complaint feed into a draft intake note with three fields: what was reported, where, and when.

Build it in Python

1. Connect to your Foundry project

You’ll need Python, the Azure CLI, and a Microsoft Foundry project where you can create agents and use a deployed model. Copy the project endpoint from the project’s welcome screen and the deployment name from your model deployment. If you’re setting up a project for the first time, use the Foundry setup guide.

In a terminal with your Python environment active, install the libraries and sign in to Azure.

python -m pip install "azure-ai-projects>=2.3.0,<3" azure-identity
az login

2. Give the agent its standing instructions

Create a file called intake_agent.py. Paste this first block into it and replace the two uppercase placeholders with the values you copied. The part to read first is instructions. It’s the same guidance you might give a colleague on their first day at the intake desk.

from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition
from azure.identity import DefaultAzureCredential

project = AIProjectClient(
    endpoint="YOUR_PROJECT_ENDPOINT",
    credential=DefaultAzureCredential(),
)

instructions = """
Turn each complaint into a short intake note with three fields:
What was reported, Where, and When.
Attribute the account to the person who wrote it.
Use only details in their message. Keep partial details.
For a missing date or location detail, write "Not provided".
"""

agent = project.agents.create_version(
    agent_name="complaint-intake-demo",
    definition=PromptAgentDefinition(
        model="YOUR_MODEL_DEPLOYMENT_NAME",
        instructions=instructions,
    ),
)
client = project.get_openai_client(agent_name=agent.name)

create_version() saves this version of the agent in Foundry. The last line gives the script a client that sends requests to the named agent.

3. Give the same agent two different complaints

Add this block to the bottom of the same file. Each message gets a fresh conversation so the second complaint has its own history. Both calls use the agent you just defined.

complaints = [
    "I went to collect my certificate. The person at counter 3 asked me "
    "for ₹500 in cash. I asked for a receipt, and they said they couldn't "
    "give me one.",
    "On 2 December, I went to the North Office. The clerk told me "
    "they couldn't find my permit application.",
]

for complaint in complaints:
    conversation = client.conversations.create()
    note = client.responses.create(
        conversation=conversation.id,
        input=complaint,
    )
    print(note.output_text)
    print()

Run python intake_agent.py. It prints one draft note per complaint. Running the whole script again creates another agent version. To process further complaints with the existing agent, reuse the named agent client and send a new input for each one.

How to tell whether it worked

Read the two notes as the intake officer would. In the first, look for “asked for ₹500” and a missing date. In the second, look for “2 December” and “North Office.” The year is still unknown. The wording can vary, but you should be able to trace every detail back to the message it came from.

That’s the practical reason to build this agent. The officer can spend their time checking whether the note is faithful to the person’s account. The instructions for drafting it are already in place.

What if you opened Outlook on Monday morning and found a draft intake note waiting beside the original complaint? In a future article, we’ll explore how to connect the agent to that inbox, even when the complaint arrives as a PDF, a scanned letter, a photo, or a voice message.

Adapted from the Python version of Microsoft Learn’s Create a prompt agent quickstart.

1 view

About the author

  • I'm an AI Consultant working at the intersection of enterprise AI, agentic systems, and digital transformation, with experience in the United Nations system. My technical interests include building secure, reliable AI agentic systems using Microsoft Foundry, Foundry IQ. Through this blog, I share practical engineering insights, hands-on tutorials, experiments, and lessons learned from foundational concepts to advanced enterprise AI architectures. I'm particularly interested in how AI can support public-sector organizations, investigations, and oversight through evidence-grounded retrieval, transparency, security, and responsible automation. My goal is simple: make complex AI technologies easier to understand, build, and apply in real-world systems.

No comments yet. Be the first to comment.