HelloAgents App Host with xlang sample (#4395)

* adds a python xlang sample and aspire code to host it
* fixes message delivery on dotnet runtime
This commit is contained in:
Ryan Sweet
2024-12-03 08:09:02 -08:00
committed by GitHub
parent c062c510b7
commit 1c09de8d47
28 changed files with 631 additions and 81 deletions

View File

@@ -1,7 +1,6 @@
import json
import logging
from typing import Any, List, Dict
from .... import TRACE_LOGGER_NAME
from typing import Any, Dict, List
from autogen_core.base import AgentId, CancellationToken, MessageContext
from autogen_core.components import DefaultTopicId, Image, event, rpc
@@ -12,8 +11,10 @@ from autogen_core.components.models import (
UserMessage,
)
from .... import TRACE_LOGGER_NAME
from ....base import Response, TerminationCondition
from ....messages import AgentMessage, MultiModalMessage, StopMessage, TextMessage, ChatMessage
from ....messages import AgentMessage, ChatMessage, MultiModalMessage, StopMessage, TextMessage
from .._base_group_chat_manager import BaseGroupChatManager
from .._events import (
GroupChatAgentResponse,
GroupChatMessage,
@@ -22,7 +23,6 @@ from .._events import (
GroupChatStart,
GroupChatTermination,
)
from .._base_group_chat_manager import BaseGroupChatManager
from ._prompts import (
ORCHESTRATOR_FINAL_ANSWER_PROMPT,
ORCHESTRATOR_PROGRESS_LEDGER_PROMPT,

View File

@@ -82,7 +82,7 @@ dev-dependencies = [
[tool.ruff]
extend = "../../pyproject.toml"
exclude = ["build", "dist", "src/autogen_core/application/protos", "tests/protos"]
exclude = ["build", "dist", "src/autogen_core/application/protos", "tests/protos", "samples/protos"]
include = ["src/**", "samples/*.py", "docs/**/*.ipynb", "tests/**"]
[tool.ruff.lint.per-file-ignores]
@@ -92,7 +92,7 @@ include = ["src/**", "samples/*.py", "docs/**/*.ipynb", "tests/**"]
[tool.pyright]
extends = "../../pyproject.toml"
include = ["src", "tests", "samples"]
exclude = ["src/autogen_core/application/protos", "tests/protos"]
exclude = ["src/autogen_core/application/protos", "tests/protos", "samples/protos"]
reportDeprecated = true
[tool.pytest.ini_options]

View File

@@ -0,0 +1,8 @@
"""
The :mod:`autogen_core.worker.protos` module provides Google Protobuf classes for agent-worker communication
"""
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: agent_events.proto
# Protobuf Python Version: 4.25.1
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x12\x61gent_events.proto\x12\x06\x61gents"2\n\x0bTextMessage\x12\x13\n\x0btextMessage\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t"\x18\n\x05Input\x12\x0f\n\x07message\x18\x01 \x01(\t"\x1f\n\x0eInputProcessed\x12\r\n\x05route\x18\x01 \x01(\t"\x19\n\x06Output\x12\x0f\n\x07message\x18\x01 \x01(\t"\x1e\n\rOutputWritten\x12\r\n\x05route\x18\x01 \x01(\t"\x1a\n\x07IOError\x12\x0f\n\x07message\x18\x01 \x01(\t"%\n\x12NewMessageReceived\x12\x0f\n\x07message\x18\x01 \x01(\t"%\n\x11ResponseGenerated\x12\x10\n\x08response\x18\x01 \x01(\t"\x1a\n\x07GoodBye\x12\x0f\n\x07message\x18\x01 \x01(\t" \n\rMessageStored\x12\x0f\n\x07message\x18\x01 \x01(\t";\n\x12\x43onversationClosed\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x14\n\x0cuser_message\x18\x02 \x01(\t"\x1b\n\x08Shutdown\x12\x0f\n\x07message\x18\x01 \x01(\tB!\xaa\x02\x1eMicrosoft.AutoGen.Abstractionsb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "agent_events_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
_globals["DESCRIPTOR"]._options = None
_globals["DESCRIPTOR"]._serialized_options = b"\252\002\036Microsoft.AutoGen.Abstractions"
_globals["_TEXTMESSAGE"]._serialized_start = 30
_globals["_TEXTMESSAGE"]._serialized_end = 80
_globals["_INPUT"]._serialized_start = 82
_globals["_INPUT"]._serialized_end = 106
_globals["_INPUTPROCESSED"]._serialized_start = 108
_globals["_INPUTPROCESSED"]._serialized_end = 139
_globals["_OUTPUT"]._serialized_start = 141
_globals["_OUTPUT"]._serialized_end = 166
_globals["_OUTPUTWRITTEN"]._serialized_start = 168
_globals["_OUTPUTWRITTEN"]._serialized_end = 198
_globals["_IOERROR"]._serialized_start = 200
_globals["_IOERROR"]._serialized_end = 226
_globals["_NEWMESSAGERECEIVED"]._serialized_start = 228
_globals["_NEWMESSAGERECEIVED"]._serialized_end = 265
_globals["_RESPONSEGENERATED"]._serialized_start = 267
_globals["_RESPONSEGENERATED"]._serialized_end = 304
_globals["_GOODBYE"]._serialized_start = 306
_globals["_GOODBYE"]._serialized_end = 332
_globals["_MESSAGESTORED"]._serialized_start = 334
_globals["_MESSAGESTORED"]._serialized_end = 366
_globals["_CONVERSATIONCLOSED"]._serialized_start = 368
_globals["_CONVERSATIONCLOSED"]._serialized_end = 427
_globals["_SHUTDOWN"]._serialized_start = 429
_globals["_SHUTDOWN"]._serialized_end = 456
# @@protoc_insertion_point(module_scope)

View File

@@ -0,0 +1,197 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.message
import typing
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
@typing.final
class TextMessage(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
TEXTMESSAGE_FIELD_NUMBER: builtins.int
SOURCE_FIELD_NUMBER: builtins.int
textMessage: builtins.str
source: builtins.str
def __init__(
self,
*,
textMessage: builtins.str = ...,
source: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["source", b"source", "textMessage", b"textMessage"]) -> None: ...
global___TextMessage = TextMessage
@typing.final
class Input(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___Input = Input
@typing.final
class InputProcessed(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
ROUTE_FIELD_NUMBER: builtins.int
route: builtins.str
def __init__(
self,
*,
route: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["route", b"route"]) -> None: ...
global___InputProcessed = InputProcessed
@typing.final
class Output(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___Output = Output
@typing.final
class OutputWritten(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
ROUTE_FIELD_NUMBER: builtins.int
route: builtins.str
def __init__(
self,
*,
route: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["route", b"route"]) -> None: ...
global___OutputWritten = OutputWritten
@typing.final
class IOError(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___IOError = IOError
@typing.final
class NewMessageReceived(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___NewMessageReceived = NewMessageReceived
@typing.final
class ResponseGenerated(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
RESPONSE_FIELD_NUMBER: builtins.int
response: builtins.str
def __init__(
self,
*,
response: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["response", b"response"]) -> None: ...
global___ResponseGenerated = ResponseGenerated
@typing.final
class GoodBye(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___GoodBye = GoodBye
@typing.final
class MessageStored(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___MessageStored = MessageStored
@typing.final
class ConversationClosed(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
USER_ID_FIELD_NUMBER: builtins.int
USER_MESSAGE_FIELD_NUMBER: builtins.int
user_id: builtins.str
user_message: builtins.str
def __init__(
self,
*,
user_id: builtins.str = ...,
user_message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["user_id", b"user_id", "user_message", b"user_message"]) -> None: ...
global___ConversationClosed = ConversationClosed
@typing.final
class Shutdown(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
MESSAGE_FIELD_NUMBER: builtins.int
message: builtins.str
def __init__(
self,
*,
message: builtins.str = ...,
) -> None: ...
def ClearField(self, field_name: typing.Literal["message", b"message"]) -> None: ...
global___Shutdown = Shutdown

View File

@@ -0,0 +1,4 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

View File

@@ -0,0 +1,17 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
import abc
import collections.abc
import grpc
import grpc.aio
import typing
_T = typing.TypeVar("_T")
class _MaybeAsyncIterator(collections.abc.AsyncIterator[_T], collections.abc.Iterator[_T], metaclass=abc.ABCMeta): ...
class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type: ignore[misc, type-arg]
...

View File

@@ -0,0 +1,14 @@
# Python and dotnet agents interoperability sample
This sample demonstrates how to create a Python agent that interacts with a .NET agent.
To run the sample, check out the autogen repository.
Then do the following:
1. Navigate to autogen/dotnet/samples/Hello/Hello.AppHost
2. Run `dotnet run` to start the .NET Aspire app host, which runs three projects:
- Backend (the .NET Agent Runtime)
- HelloAgent (the .NET Agent)
- this Python agent - hello_python_agent.py
3. The AppHost will start the Aspire dashboard on [https://localhost:15887](https://localhost:15887).
The Python agent will interact with the .NET agent by sending a message to the .NET runtime, which will relay the message to the .NET agent.

View File

@@ -0,0 +1,69 @@
import asyncio
import logging
import os
import sys
from autogen_core.application import WorkerAgentRuntime
# from protos.agents_events_pb2 import NewMessageReceived
from autogen_core.base import PROTOBUF_DATA_CONTENT_TYPE, AgentId, try_get_known_serializers_for_type
from autogen_core.components import DefaultSubscription, DefaultTopicId, TypeSubscription
# Add the local package directory to sys.path
thisdir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(thisdir, "..", ".."))
from dotenv import load_dotenv # type: ignore # noqa: E402
from protos.agent_events_pb2 import NewMessageReceived, Output # type: ignore # noqa: E402
from user_input import UserProxy # type: ignore # noqa: E402
agnext_logger = logging.getLogger("autogen_core")
async def main() -> None:
load_dotenv()
agentHost = os.getenv("AGENT_HOST") or "localhost:53072"
# grpc python bug - can only use the hostname, not prefix - if hostname has a prefix we have to remove it:
if agentHost.startswith("http://"):
agentHost = agentHost[7:]
if agentHost.startswith("https://"):
agentHost = agentHost[8:]
agnext_logger.info("0")
agnext_logger.info(agentHost)
runtime = WorkerAgentRuntime(host_address=agentHost, payload_serialization_format=PROTOBUF_DATA_CONTENT_TYPE)
agnext_logger.info("1")
runtime.start()
runtime.add_message_serializer(try_get_known_serializers_for_type(NewMessageReceived))
agnext_logger.info("2")
await UserProxy.register(runtime, "HelloAgents", lambda: UserProxy())
await runtime.add_subscription(DefaultSubscription(agent_type="HelloAgents"))
await runtime.add_subscription(TypeSubscription(topic_type="agents.NewMessageReceived", agent_type="HelloAgents"))
await runtime.add_subscription(TypeSubscription(topic_type="agents.ConversationClosed", agent_type="HelloAgents"))
await runtime.add_subscription(TypeSubscription(topic_type="agents.Output", agent_type="HelloAgents"))
agnext_logger.info("3")
new_message = NewMessageReceived(message="from Python!")
output_message = Output(message="^v^v^v---Wild Hello from Python!---^v^v^v")
await runtime.publish_message(
message=new_message,
topic_id=DefaultTopicId("agents.NewMessageReceived", "HelloAgents/python"),
sender=AgentId("HelloAgents", "python"),
)
await runtime.publish_message(
message=output_message,
topic_id=DefaultTopicId("agents.Output", "HelloAgents/python"),
sender=AgentId("HelloAgents", "python"),
)
await runtime.stop_when_signal()
# await runtime.stop_when_idle()
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
agnext_logger.setLevel(logging.DEBUG)
agnext_logger.log(logging.DEBUG, "Starting worker")
asyncio.run(main())

View File

@@ -0,0 +1,39 @@
import asyncio
import logging
from typing import Union
from autogen_core.base import MessageContext
from autogen_core.components import DefaultTopicId, RoutedAgent, message_handler
from protos.agent_events_pb2 import ConversationClosed, Input, NewMessageReceived, Output # type: ignore
input_types = Union[ConversationClosed, Input, Output]
class UserProxy(RoutedAgent):
"""An agent that allows the user to play the role of an agent in the conversation via input."""
DEFAULT_DESCRIPTION = "A human user."
def __init__(
self,
description: str = DEFAULT_DESCRIPTION,
) -> None:
super().__init__(description)
@message_handler
async def handle_user_chat_input(self, message: input_types, ctx: MessageContext) -> None:
logger = logging.getLogger("autogen_core")
if isinstance(message, Input):
response = await self.ainput("User input ('exit' to quit): ")
response = response.strip()
logger.info(response)
await self.publish_message(NewMessageReceived(message=response), topic_id=DefaultTopicId())
elif isinstance(message, Output):
logger.info(message.message)
else:
pass
async def ainput(self, prompt: str) -> str:
return await asyncio.to_thread(input, f"{prompt} ")

View File

@@ -733,7 +733,7 @@ class WorkerAgentRuntime(AgentRuntime):
async def _process_register_agent_type_response(self, response: agent_worker_pb2.RegisterAgentTypeResponse) -> None:
future = self._pending_requests.pop(response.request_id)
if response.HasField("error"):
if response.HasField("error") and response.error != "":
future.set_exception(RuntimeError(response.error))
else:
future.set_result(None)
@@ -835,7 +835,7 @@ class WorkerAgentRuntime(AgentRuntime):
async def _process_add_subscription_response(self, response: agent_worker_pb2.AddSubscriptionResponse) -> None:
future = self._pending_requests.pop(response.request_id)
if response.HasField("error"):
if response.HasField("error") and response.error != "":
future.set_exception(RuntimeError(response.error))
else:
future.set_result(None)

View File

@@ -16,7 +16,7 @@ from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x63loudevent.proto\x12\ncloudevent\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x8b\x05\n\nCloudEvent\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x14\n\x0cspec_version\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12:\n\nattributes\x18\x05 \x03(\x0b\x32&.cloudevent.CloudEvent.AttributesEntry\x12\x36\n\x08metadata\x18\x06 \x03(\x0b\x32$.cloudevent.CloudEvent.MetadataEntry\x12\x15\n\x0b\x62inary_data\x18\x07 \x01(\x0cH\x00\x12\x13\n\ttext_data\x18\x08 \x01(\tH\x00\x12*\n\nproto_data\x18\t \x01(\x0b\x32\x14.google.protobuf.AnyH\x00\x1a\x62\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.cloudevent.CloudEvent.CloudEventAttributeValue:\x02\x38\x01\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\xd3\x01\n\x18\x43loudEventAttributeValue\x12\x14\n\nce_boolean\x18\x01 \x01(\x08H\x00\x12\x14\n\nce_integer\x18\x02 \x01(\x05H\x00\x12\x13\n\tce_string\x18\x03 \x01(\tH\x00\x12\x12\n\x08\x63\x65_bytes\x18\x04 \x01(\x0cH\x00\x12\x10\n\x06\x63\x65_uri\x18\x05 \x01(\tH\x00\x12\x14\n\nce_uri_ref\x18\x06 \x01(\tH\x00\x12\x32\n\x0c\x63\x65_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x06\n\x04\x61ttrB\x06\n\x04\x64\x61taB!\xaa\x02\x1eMicrosoft.AutoGen.Abstractionsb\x06proto3')
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x63loudevent.proto\x12\ncloudevent\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa4\x05\n\nCloudEvent\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x14\n\x0cspec_version\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12:\n\nattributes\x18\x05 \x03(\x0b\x32&.cloudevent.CloudEvent.AttributesEntry\x12\x36\n\x08metadata\x18\x06 \x03(\x0b\x32$.cloudevent.CloudEvent.MetadataEntry\x12\x17\n\x0f\x64\x61tacontenttype\x18\x07 \x01(\t\x12\x15\n\x0b\x62inary_data\x18\x08 \x01(\x0cH\x00\x12\x13\n\ttext_data\x18\t \x01(\tH\x00\x12*\n\nproto_data\x18\n \x01(\x0b\x32\x14.google.protobuf.AnyH\x00\x1a\x62\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.cloudevent.CloudEvent.CloudEventAttributeValue:\x02\x38\x01\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1a\xd3\x01\n\x18\x43loudEventAttributeValue\x12\x14\n\nce_boolean\x18\x01 \x01(\x08H\x00\x12\x14\n\nce_integer\x18\x02 \x01(\x05H\x00\x12\x13\n\tce_string\x18\x03 \x01(\tH\x00\x12\x12\n\x08\x63\x65_bytes\x18\x04 \x01(\x0cH\x00\x12\x10\n\x06\x63\x65_uri\x18\x05 \x01(\tH\x00\x12\x14\n\nce_uri_ref\x18\x06 \x01(\tH\x00\x12\x32\n\x0c\x63\x65_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x06\n\x04\x61ttrB\x06\n\x04\x64\x61taB!\xaa\x02\x1eMicrosoft.AutoGen.Abstractionsb\x06proto3')
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -29,11 +29,11 @@ if _descriptor._USE_C_DESCRIPTORS == False:
_globals['_CLOUDEVENT_METADATAENTRY']._options = None
_globals['_CLOUDEVENT_METADATAENTRY']._serialized_options = b'8\001'
_globals['_CLOUDEVENT']._serialized_start=93
_globals['_CLOUDEVENT']._serialized_end=744
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_start=375
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_end=473
_globals['_CLOUDEVENT_METADATAENTRY']._serialized_start=475
_globals['_CLOUDEVENT_METADATAENTRY']._serialized_end=522
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_start=525
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_end=736
_globals['_CLOUDEVENT']._serialized_end=769
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_start=400
_globals['_CLOUDEVENT_ATTRIBUTESENTRY']._serialized_end=498
_globals['_CLOUDEVENT_METADATAENTRY']._serialized_start=500
_globals['_CLOUDEVENT_METADATAENTRY']._serialized_end=547
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_start=550
_globals['_CLOUDEVENT_CLOUDEVENTATTRIBUTEVALUE']._serialized_end=761
# @@protoc_insertion_point(module_scope)

View File

@@ -97,6 +97,7 @@ class CloudEvent(google.protobuf.message.Message):
TYPE_FIELD_NUMBER: builtins.int
ATTRIBUTES_FIELD_NUMBER: builtins.int
METADATA_FIELD_NUMBER: builtins.int
DATACONTENTTYPE_FIELD_NUMBER: builtins.int
BINARY_DATA_FIELD_NUMBER: builtins.int
TEXT_DATA_FIELD_NUMBER: builtins.int
PROTO_DATA_FIELD_NUMBER: builtins.int
@@ -109,6 +110,8 @@ class CloudEvent(google.protobuf.message.Message):
"""URI-reference"""
spec_version: builtins.str
type: builtins.str
datacontenttype: builtins.str
"""MIME type"""
binary_data: builtins.bytes
text_data: builtins.str
@property
@@ -128,12 +131,13 @@ class CloudEvent(google.protobuf.message.Message):
type: builtins.str = ...,
attributes: collections.abc.Mapping[builtins.str, global___CloudEvent.CloudEventAttributeValue] | None = ...,
metadata: collections.abc.Mapping[builtins.str, builtins.str] | None = ...,
datacontenttype: builtins.str = ...,
binary_data: builtins.bytes = ...,
text_data: builtins.str = ...,
proto_data: google.protobuf.any_pb2.Any | None = ...,
) -> None: ...
def HasField(self, field_name: typing.Literal["binary_data", b"binary_data", "data", b"data", "proto_data", b"proto_data", "text_data", b"text_data"]) -> builtins.bool: ...
def ClearField(self, field_name: typing.Literal["attributes", b"attributes", "binary_data", b"binary_data", "data", b"data", "id", b"id", "metadata", b"metadata", "proto_data", b"proto_data", "source", b"source", "spec_version", b"spec_version", "text_data", b"text_data", "type", b"type"]) -> None: ...
def ClearField(self, field_name: typing.Literal["attributes", b"attributes", "binary_data", b"binary_data", "data", b"data", "datacontenttype", b"datacontenttype", "id", b"id", "metadata", b"metadata", "proto_data", b"proto_data", "source", b"source", "spec_version", b"spec_version", "text_data", b"text_data", "type", b"type"]) -> None: ...
def WhichOneof(self, oneof_group: typing.Literal["data", b"data"]) -> typing.Literal["binary_data", "text_data", "proto_data"] | None: ...
global___CloudEvent = CloudEvent

View File

@@ -80,4 +80,6 @@ check = ["fmt", "lint", "pyright", "mypy", "test"]
gen-proto = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/src/autogen_core/application/protos --grpc_python_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_out=./packages/autogen-core/src/autogen_core/application/protos --mypy_grpc_out=./packages/autogen-core/src/autogen_core/application/protos --proto_path ../protos/ agent_worker.proto --proto_path ../protos/ cloudevent.proto"
gen-test-proto = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/tests/protos --grpc_python_out=./packages/autogen-core/tests/protos --mypy_out=./packages/autogen-core/tests/protos --mypy_grpc_out=./packages/autogen-core/tests/protos --proto_path ./packages/autogen-core/tests/protos serialization_test.proto"
gen-test-proto = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/tests/protos --grpc_python_out=./packages/autogen-core/tests/protos --mypy_out=./packages/autogen-core/tests/protos --mypy_grpc_out=./packages/autogen-core/tests/protos --proto_path ./packages/autogen-core/tests/protos serialization_test.proto"
gen-proto-samples = "python -m grpc_tools.protoc --python_out=./packages/autogen-core/samples/protos --grpc_python_out=./packages/autogen-core/samples/protos --mypy_out=./packages/autogen-core/samples/protos --mypy_grpc_out=./packages/autogen-core/samples/protos --proto_path ../protos/ agent_events.proto"