Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
157928 stories
·
33 followers

Logging & OpenTelemetry in MAF

1 Share

In the rapidly evolving landscape of software development, particularly in the realm of artificial intelligence and automation, the importance of robust logging mechanisms cannot be overstated. This is especially true for multi-agent systems, where numerous agents interact and collaborate to achieve complex tasks. In this post, we will explore the significance of logging in a multi-agent Microsoft Agent Framework application, the trends and innovations in logging practices, real-world use cases, and a practical implementation example.

Importance of Logging

1. Debugging and Monitoring

Logging serves as a vital tool for debugging and monitoring the behavior of agents within a multi-agent system. Given the complexity of interactions among agents, it is crucial to have a clear understanding of their operations. Logs provide insights into the flow of operations, enabling developers to identify issues and rectify them promptly. For instance, if an agent fails to respond to a user query, logs can help trace back the steps leading to the failure, allowing for quicker resolution.

2. Performance Metrics

In addition to aiding in debugging, logging is instrumental in gathering performance metrics. By logging various performance indicators, developers can analyze the efficiency of agents and optimize their operations. This is particularly important in systems where performance directly impacts user experience. For example, logging response times can help identify slow agents, leading to targeted optimizations that enhance overall system performance.

3. Audit Trails

Logging also plays a critical role in maintaining audit trails. In many applications, especially those dealing with sensitive data or compliance requirements, it is essential to have a historical record of actions taken by agents. This not only aids in accountability but also ensures that organizations can meet regulatory requirements. Logs can provide a detailed account of agent interactions, decisions made, and actions taken, which is invaluable during audits.

Key Trends and Innovations

Centralized Logging

One of the best practices in modern software development is the implementation of centralized logging systems. Centralized logging aggregates logs from multiple agents into a single repository, making it easier to analyze and monitor the entire system. This approach simplifies the process of identifying issues that may arise from interactions between agents, as developers can view all relevant logs in one place.

OpenTelemetry Integration

The Microsoft Agent Framework supports OpenTelemetry, a set of APIs, libraries, agents, and instrumentation to provide observability for applications. By integrating OpenTelemetry for tracing and logging, developers can create a coherent timeline of agent interactions and performance metrics. This integration allows for more sophisticated monitoring and analysis, enabling developers to gain deeper insights into their systems.

Real-World Use Cases

Agent Interaction Tracking

In customer service applications, logging can be used to track how agents respond to user queries. By analyzing these logs, organizations can identify patterns in agent behavior, assess the effectiveness of different response strategies, and ultimately improve customer satisfaction. For instance, if logs reveal that certain types of queries consistently lead to longer response times, organizations can provide additional training or resources to agents handling those queries.

Performance Analysis

In logistics and supply chain management, multi-agent systems are often employed to optimize workflows. Logging can help identify bottlenecks in these workflows by providing insights into agent performance. For example, if logs indicate that a particular agent is consistently slow in processing tasks, developers can investigate the underlying causes and implement optimizations to enhance efficiency.

Implementation Example

To illustrate how logging can be implemented in a Microsoft Agent Framework application, consider the following example using C# and OpenTelemetry. This example demonstrates a simple agent that logs its activities during a session.

using Microsoft.Extensions.Logging;
using System;
using System.Diagnostics;

public class Agent
{
    private readonly ILogger<Agent> _logger;
    private readonly ActivitySource _activitySource;

    public Agent(ILogger<Agent> logger)
    {
        _logger = logger;
        _activitySource = new ActivitySource("AgentActivitySource");
    }

    public void StartSession(string sessionId)
    {
        _logger.LogInformation("Starting agent session with ID: {SessionId}", sessionId);
        using (var activity = _activitySource.StartActivity("Agent Session"))
        {
            // Simulate agent interactions
            for (int i = 0; i < 5; i++)
            {
                ProcessInteraction(i);
            }
        }
    }

    private void ProcessInteraction(int interactionCount)
    {
        _logger.LogInformation("Processing interaction #{InteractionCount}", interactionCount);
        // Simulate processing logic
    }
}

Explanation of the Code

In this example, we define an Agent class that utilizes the ILogger interface for logging. The StartSession method initiates a new session and logs the session ID. Within this method, we create an Activity using ActivitySource, which allows us to trace the session’s activities. The ProcessInteraction method simulates processing interactions and logs each interaction count.

This simple implementation showcases how logging can be seamlessly integrated into an agent’s workflow, providing valuable insights into its operations.

Conclusion

Adding logging to a multi-agent application using the Microsoft Agent Framework is essential for effective monitoring, debugging, and performance analysis. By leveraging centralized logging and tools like OpenTelemetry, developers can gain valuable insights into their systems, leading to improved agent performance and user satisfaction. As multi-agent systems continue to grow in complexity, the importance of robust logging practices will only increase, making it a critical component of successful application development.

Incorporating logging not only enhances the reliability of multi-agent systems but also empowers developers to make informed decisions based on real-time data, ultimately driving innovation and efficiency in their applications.

In the next blog post I’ll add this to the Blogger application we saw here.

Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

Activity Source in Microsoft Agent Framework

1 Share

In the rapidly evolving landscape of artificial intelligence, the ability to monitor and debug multi-agent systems is paramount. The Microsoft Agent Framework (MAF) has taken a significant step forward by integrating OpenTelemetry, a powerful observability framework that enhances the monitoring capabilities of AI agents. This post delves into the key features, innovations, and real-world applications of this integration, providing developers with the insights they need to optimize their AI systems.

Understanding the Microsoft Agent Framework and OpenTelemetry

The Microsoft Agent Framework is designed to facilitate the development of intelligent agents that can interact with users and other systems. With the integration of OpenTelemetry, MAF now offers a robust solution for tracking and analyzing agent behavior, performance, and interactions. OpenTelemetry is a set of APIs, libraries, and tools that enable developers to collect and export telemetry data, such as logs and metrics, from their applications. This integration allows for a more comprehensive understanding of how AI agents operate in real-world scenarios.

Key Trends and Innovations

1. Unified Observability

One of the standout features of the MAF’s integration with OpenTelemetry is the support for OpenTelemetry conventions. This allows for a unified timeline of tasks across different agents and tools, which is crucial for understanding the interactions and performance of AI agents in production environments. By providing a coherent view of agent activities, developers can more easily identify patterns and correlations that may impact performance.

2. Instrumentation Layer

The MAF includes an automatic instrumentation layer that tracks various metrics, such as token consumption, interaction durations, and tool usage. This layer is essential for diagnosing issues and optimizing agent performance. By automatically capturing these metrics, developers can focus on building and improving their agents rather than spending time on manual logging and monitoring.

3. Integration with Azure

Another significant advantage of the MAF’s integration with OpenTelemetry is its ability to ship traces to Azure AI Foundry. This centralized monitoring and analysis capability allows teams to gain insights into agent behavior across different environments. By leveraging Azure’s powerful analytics tools, developers can visualize performance metrics and identify areas for improvement.

Real-World Use Cases

The integration of OpenTelemetry into the Microsoft Agent Framework opens up a range of practical applications for developers:

  • Debugging and Evaluation: Developers can utilize OpenTelemetry to trace agent interactions, making it easier to identify bottlenecks or failures in real-time. This capability is invaluable for ensuring that agents perform as expected and for quickly addressing any issues that arise.
  • Performance Monitoring: By tracking metrics such as latency and interaction counts, teams can optimize their agents for better user experiences. Understanding how agents perform under different conditions allows developers to make informed decisions about enhancements and adjustments.

Supporting Data and Quotes

The importance of OpenTelemetry in enhancing observability is underscored by insights from industry experts. According to a Microsoft Tech Community blog post, “OpenTelemetry for traces/spans + attributes (agent, tool, retrieval, latency, tokens)” enables detailed monitoring of agent activities. This level of granularity is essential for developers looking to improve their systems.

As of now, the framework is in public preview (version 1.0.0-rc1), with stable OpenTelemetry contracts guiding its development. This means that developers can start experimenting with these features and provide feedback to shape the future of the framework.

A Simple Explanation of OpenTelemetry

OpenTelemetry can be thought of as a toolkit that helps developers collect and export telemetry data from their applications. In the context of the Microsoft Agent Framework, it allows developers to track how their AI agents are performing, making it easier to spot issues and improve functionality. This is particularly important in complex systems where multiple agents interact with each other and with users.

Code Example: Using OpenTelemetry with the Microsoft Agent Framework

To illustrate how developers can leverage OpenTelemetry within the Microsoft Agent Framework, consider the following C# code example. This snippet demonstrates how to start an activity for an agent session and log interactions using OpenTelemetry:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.Extensions.Logging;

public class Agent
{
    private static readonly ActivitySource activitySource = new ActivitySource("Microsoft.Extensions.AI");

    public void StartSession(string sessionId, ILogger logger)
    {
        logger.LogInformation("Starting agent session with ID: {SessionId}", sessionId);
        using (var activity = activitySource.StartActivity("Agent Session"))
        {
            int interactionCount = 0;
            while (true)
            {
                Console.Write("You (or 'exit' to quit): ");
                var input = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(input) || input.Equals("exit", StringComparison.OrdinalIgnoreCase))
                {
                    logger.LogInformation("User requested to exit the session");
                    break;
                }
                interactionCount++;
                logger.LogInformation("Processing interaction #{InteractionCount}", interactionCount);
                using (var interactionActivity = activitySource.StartActivity("Agent Interaction"))
                {
                    // Simulate processing the input
                }
            }
        }
    }
}

In this example, the StartSession method initiates an agent session and logs each interaction. Each interaction is tracked as a child span, allowing for detailed performance analysis. This approach not only enhances observability but also provides developers with the tools they need to optimize their agents effectively.

Conclusion

The integration of OpenTelemetry into the Microsoft Agent Framework represents a significant advancement in the monitoring and debugging of AI agents. By leveraging these tools, developers can gain valuable insights into their systems, leading to improved performance and user satisfaction.

Read the whole story
alvinashcraft
12 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Announcing Windows 11 Insider Preview Build 28120.2546 for Experimental (26H1)

1 Share
Hello Windows Insiders, Today we're releasing build 28120.2546 for the Experimental (26H1) channel. Release notes can be found over in the Windows Insider Documentation Hub as usual, as well as below:

Changes and improvements gradually being rolled out

- This update includes a small set of general improvements and fixes that improve the overall experience for Insiders running this build on their PCs.

[Smart card removal policy]

- Administrators can now configure Azure Virtual Desktop (AVD) and Windows 365 sessions that use Microsoft Entra ID (RDS AAD Auth) authentication to automatically disconnect when a redirected smart card is removed. This extends smart card removal policy enforcement to Microsoft Entra authenticated remote sessions, helping organizations meet security and compliance requirements.

[Narrator]

- Braille displays now connect instantly with Narrator. - We're making refreshable braille displays easier to use in Windows. Narrator now supports displays that use the HID standard, an open industry standard for braille displays. If your display supports HID, simply connect it via USB and start reading with no additional setup required. - For Bluetooth, pair your HID braille display in **Settings > Bluetooth & devices** just like any other accessory, and you can work wirelessly without being tethered to your PC. - Compatible HID displays include Orbit Reader 20, Orbit Slate 340, Freedom Scientific Focus 40, and APH Mantis Q40. - HID braille displays now work during the initial Windows setup experience (OOBE) over USB, meaning users who are deaf-blind can set up their PC independently right from the first screen. - You can customize braille input and output options anytime in **Settings > Accessibility > Narrator > Braille**.

[Voice Access]

- Voice Access now supports Portuguese (Portugal), Portuguese (Brazil), and Korean (South Korea).

[Settings]

- The Bluetooth quick settings page is now navigable using gamepad input. - Fixed an issue causing the Graphics page in Settings to crash for Insiders after the latest updates.

[Sounds]

- Improved system sounds when using Windows in dark mode. Thanks! Stephen and the Windows Insider Program team
Read the whole story
alvinashcraft
19 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Display Name is for Humans

1 Share

Package identity exists for one primary purpose:

To provide software with a stable and unambiguous way to identify a package.

This is a considerable improvement over the historical tendency to assign UUIDs and GUIDs to nearly everything – including things that humans were expected to discuss in meetings.

Identity Is for Systems

A package’s Name, Package Full Name, and other identity-derived values are intended for developer and system use.

These identifiers prioritize correctness, uniqueness, and programmatic consumption – not clarity or friendliness from an end-user’s perspective.

Identity must remain stable across servicing operations and dependency resolution. If it changes, the system quite reasonably concludes that it is no longer the same package.

DisplayName Is for Humans

That’s where DisplayName comes in.

People use a package’s display name. You’ll typically see it in Start, Settings, installation experiences, and runtime surfaces.

<Package>
  <Identity Name="Contoso.Parts"
            Publisher="CN=Contoso LLC, O=Contoso LLC, L=Paris, C=France"
            Version="1.2.3.4"
            ProcessorArchitecture="x64" />
  <Properties>
    <DisplayName>Contoso Parts 2026</DisplayName>
    ...

Unlike package identity fields, which must remain stable for deployment, runtime and servicing, a display name is free to evolve for branding, marketing, or usability reasons.

Identity tells the system what the package is.

The display name tells the user what it’s called.

Localization varies for the same product. As a result, localized values make poor programmatic identifiers. In addition, branding changes usually affect the display name, not the package identity. The package remains the same package even if marketing decides to call it something else.

Localization

Users speak many languages, so hard-coding a single human-readable string would be somewhat limiting.

To support localization, the value of may be prefixed with ms-resource:. The runtime resolves the value to a localized string for the user’s language and region.

<DisplayName>ms-resource:PackageDisplayName</DisplayName>

Developers can then provide the referenced as multiple language-specific values in the package.

Users may see different strings based on their localization context – all without altering the package’s underlying identity.

TL;DR

  • Package identity is for machines
  • Display name is for humans

Confusing the two tends to make at least one of them unhappy – and occasionally both.

The post Display Name is for Humans appeared first on Inside MSIX.

Read the whole story
alvinashcraft
24 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

AI Prompt Frameworks Explained: A High-Level Guide to Choosing the Right One

1 Share

If you’ve spent any time exploring AI over the past year, you’ve almost certainly come across prompt frameworks. Whether you’re using ChatGPT, Microsoft Copilot, Claude, Gemini, or another large language model, there’s no shortage of acronyms claiming to be the secret to writing the perfect prompt.

The truth is much simpler.

Prompt frameworks aren’t magic formulas. They don’t make an AI model smarter, and they won’t guarantee the perfect response every time. What they do provide is structure. They help you organize your thoughts, communicate your objective more clearly, and consistently produce better results.

Think of them like project management methodologies. Agile, Scrum, and Waterfall all solve similar problems, but each approaches them differently. Prompt frameworks work the same way. They’re simply different ways of organizing your request depending on what you’re trying to achieve.

This article is designed to be a primer. Rather than diving into the mechanics of every framework, we’ll look at what each one is, why it exists, and when you might choose to use it. In future articles, I’ll explore most of the frameworks individually, with practical examples and real-world scenarios.

Further Reading: Every framework mentioned in this article has its own dedicated guide on AI Prompts X. If one catches your attention, follow the link to learn more before we dive deeper into them in future articles.

Why Use a Prompt Framework?

One of the biggest mistakes people make when using AI is assuming they only need to ask a question. Sometimes that’s enough. But as the task becomes more complex, the quality of the response depends heavily on how well you describe what you actually want.

A prompt framework provides a repeatable structure that helps you:

  • Clearly define your objective.
  • Provide meaningful context.
  • Consider your audience.
  • Set expectations for the response.
  • Produce more consistent results.
  • Spend less time rewriting prompts.

The important thing to remember is that there is no “best” framework. The best framework is simply the one that helps you communicate your request most effectively.

Foundational Frameworks

These are excellent starting points if you’re new to structured prompting.

APE: https://aipromptsx.com/prompts/frameworks/ape

A straightforward framework that focuses on defining an action, its purpose, and the expected outcome. It’s one of the easiest ways to begin writing more structured prompts.

AIM: https://aipromptsx.com/prompts/frameworks/aim

AIM emphasizes understanding the intended audience before generating content, making responses more relevant and appropriately targeted.

CLEAR: https://aipromptsx.com/prompts/frameworks/clear

CLEAR encourages conversational prompting while maintaining clarity and direction, making it ideal for everyday interactions with AI.

FOCUS: https://aipromptsx.com/prompts/frameworks/focus

Designed to keep prompts aligned with a specific objective and reduce unnecessary distractions in the response.

SMART: https://aipromptsx.com/prompts/frameworks/smart

Adapted from traditional goal-setting principles, SMART encourages prompts that are specific, realistic, measurable, and clearly defined.

STAR: https://aipromptsx.com/prompts/frameworks/star

Originally used in interview preparation, STAR works particularly well when asking AI to respond to real-world situations or scenarios.

General Purpose Frameworks

As your prompting becomes more sophisticated, these frameworks provide additional structure and flexibility.

4-U: https://aipromptsx.com/prompts/frameworks/4-u

Useful for marketing and persuasive communication by emphasizing usefulness, urgency, uniqueness, and specificity.

ACE: https://aipromptsx.com/prompts/frameworks/ace

Balances audience, context, and execution to produce well-rounded responses across a variety of business tasks.

CARE: https://aipromptsx.com/prompts/frameworks/care

It encourages providing sufficient background information so that AI can produce practical, actionable outputs.

COAST: https://aipromptsx.com/prompts/frameworks/coast

Helps tailor responses toward a specific audience while maintaining an appropriate tone and communication style.

CO-STAR: https://aipromptsx.com/prompts/frameworks/costar

One of the more popular frameworks for professional writing gives greater control over context, audience, tone, style, and formatting.

CRISPE: https://aipromptsx.com/prompts/frameworks/crispe

Introduces role-playing and personality into prompts to produce more engaging and natural responses.

ERA: https://aipromptsx.com/prompts/frameworks/era

Useful when asking AI to approach a problem from a particular area of expertise or professional perspective.

GRADE: https://aipromptsx.com/prompts/frameworks/grade

Focuses on creating repeatable prompts that deliver consistent results across similar tasks.

GUIDE: https://aipromptsx.com/prompts/frameworks/guide

Keeps the user’s objective front and center, ensuring the AI remains focused on solving the actual problem.

IDEA: https://aipromptsx.com/prompts/frameworks/idea

Designed for brainstorming, innovation, and exploring multiple possibilities before selecting a solution.

MARK: https://aipromptsx.com/prompts/frameworks/mark

A framework aimed at marketing strategy, messaging, and campaign planning rather than simply generating content.

PECRA: https://aipromptsx.com/prompts/frameworks/pecra

Begins by establishing the purpose behind the request, helping AI produce recommendations that align with the bigger picture.

PRIME: https://aipromptsx.com/prompts/frameworks/prime

Ideal for projects where defining objectives, expectations, and requirements up front yields more complete responses.

RACE: https://aipromptsx.com/prompts/frameworks/race

Introduces the concept of assigning the AI a specific role before asking it to complete a task.

RASCEF: https://aipromptsx.com/prompts/frameworks/rascef

Expands prompts with additional context, examples, and structure to improve consistency across larger pieces of work.

RISE: https://aipromptsx.com/prompts/frameworks/rise

Combines clearly defined roles with instructions and examples to guide AI toward predictable outputs.

RISEN: https://aipromptsx.com/prompts/frameworks/risen

Builds on role-based prompting by adding explicit goals and constraints to achieve more focused responses.

SCOPE: https://aipromptsx.com/prompts/frameworks/scope

Encourages understanding of the overall situation before asking AI to produce recommendations or plans.

STEP: https://aipromptsx.com/prompts/frameworks/step

Provides a structured approach to planning, evaluating options, and making decisions.

Advanced Frameworks

These frameworks are often used for larger, more strategic, or analytical tasks.

CHAIN: https://aipromptsx.com/prompts/frameworks/chain

Designed to encourage structured reasoning and logical progression through more complicated problems.

ROSES: https://aipromptsx.com/prompts/frameworks/roses

Combines objectives, scenarios, examples, and presentation style to support strategic planning and consulting-style work.

TRACE: https://aipromptsx.com/prompts/frameworks/trace

Places strong emphasis on context, audience, evaluation, and quality, making it well-suited to research and analytical tasks.

Which Framework Should You Learn First?

The good news is that you don’t need to memorize dozens of frameworks. Most people naturally settle on three or four that fit the type of work they do most often.

If you’re just getting started, I’d suggest beginning with:

  • APE for everyday prompting.
  • SMART for planning and objectives.
  • STAR for scenarios and problem solving.
  • RACE for professional tasks.
  • CO-STAR for content creation.
  • RISEN for more detailed business requests.

As your confidence grows, you’ll naturally discover which frameworks best match your own workflow.

Final Thoughts

Prompt engineering isn’t about collecting acronyms. It’s about communicating more effectively with AI. Frameworks simply provide different ways to organize your thoughts before asking the model to do something. Some are intentionally simple. Others are designed for research, planning, analysis, or creative work. None of them is inherently better than another; they simply solve different problems.

Over the next few weeks, I’ll be taking a few of these frameworks individually, explaining how they work, where they excel, and how you can use them to build prompts that are clearer, more consistent, and ultimately more effective. The goal isn’t to learn twenty-eight different frameworks. The goal is to find the few that fit your way of working and use them well.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

The State of Simulation for Physical AI: An Overview

1 Share
Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories