.net maui
167 TopicsBuild Reliable AI Agents with Monitoring, Tool Integration, and Responsible AI in Microsoft Foundry
Build Reliable AI Agents with Monitoring, Tool Integration, and Responsible AI in Microsoft Foundry Introduction AI agents are becoming an important part of modern business applications. They can answer customer questions, automate repetitive tasks, retrieve information, and interact with external services. However, building an AI agent that works correctly in a development environment does not always mean it will perform reliably in production and https://geometrydasshapk.com/ As applications grow, agents must handle more complex requests, unexpected user inputs, changing data, and different operational conditions. Without proper monitoring and evaluation, it can become difficult to understand why an agent produces incorrect responses or fails to complete a task. Microsoft Foundry provides tools and capabilities that help development teams build, test, monitor, and improve AI-powered applications. By combining structured tool integration, evaluation workflows, observability, and responsible AI practices, teams can create agents that are easier to maintain and more dependable. This article explores a practical approach to building reliable AI agents using Microsoft Foundry. 1. Understand the Architecture of an AI Agent Before developing an AI agent, it is important to understand how its main components work together. A typical agent application includes several components: User interface: Receives questions and displays responses. Language model: Understands requests and generates responses. Instructions: Define the agent's role, limitations, and expected behavior. Tools: Allow the agent to interact with APIs, databases, and other services. Evaluation system: Measures response quality and task completion. Monitoring: Tracks errors, performance, and resource consumption. These components work together to process user requests and deliver useful results. For example, consider a customer support agent that helps users check their order status. The agent receives a question, identifies the required information, calls an order-management tool, and returns the result. A well-designed architecture should ensure that the agent does not invent order information or report an action as completed without confirmation from the relevant system. 2. Configure Agent Instructions and Responsibilities Agent instructions are an important part of application development. They explain what the agent should do, how it should communicate, and which actions it is allowed to perform. Poor instructions can lead to inconsistent responses, unnecessary tool calls, or unsupported claims. A practical instruction structure should include: Role definition Describe the agent's primary responsibility. Task boundaries Explain which requests the agent can handle and which requests require additional support. Tool usage Define when the agent should call available tools and what information it needs before doing so. Response requirements Specify how the agent should present results, errors, and incomplete operations. For example, an order support agent might follow these rules: Role: You are a customer order support assistant. Responsibilities: - Help users check order information. - Retrieve order details using approved tools. - Explain order status in simple language. Rules: - Never invent an order number or delivery date. - Verify information before reporting a completed action. - Ask for missing information when necessary. - Do not expose private customer information. - Explain tool errors clearly. These instructions establish a predictable foundation for the agent. 3. Connect AI Agents with External Tools An AI agent becomes more useful when it can interact with external systems. For example, an agent may need access to: Customer support platforms. Product information databases. Order management systems. Internal business APIs. Document repositories. Reporting services. Tool integration should follow a clearly defined contract. Each tool should have a specific purpose, expected input parameters, and a predictable output format. Consider an illustrative order lookup tool: def get_order_status(order_id): if not order_id: return { "success": False, "error": "Order ID is required" } order = find_order(order_id) if order is None: return { "success": False, "error": "Order not found" } return { "success": True, "order_id": order_id, "status": order.status } This example demonstrates the expected structure rather than a built-in Microsoft Foundry API. When integrating tools into an agent, developers should also consider authentication, authorization, input validation, API timeouts, and error handling. A tool should only have access to the resources required for its assigned task. 4. Evaluate Agent Responses Before Production Testing an AI agent is not limited to checking whether it produces grammatically correct answers. A response can sound convincing while containing incorrect information. Evaluation should measure multiple aspects of agent performance: Evaluation area What to measure Accuracy Does the response contain correct information? Groundedness Is the response supported by available data? Task completion Did the agent successfully complete the request? Tool selection Did it select the correct tool? Safety Did it follow security and privacy requirements? Consistency Does it behave reliably across similar requests? Microsoft Foundry provides evaluation capabilities that can help teams assess AI application performance. A useful evaluation dataset should contain representative user requests, expected outcomes, and relevant supporting information. For an order support agent, test cases might include: A valid order number. An invalid order number. A missing order number. An order with a pending delivery. An unavailable external service. A request containing instructions that attempt to override the agent's rules. Testing these scenarios helps developers identify weaknesses before releasing the application. 5. Monitor Performance and Identify Errors After deployment, monitoring becomes essential. Real users often submit requests that developers did not consider during initial testing. Monitoring helps teams understand how the agent behaves under actual operating conditions. Important metrics include: Request volume. Response latency. Tool execution time. Failed tool calls. Model token consumption. Evaluation scores. Application exceptions. Microsoft Foundry can be integrated with monitoring and observability services such as Azure Application Insights. Development teams can use monitoring information to identify recurring failures and investigate the underlying causes. For example, if an agent begins responding slowly, developers should investigate whether the issue comes from model processing, external API latency, database queries, or network connectivity. It is important to distinguish infrastructure problems from problems in the agent's instructions or configuration. 6. Implement Responsible AI and Security Controls Reliability also depends on how an AI agent handles sensitive information and potentially harmful requests. Developers should establish security controls before allowing an agent to interact with production systems. Important considerations include: Data protection: Avoid exposing personal or confidential information in responses and logs. Access control: Use appropriate identity and permission mechanisms to restrict access to external resources. Input validation: Validate information received from users before passing it to external tools. Prompt injection protection: Treat retrieved documents, user-provided content, and external tool outputs as untrusted data. Human oversight: Require human approval for sensitive operations such as financial transactions or account changes. Auditability: Maintain appropriate records of important agent actions and failures. Responsible AI practices should be included throughout development rather than added only after deployment. 7. Improve Agent Performance Through Continuous Testing An AI agent should not be considered a finished product after its first successful deployment. Models, instructions, tools, and user requirements can change over time. These changes may improve performance, but they can also introduce unexpected problems. A continuous improvement process can include: Collect representative production traces. Identify frequently occurring errors. Review failed interactions. Update instructions or tool descriptions. Run evaluation tests against the updated configuration. Compare the new results with the previous baseline. Deploy changes only after they pass the required checks. For example, if an order support agent frequently reports incorrect delivery information, developers should investigate whether the issue comes from outdated data, incorrect tool selection, or unsupported response generation. The appropriate fix should address the underlying cause rather than simply changing the wording of the agent's response. 8. Establish a Production Release Checklist Before releasing an AI agent, development teams should verify that the application meets its operational requirements. A practical release checklist includes: Agent instructions have been reviewed. All external tools have defined input and output contracts. Authentication and authorization are configured. Evaluation datasets cover important user scenarios. Critical safety tests have passed. Monitoring and error reporting are enabled. API failures and timeouts are handled correctly. Sensitive operations have appropriate approval controls. A rollback strategy is available. Production performance has been reviewed. These checks help reduce deployment risks and make ongoing maintenance easier. Conclusion Building reliable AI agents requires more than selecting a language model and writing a set of instructions. Developers must consider the entire application lifecycle, including architecture, tool integration, evaluation, monitoring, security, and continuous improvement. Microsoft Foundry offers a platform for developing and evaluating AI applications, while integrations with Azure services can help teams monitor and manage production workloads. By establishing clear agent responsibilities, testing different scenarios, monitoring actual performance, and reviewing every important configuration change, development teams can build AI applications that are more reliable, secure, and maintainable. The most effective approach is to treat AI agent development as an ongoing engineering process rather than a one-time deployment. Next Steps If you are developing AI-powered applications, consider exploring these areas: Microsoft Foundry documentation and agent development. Azure Application Insights for application monitoring. AI evaluation techniques for measuring response quality. Responsible AI principles for production applications. Automated testing and deployment workflows. Start with a small use case, establish measurable performance requirements, and gradually expand your agent's capabilities as your evaluation results improve.32Views0likes0CommentsDebugging a .Net 11 Maui app for iPad
I am using Visual Studio 2026 to develop a .net 11 maui app for an iPad. The iPad is connected to my build map via USB. I understand debugging support on a physical device is not yet supported in .Net 11, but will be in the general release in Novenber. I've tried using the simulator on my windows machine but it is extreamly slow and freezes most of the time. How do I debug and continue development prior to the general release?294Views0likes1Comment.NET
Hi everyone! 👋 I’m new to this community and currently learning .NET App Development. I’m really excited to join and connect with developers here. I believe the discussions and knowledge shared in this community are very valuable, especially for beginners like me. I’m looking forward to learning from your experiences and improving my development skills. If you have any tips, recommended resources, or advice for someone starting with .NET, I would really appreciate it. Happy to be part of this community! 😊497Views3likes2Comments- 86KViews1like9Comments
Is clean architecture overkill for small teams maintaining a single web app ?
I've been exploring clean architecture and while I appreciate its separation of concerns and testability, I can't help but wonder, it is over for small teams ( say 2-4 devs) maintaining a single, relatively stable web application ? Implementing clean architecture means more layers, more interfaces, and potenitally more ceremony, which might slow things down, especially if the team is trying to move quickly or lacks deep experience with the pattern. At the same time, I get the value of long-term maintainability and scalability, even for small projects that could grow. What pain points or benefits did you encounter ? Did it help or hinder onboarding, testing or refactoring ?Solved706Views5likes2CommentsMAUI Android API 35: Action Bar still visible despite NavBarIsVisible=False
Before API 35 it was ok. I am using .NET 9, Android API 35, using Shell, etc. I have tried: Shell.NavBarIsVisible, NavigationPage.HasNavigationBar, theme tweaks, etc. What’s still happening: Title bar remains visible on Android.248Views0likes0CommentsIs it normal for CollectionView to lag on larger lists, or am I missing an optimizaiton ?
I've been working with .NET MAUI recently and have run into some performance concerns when using CollectionView. Specifically, when binding a large dataset ( let's say 500+ items), the scrolling becomes noticeably sluggish, especially on Android I've tried a few basic optimizations, like setting CachingStrategy = "RecycleElement" and minimizing the complexity of the DataTemplate, but the lag persists . I'm not using images or heavy UI elements either, it's just a simple text-based item template. is this kind of lag expected with MAUI's CollectionView or is there a known workaround ? Are there additional performance tuning steps I should try ( virtualization tricks, async loading, grouping) ?Solved845Views7likes2Comments