Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Document generator agent framework demo #10184

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Jan 14, 2025

Motivation and Context

We currently don't have a demo sample that shows how to use the agent framework with multiple agents end-to-end. End-to-end means starting from a task, designing the agents, and observing the agents.

Description

This PR adds a demo app that shows how to use the agent framework with multiple agents to generate technical documents for Semantic Kernel. This automation will greatly improve our productivity in creating more contents.

This sample contains 3 agents, multiple plugins, and the necessary steps to make the agents observable.
image

Note that this PR can be a starting point for discussion on how we can further improve the agent framework.

Contribution Checklist

@TaoChenOSU TaoChenOSU added python Pull requests for the Python Semantic Kernel agents labels Jan 14, 2025
@TaoChenOSU TaoChenOSU self-assigned this Jan 14, 2025
@TaoChenOSU TaoChenOSU requested a review from a team as a code owner January 14, 2025 18:30
@github-actions github-actions bot changed the title Document generator agent framework demo Python: Document generator agent framework demo Jan 14, 2025
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL16683177689% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
3000 4 💤 0 ❌ 0 🔥 1m 21s ⏱️

return kernel

@override
async def invoke(self, history: ChatHistory) -> AsyncIterable[ChatMessageContent]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to override this method to wrap an agent invocation in a span whose name is the name of the agent. This is a requested feature which we can bring to the agent framework: #10174

cloned_history = history.model_copy(deep=True)
cloned_history.add_user_message_str(
"Now validate the Python code in the latest document draft and summarize any errors."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I notice in group chats, agents often struggle with following the system prompt. An agent will try to continue the conversation instead of executing the task it's given. Adding a user message here can prevent the agent from trying to continue the conversation.

if content:
chat_history.add_message(message)

chat_history.add_user_message_str(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In termination and selection strategies, having a user message here also helps to prevent the agent from continueing the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents documentation python Pull requests for the Python Semantic Kernel
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants