Skip to content

Conversation

@heyitsaamir
Copy link
Collaborator

We had this experimental class called Agents that was basically a "stateful" ChatPrompt. To align with other languages, this class doesn't add much value, and is taking on additional support pressure. So I'm going to remove it in interest of just ChatPrompt.

ChatPrompt now supports "memory" so if you give it memory when you construct it, it'll use that memory instance for subsequent calls (which is basically what Agent did).

So TLDR: Change Agent to ChatPrompt in your code to migrate.

Copilot AI review requested due to automatic review settings November 15, 2025 20:42
Copilot finished reviewing on behalf of heyitsaamir November 15, 2025 20:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the experimental Agent class and consolidates its functionality into ChatPrompt by adding an optional memory parameter to the ChatPrompt constructor. This change aligns the Python SDK with other language implementations and reduces API surface area.

Key changes:

  • Added optional memory parameter to ChatPrompt.__init__() to enable stateful conversations
  • Modified ChatPrompt.send() to use constructor-provided memory as default when no explicit memory is passed
  • Removed the entire Agent class and its module
  • Updated all test applications to use ChatPrompt instead of Agent

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/ai/src/microsoft/teams/ai/chat_prompt.py Added memory parameter to constructor and updated send() to use it as fallback
packages/ai/src/microsoft/teams/ai/agent.py Deleted the entire Agent class implementation
packages/ai/src/microsoft/teams/ai/init.py Removed Agent from exports
tests/mcp-client/src/main.py Replaced Agent with ChatPrompt, updated variable names and comments
tests/mcp-client/README.md Updated documentation to reference ChatPrompt instead of Agent
tests/ai-test/src/main.py Replaced Agent with ChatPrompt in multiple handlers
tests/ai-test/src/handlers/memory_management.py Replaced Agent with ChatPrompt in stateful conversation handler
tests/ai-test/src/handlers/function_calling.py Replaced Agent with ChatPrompt in function calling examples
tests/ai-test/README.md Updated documentation to remove Agent reference

self,
model: AIModel,
*,
memory: Memory | None = None,
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new memory parameter in the ChatPrompt constructor lacks test coverage. While the existing tests verify memory functionality when passed to send(), there are no tests verifying that memory set in the constructor is properly used as a default. Consider adding a test that creates a ChatPrompt with memory in the constructor and verifies it's used across multiple send() calls without explicitly passing memory each time.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you make sure we test the case with a memory in constructor at least once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants