{"id":5995,"library":"microsoft-agents-activity","title":"Microsoft Agents Activity Protocol Library","description":"The `microsoft-agents-activity` library is a fundamental component of the Microsoft 365 Agents SDK for Python. It provides the core types and schemas, implementing the Activity Protocol Specification, which standardizes communication between AI agents, users, and various channels such as Microsoft Teams, M365 Copilot, Copilot Studio, and web chat. This protocol handles diverse interaction types including messages, typing indicators, conversation updates, events, invokes, and end-of-conversation signals. The SDK aims to facilitate the creation of robust, multichannel, and trusted agents for enterprise systems, allowing developers to integrate agents regardless of their underlying provider or technology stack. The current version of this specific library is 0.8.0.","status":"active","version":"0.8.0","language":"en","source_language":"en","source_url":"https://github.com/microsoft/Agents","tags":["microsoft","agents","ai","conversational-ai","sdk","protocol","bot-framework"],"install":[{"cmd":"pip install microsoft-agents-activity","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for web hosting a functional agent built with the Microsoft 365 Agents SDK, which utilizes `microsoft-agents-activity` types.","package":"aiohttp","optional":true},{"reason":"Needed for authentication when creating agents that interact with Azure AI services, a common use case within the broader Microsoft Agent Framework.","package":"azure-identity","optional":true}],"imports":[{"symbol":"Activity","correct":"from microsoft_agents.activity import Activity"},{"symbol":"ActivityTypes","correct":"from microsoft_agents.activity import ActivityTypes"}],"quickstart":{"code":"import asyncio\nfrom microsoft_agents.activity import Activity, ActivityTypes\nimport os\n\nasync def main():\n    # Simulate an incoming message activity (e.g., from a user in Teams)\n    incoming_activity = Activity.from_object({\n        \"type\": ActivityTypes.Message,\n        \"id\": \"msg123\",\n        \"timestamp\": \"2026-04-14T18:00:00Z\",\n        \"channelId\": os.environ.get('TEST_CHANNEL_ID', 'test_channel'),\n        \"from\": {\"id\": \"user123\", \"name\": \"Test User\"},\n        \"conversation\": {\"id\": \"conv123\", \"conversationType\": \"personal\"},\n        \"recipient\": {\"id\": \"bot456\", \"name\": \"Test Bot\"},\n        \"text\": \"Hello bot, how are you?\",\n        \"locale\": \"en-US\"\n    })\n\n    print(f\"Incoming Activity Text: {incoming_activity.text}\")\n    print(f\"Incoming Activity Sender: {incoming_activity.from_property.name}\")\n\n    # Create a reply activity using the incoming activity's context\n    reply_activity = incoming_activity.create_reply(\"Hello there, Test User! I'm doing well, thanks for asking.\")\n\n    print(f\"\\nReply Activity Type: {reply_activity.type}\")\n    print(f\"Reply Activity Text: {reply_activity.text}\")\n    print(f\"Reply Activity Recipient: {reply_activity.recipient.name}\")\n    print(f\"Reply Activity To ID: {reply_activity.reply_to_id}\")\n\nif __name__ == \"__main__\":\n    # Example of setting an environment variable for demonstration\n    os.environ['TEST_CHANNEL_ID'] = 'mock_channel_001'\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to create and manipulate `Activity` objects, the core data structure handled by the `microsoft-agents-activity` library. It simulates an incoming message and then shows how to generate a reply activity using built-in methods, showcasing the protocol's core functionality."},"warnings":[{"fix":"Ensure you install and configure a hosting package (e.g., `microsoft-agents-hosting-aiohttp`) and implement your agent logic using `AgentApplication` or similar classes from the broader SDK.","message":"The `microsoft-agents-activity` library defines the protocol (types and schemas) for interactions, but it does not provide agent hosting or core logic. To build a runnable AI agent, you must use additional packages from the Microsoft 365 Agents SDK, such as `microsoft-agents-hosting-aiohttp` for web hosting and `microsoft_agents.hosting.core.AgentApplication` for agent logic.","severity":"gotcha","affected_versions":"All versions"},{"fix":"As a workaround, instead of updating an existing activity (e.g., a 'thinking...' message), send a new activity (e.g., delete the 'thinking' message and send the final response). Monitor official documentation and GitHub issues for future support.","message":"The `microsoft-agents-hosting` SDK (which works with `microsoft-agents-activity` objects) does not fully support the `updateActivity` pattern commonly found in Bot Framework. Attempts to use `context.updateActivity()` will likely fail with a `TypeError: activity.applyConversationReference is not a function`.","severity":"gotcha","affected_versions":"< 1.0.0 of microsoft-agents-hosting (and related SDK components)"},{"fix":"While `microsoft-agents-activity` is still at 0.8.0, anticipate potential breaking changes in future minor or major releases to align with the framework's 1.0 status. For agent management, review `Agent 365` documentation for re-registration procedures if you are using the deprecated Entra admin center features.","message":"The broader Microsoft Agent Framework, of which `microsoft-agents-activity` is a part, has announced a v1.0 release as of April 2, 2026. Additionally, the Agent registry and Agent collections blades in the Entra admin center are being retired on May 1, 2026, with Agent 365 becoming the unified registry. The existing registry Graph API will be deprecated and replaced.","severity":"breaking","affected_versions":"All pre-1.0 versions of `microsoft-agents-activity` and related SDK components. Impacts agent deployment and management."},{"fix":"Check the prerequisites for any advanced features you plan to use and verify access to preview programs if necessary.","message":"Some advanced features and quickstarts related to the Microsoft 365 Agents SDK (e.g., specific Agent 365 capabilities) might require participation in the 'Frontier preview program'. This means not all documented features may be immediately available or stable for general production use.","severity":"gotcha","affected_versions":"All versions, depending on the specific feature."}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}