AI  

Microsoft Agent Framework - Declarative Tools Explained

Time to be a detective!

AI-agent

šŸŽ® What Is an AI Agent?

Imagine you have a super smart robot friend. You tell it stuff like ā€œremind me to do homeworkā€ or ā€œsend a message to my team.ā€ That robot is called an AI agent. It’s like a digital assistant, but cooler — because it can think, plan, and sometimes even talk like a human.

But here’s the twist: sometimes you don’t want your robot to actually do the thing. You just want it to plan the thing. Like a rehearsal. That’s where dry-run agents come in.

🧠What’s a Dry-Run Agent?

A dry-run agent is like a pretend superhero. It doesn’t save the world — it just plans how it would. It looks at the tools it has, thinks about how to use them, and tells you what it would do… but never actually does it.

Why is that cool? Because:

  • You can test stuff safely

  • You don’t mess up real data

  • You can get human approval before doing anything

šŸ› ļø Meet the Tools (But Don’t Use Them Yet!)

In the Microsoft Agent Framework, tools are like mini superpowers. You define them using something called AIFunction. But here’s the magic part: you don’t give them any code. You just describe what they should do.

It’s like saying:

ā€œHey agent, there’s a tool called update_jira_ticket. It takes a ticket ID and a status. You can think about using it, but don’t actually run it.ā€

🧪 Our Use Case — Pretend to Update Jira and Message Teams

Let’s say I’m working on a school project (or maybe a game dev team šŸ˜Ž), and I want my AI agent to:

  1. Update a Jira ticket to ā€œIn Progressā€

  2. Notify the DevOps team in Microsoft Teams

But I don’t want it to actually do those things. I just want it to plan them.

🧱 Building the Agent (Step-by-Step)

Step 1: Define the Inputs

class JiraUpdateInput(BaseModel):
  ticket_id: str = Field(…, description=ā€Jira ticket IDā€) 
  status: str = Field(…, description=ā€New status to setā€)

Step 2: Declare the Tools (No Code Inside!)

update_jira = AIFunction(name=ā€update_jira_ticketā€,
  description=ā€Simulate updating a Jira ticketā€,
  input_model=JiraUpdateInput)

Step 3: Create the Agent

create_agent(instructions=ā€You are a dry-run agent. You plan actions but never execute them.ā€,
name=ā€Dry Run Agentā€,
tools=[update_jira])

Step 4: Run the Query

result = await agent.run(Update Jira ticket ABC-123 to 'In Progress'")

Expected output

ā€œTo update the Jira ticket ABC-123, you could use the update_jira_ticket tool with status 'In Progress'. To notify the team, use post_teams_message targeting the DevOps channel.ā€

🧠 Why This Is So Useful

  • Safe Testing: You can test workflows without breaking stuff.

  • Human-in-the-Loop: You can show the plan to a teacher, manager, or teammate before doing anything.

  • Modular Design: You can plug in real tools later when ready.

  • Debugging: You can see how your agent thinks before it acts.

🧪 Real-Life Examples

  • A DevOps bot that plans deployments but waits for approval

  • A student assistant that drafts feedback but doesn’t send it

  • A multi-agent system where one agent plans, and another executes

  • A sandbox environment for testing AI workflows safely

🧠 What I Learned

  • AI agents can be smart without being dangerous

  • Declarative tools are like blueprints — no hammer needed

  • Microsoft Agent Framework makes it super easy to build dry-run agents

  • Thinking before doing is actually kinda powerful

šŸŽÆFinal Thoughts

If you’re building AI stuff and want to test it safely, dry-run agents are your best friend. You can mock tools, simulate workflows, and keep everything under control. Plus, it’s fun to pretend your agent is a detective who solves problems without touching anything.