AgentNotification 클래스

Microsoft 365 애플리케이션의 에이전트 알림 처리기입니다.

이 클래스는 다양한 Microsoft 365 채널 및 하위 채널의 알림에 응답하는 처리기를 등록하기 위한 데코레이터를 제공합니다. 채널 ID, 하위 채널 및 수명 주기 이벤트를 기반으로 라우팅을 지원합니다.

생성자

AgentNotification()

매개 변수

Name Description
app
필수

라우트된 알림을 처리할 애플리케이션 인스턴스입니다.

known_subchannels

인식된 하위 채널의 선택적 반복 가능 None이면 AgentSubChannel 열거형의 모든 값이 기본값으로 설정됩니다.

Default value: None
known_lifecycle_events

인식된 수명 주기 이벤트의 선택적 반복 가능 None이면 AgentLifecycleEvent 열거형의 모든 값이 기본값으로 설정됩니다.

Default value: None

예제


   from microsoft_agents.hosting import Application
   from microsoft_agents_a365.notifications import AgentNotification

   app = Application()
   notifications = AgentNotification(app)

   @notifications.on_email()
   async def handle_email(context, state, notification):
       email = notification.email
       if email:
           await context.send_activity(f"Received email: {email.id}")

메서드

__init__
__new__
on_agent_lifecycle_notification

에이전트 수명 주기 이벤트 알림에 대한 처리기를 등록합니다.

이 데코레이터는 사용자 만들기, 삭제 또는 워크로드 온보딩 업데이트와 같은 수명 주기 이벤트가 발생할 때 호출할 처리기 함수를 등록합니다.

on_agent_notification

특정 채널 및 하위 채널의 알림에 대한 처리기를 등록합니다.

이 데코레이터는 지정된 채널 및 선택적 하위 채널에서 알림을 받을 때 호출할 처리기 함수를 등록합니다. 처리기는 형식화된 AgentNotificationActivity 래퍼를 받습니다.

on_email

Outlook 전자 메일 알림에 대한 처리기를 등록합니다.

전자 메일 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_excel

Microsoft Excel 주석 알림에 대한 처리기를 등록합니다.

Excel 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_lifecycle

모든 에이전트 수명 주기 이벤트 알림에 대한 처리기를 등록합니다.

와일드카드 "*" 선택기를 사용하여 모든 수명 주기 이벤트에 대한 처리기를 등록하는 편리한 데코레이터입니다.

on_powerpoint

Microsoft PowerPoint 주석 알림에 대한 처리기를 등록합니다.

PowerPoint 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_user_created

사용자 만들기 수명 주기 이벤트에 대한 처리기를 등록합니다.

에이전트 사용자 ID 생성 이벤트에 대한 처리기를 특별히 등록하는 편리한 데코레이터입니다.

on_user_deleted

사용자 삭제 수명 주기 이벤트에 대한 처리기를 등록합니다.

에이전트 사용자 ID 삭제 이벤트에 대한 처리기를 특별히 등록하는 편리한 데코레이터입니다.

on_user_workload_onboarding

사용자 워크로드 온보딩 업데이트 이벤트에 대한 처리기를 등록합니다.

사용자의 워크로드 온보딩 상태가 업데이트되면 발생하는 이벤트에 대한 처리기를 등록하는 편리한 데코레이터입니다.

on_word

Microsoft Word 주석 알림에 대한 처리기를 등록합니다.

Word 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

__init__

__init__(app: Any, known_subchannels: Iterable[str | AgentSubChannel] | None = None, known_lifecycle_events: Iterable[str | AgentLifecycleEvent] | None = None)

매개 변수

Name Description
app
필수
Any
known_subchannels
Default value: None
known_lifecycle_events
Default value: None

__new__

__new__(**kwargs)

on_agent_lifecycle_notification

에이전트 수명 주기 이벤트 알림에 대한 처리기를 등록합니다.

이 데코레이터는 사용자 만들기, 삭제 또는 워크로드 온보딩 업데이트와 같은 수명 주기 이벤트가 발생할 때 호출할 처리기 함수를 등록합니다.

on_agent_lifecycle_notification(lifecycle_event: str, **kwargs: Any)

매개 변수

Name Description
lifecycle_event
필수
str

수신 대기할 수명 주기 이벤트입니다. "*"를 사용하여 모든 수명 주기 이벤트를 일치하거나 AgentLifecycleEvent에서 특정 이벤트를 지정합니다.

**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_agent_lifecycle_notification("agenticuseridentitycreated")
   async def handle_user_created(context, state, notification):
       print("New user created")

on_agent_notification

특정 채널 및 하위 채널의 알림에 대한 처리기를 등록합니다.

이 데코레이터는 지정된 채널 및 선택적 하위 채널에서 알림을 받을 때 호출할 처리기 함수를 등록합니다. 처리기는 형식화된 AgentNotificationActivity 래퍼를 받습니다.

on_agent_notification(channel_id: ChannelId, **kwargs: Any)

매개 변수

Name Description
channel_id
필수

수신 대기할 채널 및 선택적 하위 채널을 지정하는 채널 ID입니다. "*"를 하위 채널로 사용하여 모든 하위 채널과 일치합니다.

**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   from microsoft_agents.activity import ChannelId

   @notifications.on_agent_notification(
       ChannelId(channel="agents", sub_channel="email")
   )
   async def handle_custom_channel(context, state, notification):
       print(f"Received notification on {notification.channel}/{notification.sub_channel}")

on_email

Outlook 전자 메일 알림에 대한 처리기를 등록합니다.

전자 메일 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_email(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_email()
   async def handle_email(context, state, notification):
       email = notification.email
       if email:
           print(f"Received email: {email.id}")
           response = EmailResponse.create_email_response_activity(
               "<p>Thank you for your email.</p>"
           )
           await context.send_activity(response)

on_excel

Microsoft Excel 주석 알림에 대한 처리기를 등록합니다.

Excel 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_excel(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_excel()
   async def handle_excel_comment(context, state, notification):
       comment = notification.wpx_comment
       if comment:
           print(f"Received Excel comment: {comment.comment_id}")

on_lifecycle

모든 에이전트 수명 주기 이벤트 알림에 대한 처리기를 등록합니다.

와일드카드 "*" 선택기를 사용하여 모든 수명 주기 이벤트에 대한 처리기를 등록하는 편리한 데코레이터입니다.

on_lifecycle(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_lifecycle()
   async def handle_any_lifecycle_event(context, state, notification):
       print(f"Lifecycle event type: {notification.notification_type}")

on_powerpoint

Microsoft PowerPoint 주석 알림에 대한 처리기를 등록합니다.

PowerPoint 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_powerpoint(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_powerpoint()
   async def handle_powerpoint_comment(context, state, notification):
       comment = notification.wpx_comment
       if comment:
           print(f"Received PowerPoint comment: {comment.comment_id}")

on_user_created

사용자 만들기 수명 주기 이벤트에 대한 처리기를 등록합니다.

에이전트 사용자 ID 생성 이벤트에 대한 처리기를 특별히 등록하는 편리한 데코레이터입니다.

on_user_created(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_user_created()
   async def handle_user_created(context, state, notification):
       print("New agentic user identity created")

on_user_deleted

사용자 삭제 수명 주기 이벤트에 대한 처리기를 등록합니다.

에이전트 사용자 ID 삭제 이벤트에 대한 처리기를 특별히 등록하는 편리한 데코레이터입니다.

on_user_deleted(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_user_deleted()
   async def handle_user_deleted(context, state, notification):
       print("Agentic user identity deleted")

on_user_workload_onboarding

사용자 워크로드 온보딩 업데이트 이벤트에 대한 처리기를 등록합니다.

사용자의 워크로드 온보딩 상태가 업데이트되면 발생하는 이벤트에 대한 처리기를 등록하는 편리한 데코레이터입니다.

on_user_workload_onboarding(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_user_workload_onboarding()
   async def handle_onboarding_update(context, state, notification):
       print("User workload onboarding status updated")

on_word

Microsoft Word 주석 알림에 대한 처리기를 등록합니다.

Word 하위 채널의 알림 처리기를 등록하는 편리한 데코레이터입니다.

on_word(**kwargs: Any) -> Callable[[Callable[[TContext, TState, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

매개 변수

Name Description
**kwargs
필수
Any

앱의 add_route 메서드에 전달된 추가 키워드 인수입니다.

반품

형식 Description
Callable[[Callable[[<xref:microsoft_agents_a365.notifications.agent_notification.TContext>, <xref:microsoft_agents_a365.notifications.agent_notification.TState>, AgentNotificationActivity], Awaitable[None]]], Callable[[TurnContext, TurnState], Awaitable[None]]]

처리기를 애플리케이션에 등록하는 데코레이터 함수입니다.

예제


   @notifications.on_word()
   async def handle_word_comment(context, state, notification):
       comment = notification.wpx_comment
       if comment:
           print(f"Received Word comment: {comment.comment_id}")