meshagent-agents 0.5.18__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of meshagent-agents might be problematic. Click here for more details.
- meshagent/agents/__init__.py +0 -2
- meshagent/agents/adapter.py +22 -5
- meshagent/agents/agent.py +28 -29
- meshagent/agents/chat.py +519 -175
- meshagent/agents/context.py +16 -1
- meshagent/agents/development.py +3 -1
- meshagent/agents/indexer.py +2 -2
- meshagent/agents/llmrunner.py +169 -0
- meshagent/agents/mail.py +15 -17
- meshagent/agents/planning.py +3 -3
- meshagent/agents/pydantic.py +1 -1
- meshagent/agents/schemas/transcript.py +77 -0
- meshagent/agents/thread_schema.py +58 -7
- meshagent/agents/utils.py +0 -2
- meshagent/agents/version.py +1 -1
- meshagent/agents/worker.py +8 -4
- meshagent/agents/writer.py +1 -1
- {meshagent_agents-0.5.18.dist-info → meshagent_agents-0.6.0.dist-info}/METADATA +8 -8
- meshagent_agents-0.6.0.dist-info/RECORD +31 -0
- meshagent/agents/hosting.py +0 -182
- meshagent_agents-0.5.18.dist-info/RECORD +0 -30
- {meshagent_agents-0.5.18.dist-info → meshagent_agents-0.6.0.dist-info}/WHEEL +0 -0
- {meshagent_agents-0.5.18.dist-info → meshagent_agents-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {meshagent_agents-0.5.18.dist-info → meshagent_agents-0.6.0.dist-info}/top_level.txt +0 -0
meshagent/agents/hosting.py
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
from meshagent.api import RoomMessage
|
|
4
|
-
from meshagent.api.webhooks import WebhookServer, CallEvent
|
|
5
|
-
from meshagent.api import WebSocketClientProtocol
|
|
6
|
-
from meshagent.api.room_server_client import RoomClient
|
|
7
|
-
from meshagent.agents import SingleRoomAgent
|
|
8
|
-
from aiohttp import web
|
|
9
|
-
import asyncio
|
|
10
|
-
|
|
11
|
-
from typing import Callable, Optional
|
|
12
|
-
|
|
13
|
-
from .agent import TaskRunner
|
|
14
|
-
|
|
15
|
-
logger = logging.getLogger("hosting")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class RemoteTaskRunnerServer[T: TaskRunner](WebhookServer):
|
|
19
|
-
def __init__(
|
|
20
|
-
self,
|
|
21
|
-
*,
|
|
22
|
-
cls: Optional[T] = None,
|
|
23
|
-
path: Optional[str] = None,
|
|
24
|
-
app: Optional[web.Application] = None,
|
|
25
|
-
host=None,
|
|
26
|
-
port=None,
|
|
27
|
-
webhook_secret=None,
|
|
28
|
-
create_agent: Optional[Callable[[dict], TaskRunner]] = None,
|
|
29
|
-
validate_webhook_secret: Optional[bool] = None,
|
|
30
|
-
):
|
|
31
|
-
super().__init__(
|
|
32
|
-
path=path,
|
|
33
|
-
app=app,
|
|
34
|
-
host=host,
|
|
35
|
-
port=port,
|
|
36
|
-
webhook_secret=webhook_secret,
|
|
37
|
-
validate_webhook_secret=validate_webhook_secret,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
if create_agent is None:
|
|
41
|
-
|
|
42
|
-
def default_create_agent(arguments: dict) -> TaskRunner:
|
|
43
|
-
return cls(**arguments)
|
|
44
|
-
|
|
45
|
-
create_agent = default_create_agent
|
|
46
|
-
|
|
47
|
-
self._create_agent = create_agent
|
|
48
|
-
|
|
49
|
-
async def _spawn(
|
|
50
|
-
self,
|
|
51
|
-
*,
|
|
52
|
-
room_name: str,
|
|
53
|
-
room_url: str,
|
|
54
|
-
token: str,
|
|
55
|
-
arguments: Optional[dict] = None,
|
|
56
|
-
):
|
|
57
|
-
agent = self._create_agent(arguments=arguments)
|
|
58
|
-
|
|
59
|
-
async def run():
|
|
60
|
-
async with RoomClient(
|
|
61
|
-
protocol=WebSocketClientProtocol(url=room_url, token=token)
|
|
62
|
-
) as room:
|
|
63
|
-
dismissed = asyncio.Future()
|
|
64
|
-
|
|
65
|
-
def on_message(message: RoomMessage):
|
|
66
|
-
if message.type == "dismiss":
|
|
67
|
-
logger.info(
|
|
68
|
-
f"dismissed task runner by {message.from_participant_id}"
|
|
69
|
-
)
|
|
70
|
-
dismissed.set_result(True)
|
|
71
|
-
|
|
72
|
-
room.messaging.on("message", on_message)
|
|
73
|
-
|
|
74
|
-
await agent.start(room=room)
|
|
75
|
-
|
|
76
|
-
done, pending = await asyncio.wait(
|
|
77
|
-
[dismissed, asyncio.ensure_future(room.protocol.wait_for_close())],
|
|
78
|
-
return_when=asyncio.FIRST_COMPLETED,
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
await agent.stop()
|
|
82
|
-
|
|
83
|
-
def on_done(task: asyncio.Task):
|
|
84
|
-
try:
|
|
85
|
-
task.result()
|
|
86
|
-
except Exception as e:
|
|
87
|
-
logger.error("agent encountered an error", exc_info=e)
|
|
88
|
-
|
|
89
|
-
task = asyncio.create_task(run())
|
|
90
|
-
task.add_done_callback(on_done)
|
|
91
|
-
|
|
92
|
-
async def on_call(self, event: CallEvent):
|
|
93
|
-
await self._spawn(
|
|
94
|
-
room_name=event.room_name,
|
|
95
|
-
room_url=event.room_url,
|
|
96
|
-
token=event.token,
|
|
97
|
-
arguments=event.arguments,
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class RemoteAgentServer[T: SingleRoomAgent](WebhookServer):
|
|
102
|
-
def __init__(
|
|
103
|
-
self,
|
|
104
|
-
*,
|
|
105
|
-
cls: Optional[T] = None,
|
|
106
|
-
path: Optional[str] = None,
|
|
107
|
-
app: Optional[web.Application] = None,
|
|
108
|
-
host=None,
|
|
109
|
-
port=None,
|
|
110
|
-
webhook_secret=None,
|
|
111
|
-
create_agent: Optional[Callable[[dict], SingleRoomAgent]] = None,
|
|
112
|
-
validate_webhook_secret: Optional[bool] = None,
|
|
113
|
-
):
|
|
114
|
-
super().__init__(
|
|
115
|
-
path=path,
|
|
116
|
-
app=app,
|
|
117
|
-
host=host,
|
|
118
|
-
port=port,
|
|
119
|
-
webhook_secret=webhook_secret,
|
|
120
|
-
validate_webhook_secret=validate_webhook_secret,
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
if create_agent is None:
|
|
124
|
-
|
|
125
|
-
def default_create_agent(arguments: dict) -> SingleRoomAgent:
|
|
126
|
-
return cls(**arguments)
|
|
127
|
-
|
|
128
|
-
create_agent = default_create_agent
|
|
129
|
-
|
|
130
|
-
self._create_agent = create_agent
|
|
131
|
-
|
|
132
|
-
async def _spawn(
|
|
133
|
-
self,
|
|
134
|
-
*,
|
|
135
|
-
room_name: str,
|
|
136
|
-
room_url: str,
|
|
137
|
-
token: str,
|
|
138
|
-
arguments: Optional[dict] = None,
|
|
139
|
-
):
|
|
140
|
-
logger.info(
|
|
141
|
-
f"spawning agent on room: {room_name} url: {room_url} arguments: {arguments}"
|
|
142
|
-
)
|
|
143
|
-
agent = self._create_agent(arguments=arguments)
|
|
144
|
-
|
|
145
|
-
async def run():
|
|
146
|
-
async with RoomClient(
|
|
147
|
-
protocol=WebSocketClientProtocol(url=room_url, token=token)
|
|
148
|
-
) as room:
|
|
149
|
-
dismissed = asyncio.Future()
|
|
150
|
-
|
|
151
|
-
def on_message(message: RoomMessage):
|
|
152
|
-
if message.type == "dismiss":
|
|
153
|
-
logger.info(f"dismissed agent by {message.from_participant_id}")
|
|
154
|
-
dismissed.set_result(True)
|
|
155
|
-
|
|
156
|
-
room.messaging.on("message", on_message)
|
|
157
|
-
|
|
158
|
-
await agent.start(room=room)
|
|
159
|
-
|
|
160
|
-
done, pending = await asyncio.wait(
|
|
161
|
-
[dismissed, asyncio.ensure_future(room.protocol.wait_for_close())],
|
|
162
|
-
return_when=asyncio.FIRST_COMPLETED,
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
await agent.stop()
|
|
166
|
-
|
|
167
|
-
def on_done(task: asyncio.Task):
|
|
168
|
-
try:
|
|
169
|
-
task.result()
|
|
170
|
-
except Exception as e:
|
|
171
|
-
logger.error("agent encountered an error", exc_info=e)
|
|
172
|
-
|
|
173
|
-
task = asyncio.create_task(run())
|
|
174
|
-
task.add_done_callback(on_done)
|
|
175
|
-
|
|
176
|
-
async def on_call(self, event: CallEvent):
|
|
177
|
-
await self._spawn(
|
|
178
|
-
room_name=event.room_name,
|
|
179
|
-
room_url=event.room_url,
|
|
180
|
-
token=event.token,
|
|
181
|
-
arguments=event.arguments,
|
|
182
|
-
)
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
meshagent/agents/__init__.py,sha256=d2cplyLH8xqDWqP_GoPQ8ApHzuv8Iiq4rz-vYBlGMTw,706
|
|
2
|
-
meshagent/agents/adapter.py,sha256=dMuejpjl__bdZ-Qmt-k4e81g-i10vZup7WE1JCZ_Sy4,1392
|
|
3
|
-
meshagent/agents/agent.py,sha256=w14hM63YXiH15VEF1T2eZCvggvrUkE00a1kQkaMRBM0,20354
|
|
4
|
-
meshagent/agents/chat.py,sha256=K1uLlUylKiWhuSh_gqQ2GajIZ3Pf5fc309adg14Z0Rk,32870
|
|
5
|
-
meshagent/agents/context.py,sha256=6txCXA22aHQaikvIKED6YjPyasM_bPqGqCE4HGj04_E,4035
|
|
6
|
-
meshagent/agents/development.py,sha256=AEBkkycNZDRLYIdmX2LkrVZv715ALswiwSR9CiV3HE4,894
|
|
7
|
-
meshagent/agents/hosting.py,sha256=tCcswAweEhlMxGaBR_m2YvUkwZiaHbTBT64urRHfK7I,5446
|
|
8
|
-
meshagent/agents/indexer.py,sha256=xFEzAmwAxhKu9xHppnxFUFlzeRHMfVk6MatRyka0ZW8,19367
|
|
9
|
-
meshagent/agents/listener.py,sha256=q5z216FMVW-a7FBs706u3IuB81VArfucxEHaHvPFHEo,5139
|
|
10
|
-
meshagent/agents/mail.py,sha256=NQUbLuUzk0xFCb_ROvD8ZWW3VnkN7pKMGJcJzcB8p3Q,12348
|
|
11
|
-
meshagent/agents/planning.py,sha256=69HLEkOR_24mZ1mcUCQVX_DgPfX5TVA7EJYCHENH6M0,21980
|
|
12
|
-
meshagent/agents/prompt.py,sha256=OSSqbzaugyQtuvYxTY5UcZQWyeV73e3GUJz_iC5xZkA,1883
|
|
13
|
-
meshagent/agents/pydantic.py,sha256=RrdOESZg-n_FyxbfkOBwRPVxV39IOjxK2unsyAGn9as,6278
|
|
14
|
-
meshagent/agents/single_shot_writer.py,sha256=miWVMo4NX8Hib0yHwDmiwuk8GraJwg1JzljsgFyTl4Y,3237
|
|
15
|
-
meshagent/agents/thread_schema.py,sha256=OGQ-H5c2fJgNOYHC3Pas8iqTi2RUSxP2bytf0SK-SYc,4208
|
|
16
|
-
meshagent/agents/utils.py,sha256=6D9GXpYu9xx5XlfD3DiGFdyOwq46e5-sTYOF_FYep1o,1446
|
|
17
|
-
meshagent/agents/version.py,sha256=8HarzfUUN0oBs56RqaWFFfXKWTGi5Mt2jU6YSekUkis,23
|
|
18
|
-
meshagent/agents/worker.py,sha256=SkrPhxIQ-Chyjg-eZGOlehkbrVYmsas8zmZnrTsAl3o,3910
|
|
19
|
-
meshagent/agents/writer.py,sha256=dXglYgHwBrBJIaapMqBDyD3kmwSyi94tOdHH44itODc,2682
|
|
20
|
-
meshagent/agents/schemas/__init__.py,sha256=_xAhrkxvFdfer3NolrynragGxcLElGR51LSribT3deU,299
|
|
21
|
-
meshagent/agents/schemas/document.py,sha256=H-aolubkRHdTAH-rLI2SJ8y3JKwXvpNsR3ZCqghwAWI,1515
|
|
22
|
-
meshagent/agents/schemas/gallery.py,sha256=65IsrH2wiFIR-DNo8est-nCOC72i1Aa5EmVNUHtVnK0,1091
|
|
23
|
-
meshagent/agents/schemas/presentation.py,sha256=aaMzkFQryurbHd1fbzTQPdN7v8QIhsjXuvbE8ZiuXNY,1589
|
|
24
|
-
meshagent/agents/schemas/schema.py,sha256=8OXGCLVouoPg6eHBU9mgf1pTGTMvVZqiKNq15wkQJe0,5310
|
|
25
|
-
meshagent/agents/schemas/super_editor_document.py,sha256=iRv4Q-DE_5kUdsAD5Rm4GwHek8L_7ZEpxIZ1x2dWjdg,1813
|
|
26
|
-
meshagent_agents-0.5.18.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
|
|
27
|
-
meshagent_agents-0.5.18.dist-info/METADATA,sha256=nXfwcknCjoELz6zfJiiX5a4sAap9cI6iU1QMbzy6gPA,3779
|
|
28
|
-
meshagent_agents-0.5.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
-
meshagent_agents-0.5.18.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
|
|
30
|
-
meshagent_agents-0.5.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|