Friday, January 2, 2026

Agentic AI Framework - Autogen

  • Autogen Framework Overview
    • Autogen Framework Introduction:  Autogen as an open-source framework from Microsoft, highlighting its asynchronous, event-driven architecture. The framework addresses issues such as observability, flexibility, control, and scalability in multi-agent systems.
    • Versioning and Package Management Issues:  highlighted that installing Autogen via pip currently defaults to AG2, not the Microsoft version.
  • Core Concepts and Components of Autogen: 
    • Autogen Core: Autogen Core serves as a generic, scalable runtime for multi-agent systems, managing messaging and agent interactions.
    • Agent Chat provides a lightweight abstraction for constructing agent-based workflows with LLMs and tool integrations.
    • Studio: Studio is a low-code/no-code visual app for building agent workflows.
    • Magentic One: Magentic One is a command-line application for running agents, both positioned as research tools rather than production-ready solutions.
    • Open Source and Research Focus: Autogen is developed as a Microsoft Research community project, with contributions from a broad base and a focus on open-source research rather than commercialization.
    • Key focus Areas: primarily work with Autogen Core and Agent Chat, avoiding the low-code/no-code tools.
  • Building Blocks: Models, Messages, and Agents: 
    • Model Abstraction: The model abstraction in Autogen wraps LLMs such as GPT-4 O mini or other models like Llama.
    • Message Objects: Messages are core objects representing communication between agents, users, or internal tool calls, and can be simple text or multimodal (including images).
    • Agent Creation: Agents are instantiated with a model client, a name, and a system message, and can be configured to stream results. The Assistant Agent class is the primary agent type used.
    • Agent Interaction via on_messages: The on_messages method is used to pass messages to agents asynchronously.
  • Tool Integration and Database Access: 
    • Database Setup and Query Tool: A SQLite database was created and populated with city and ticket price data. A Python function was implemented to query ticket prices by city, serving as a tool for the agent.
    • Tool Integration Simplicity: Autogen allows direct passing of Python functions as tools without decorators or wrappers, simplifying the process and reducing boilerplate.
    • Agent Tool Usage Example: An agent was configured with the ticket price lookup tool and demonstrated querying the database and returning a humorous, context-aware response to a user message.
    • Reflect on Tool Use Attribute: The reflect_on_tool_use attribute ensures that agents can process tool results and continue the conversation, rather than stopping after a tool call.
  • Advanced Features: Multimodal Messages and Structured Outputs: 
    • Multimodal Message Handling: Autogen supports multimodal messages, allowing users to send images alongside text.
    • Structured Output with Pydantic: Structured outputs are easily achieved by specifying a Pydantic model as the expected output type.
  • Langchain Tool Integration:
    • Langchain Tool Adapter Usage: The Langchain tool adapter allows any Langchain tool to be wrapped and used as an Autogen tool, facilitating seamless integration between the two ecosystems.
    • Agent Task Execution: An agent was tasked with finding flights, using the integrated tools to search online, write results to a file, and select the best option, demonstrating the practical utility of tool integration. 
  • Introduction to MCP Tools in Autogen: 
    • Integration with Autogen: Autogen provides wrappers that enable users to easily incorporate any MCP-compliant tool, such as MCP Server Fetch, into their workflows, allowing for seamless tool usage without requiring additional glue code.
    • MCP Server Fetch Example: The session included a practical example where the MCP Server Fetch tool, which runs a headless Playwright browser to scrape web pages, was run locally and used within Autogen to review and summarize a website, with the assistant replying in Markdown.
    • Open Ecosystem and Community Tools: MCP's open standard allows anyone to write and share tools, creating a large, public, and open-source ecosystem accessible from within Autogen.
  • Comparison of Microsoft Semantic Kernel and Autogen Core: 
    • Semantic Kernel Overview: Microsoft Semantic Kernel is a framework similar to Langchain, focusing on wrapping calls to large language models (LLMs), handling memory, tool calling, plugins, and prompt templating for business-oriented tasks.
    • Autogen Core Focus: Autogen Core is more agent-focused, designed for building autonomous agentic applications, and is distinct from Semantic Kernel; it orchestrates LLM calls for business logic.
    • Overlap and Use Cases: There is some overlap between Semantic Kernel and Autogen Core.
  • Interactions and Multi-Agent Workflows: 
    • Agent Roles: Multiple agents (e.g., Primary and Evaluator) were created with distinct roles and prompts, collaborating to find and evaluate flight options in a round-robin group chat.
    • Termination Conditions: set based on the evaluator agent replying with 'approve', which signals the end of the workflow.  noted that more robust conditions are advisable for production use.
    • Managing Conversation Flow: the risk of agents entering infinite loops or excessive back-and-forth, recommending prompt tuning and kernel restarts to manage runaway conversations, as Autogen lacks built-in recursion limits.
  • Introduction to Autogen Core and Its Architecture: 
    • Agent Interaction Framework: Autogen Core is a framework for managing interactions between agents, regardless of the underlying platform, programming language, or abstraction used to implement the agents.
    • Standalone vs Distributed Runtimes: Autogen Core supports two runtime types:
      • standalone (local, single-machine)
      • distributed (enabling remote, cross-process agent interactions).
    • Decoupling Logic and Messaging: The framework separates agent logic from message delivery, handling agent lifecycle and communication, while developers are responsible for the agent's internal logic.
    • Comparison between Autogen Core and LangGraph
      • Both manage agent interactions
      • LangGraph emphasizes robustness and replayability,
      • Autogen Core focuses on supporting diverse, distributed agent interactions.
  • Overview of Autogen Core Distributed Runtime: 
    • Distributed Runtime Architecture: The distributed runtime comprises a host service that manages connections and message delivery, and one or more worker runtimes that register and execute agents.
    • Session and Message Management: Direct messages are handled via GRPC sessions, with the framework managing the complexities of remote message delivery between processes, potentially in different languages.
    • Experimental Nature and Use Cases: emphasized that the distributed runtime is experimental, as an architectural preview, not for production use.
  • Autogen Documentation Confusionconfusion arising from differences between AG2 and Microsoft Autogen documentation for users.

 Still in progress 

No comments:

Post a Comment