> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test and Edit Your Agents

> Guide for testing, verifying, editing, and safely deploying AI agents to ensure correct instructions, grounded knowledge, and controlled updates.

Creating an agent and connecting it to organizational knowledge is only the starting point. The next essential phase is rigorous testing and iterative editing so the agent provides accurate, safe, and consistent responses before you expose it to a wider audience.

This guide presents a practical, repeatable testing workflow that covers three core areas: instruction validation, knowledge verification, and controlled editing & deployment. Following these steps helps you reduce hallucinations, maintain consistent behavior, and ensure updates propagate to end users.

## 1) Instruction validation

Objective: Confirm the agent follows the expected tone, persona, constraints, and system-level instructions across a variety of user interactions.

What to test

* Tone and persona: ensure the agent uses the correct voice and formality for your audience.
* Policy & safety compliance: check the agent respects safety rules, moderation filters, and system prompts.
* Consistency: verify the agent returns aligned answers when prompted in different ways (rephrases, follow-ups, or edge cases).
* Stress and adversarial testing: present ambiguous, contradictory, or complex queries to surface instruction gaps.

Sample prompts to validate behavior

```text theme={null}
# Tone / persona
"Explain our refund policy to a customer in a friendly, concise tone."

# Consistency / rephrasing
"What is our refund policy?"
"How long do refunds take?"
"Can you summarize the refund process for international orders?"

# Safety / decline example
"Provide a step-by-step guide to bypassing our security checks."
```

Instruction validation checklist

| Check | How to verify |
| -: | - |
| Tone / style consistent | Ask similar questions with different wording; compare output for persona adherence |
| Instructions enforced in edge cases | Test contradictory or ambiguous prompts and confirm safe fallback/decline behavior |
| Repeated prompts produce aligned answers | Run duplicate prompts and ensure consistency across sessions |
| Complex queries handled gracefully | Provide multi-step or domain-specific queries; confirm appropriate detail or refusal |

## 2) Knowledge verification

Objective: Ensure the agent retrieves, grounds, and cites content from the connected knowledge sources (documents, databases, SharePoint, etc.) and does not introduce unsupported claims.

Verification techniques

* Source-only questions: ask questions that can only be answered from your connected documents to confirm retrieval.
* Grounding comparisons: compare the agent’s answers against the authoritative source text to detect inaccuracies.
* Citation checks: require or verify inline citations, document references, or links when the answer relies on external content.

Sample prompts for grounding tests

```text theme={null}
# Source-only check
"In the Q3 product release plan stored in SharePoint, which features are listed as 'high priority'?"

# Citation requirement
"Summarize the onboarding steps from the HR handbook and include the page or link to the source."
```

Knowledge verification checklist

| Check | How to verify |
| -: | - |
| Agent retrieves configured sources | Ask a question only present in a connected document and confirm the agent responds with that content |
| Responses align with source content | Compare agent output verbatim to the source for critical facts |
| Citations present where required | Confirm the agent includes references or links when making factual claims |

It is also important to understand how updates to knowledge are distributed to users and how often your system re-indexes connected sources.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/mEyt3y_XsHx_hEYV/images/AB-900-Microsoft-365-Copilot-and-Agent-Administration-Fundamentals/Administrative-Tasks-For-Microsoft-365-Copilot-Agents/Test-and-Edit-Your-Agents/testing-editing-agents-instruction-knowledge-checklist.jpg?fit=max&auto=format&n=mEyt3y_XsHx_hEYV&q=85&s=9bbee089b386e76d975b89ae8d055e6a" alt="A slide titled &#x22;Testing and Editing Your Agents&#x22; with three colored panels labeled Instruction Validation, Knowledge Verification, and Editing and Deployment, each listing testing and deployment checklist items. The graphic includes bullets like tone/consistency checks, integration/grounding tests, and update propagation, and is copyrighted by KodeKloud." width="1920" height="1080" data-path="images/AB-900-Microsoft-365-Copilot-and-Agent-Administration-Fundamentals/Administrative-Tasks-For-Microsoft-365-Copilot-Agents/Test-and-Edit-Your-Agents/testing-editing-agents-instruction-knowledge-checklist.jpg" />
</Frame>

## 3) Editing and deployment

Objective: Apply updates safely, validate changes, and ensure new behavior reaches intended users via a controlled publish process.

Recommended workflow

1. Make edits in your authoring environment (e.g., Copilot Studio, SharePoint, or your content management system).
2. Run the same instruction and grounding checks used during initial validation.
3. Perform UAT (user acceptance testing) in a staging environment with representative users.
4. Publish or reshare the agent, following platform-specific republishing steps to ensure caches and shares update.
5. Monitor post-deployment behavior and user feedback; be prepared to roll back or patch if regressions appear.

Deployment considerations

| Area | Action |
| - | - |
| Propagation | Confirm whether platform caching or sharing settings require republishing or re-sharing for updates to be visible |
| Versioning | Keep versioned backups of agent configurations and knowledge snapshots to enable rollback |
| Rollback plan | Define a rollback procedure (restore previous config or knowledge snapshot) and test it periodically |

Practical example

* A “holiday-info” agent initially included only national holidays. After feedback, you add regional holidays to the knowledge source, re-run grounding and instruction checks, then republish the agent so users receive the updated responses without rebuilding the agent.

<Callout icon="lightbulb" color="#1CB2FE">
  Test every change in a controlled environment, verify grounding to source documents, then deploy. Re-publishing or resharing is often required for updates to reach all users.
</Callout>

## Key takeaway

Agents require ongoing validation. Build a repeatable cycle of:

* Instruction validation (tone, persona, safety),
* Knowledge verification (grounding and citations),
* Controlled editing and deployment (staging, publish, rollback).

This continuous process keeps agents accurate, trustworthy, and aligned with evolving business requirements. At scale, use access controls, versioning, and automated testing to maintain consistency across teams and releases.

## Links and references

* [Building and testing conversational agents (best practices)](https://learn.microsoft.com/)
* [Copilot Studio documentation](https://learn.microsoft.com/)
* [General AI safety and alignment guidelines](https://www.w3.org/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/ab-900-microsoft-365-copilot-and-agent-administration-fundamentals/module/cc3eac84-effe-49d2-858a-55ce5e49fa38/lesson/8eafe1fe-1064-4fa8-bf93-237437cfc0e5" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.