meshagent-agents 0.0.6__tar.gz → 0.0.8__tar.gz
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-0.0.8/CHANGELOG.md +15 -0
- meshagent_agents-0.0.8/MANIFEST.in +1 -0
- {meshagent_agents-0.0.6/meshagent_agents.egg-info → meshagent_agents-0.0.8}/PKG-INFO +5 -12
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/__init__.py +2 -1
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/agent.py +82 -19
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/chat.py +17 -19
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/context.py +11 -6
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/indexer.py +2 -5
- meshagent_agents-0.0.8/meshagent/agents/version.py +1 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/worker.py +6 -16
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8/meshagent_agents.egg-info}/PKG-INFO +5 -12
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent_agents.egg-info/SOURCES.txt +0 -1
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent_agents.egg-info/requires.txt +3 -3
- meshagent_agents-0.0.8/pyproject.toml +43 -0
- meshagent_agents-0.0.6/CHANGELOG.md +0 -8
- meshagent_agents-0.0.6/MANIFEST.in +0 -2
- meshagent_agents-0.0.6/meshagent/agents/version.py +0 -1
- meshagent_agents-0.0.6/pyproject.toml +0 -5
- meshagent_agents-0.0.6/setup.py +0 -48
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/LICENSE +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/README.md +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/adapter.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/development.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/hosting.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/listener.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/planning.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/prompt.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/pydantic.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/single_shot_writer.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/thread_schema.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/utils.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent/agents/writer.py +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent_agents.egg-info/dependency_links.txt +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent_agents.egg-info/top_level.txt +0 -0
- {meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include CHANGELOG.md
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.8
|
|
4
4
|
Summary: Agent Building Blocks for Meshagent
|
|
5
|
-
|
|
6
|
-
License: Apache License 2.0
|
|
5
|
+
License-Expression: Apache-2.0
|
|
7
6
|
Project-URL: Documentation, https://meshagent.com
|
|
8
7
|
Project-URL: Website, https://meshagent.com
|
|
9
8
|
Project-URL: Source, https://github.com/meshagent
|
|
@@ -13,18 +12,12 @@ License-File: LICENSE
|
|
|
13
12
|
Requires-Dist: pyjwt>=2.0.0
|
|
14
13
|
Requires-Dist: pytest>=8.3.4
|
|
15
14
|
Requires-Dist: pytest-asyncio>=0.24.0
|
|
16
|
-
Requires-Dist: meshagent-api>=0.0.
|
|
17
|
-
Requires-Dist: meshagent-tools>=0.0.
|
|
18
|
-
Requires-Dist: meshagent-openai>=0.0.
|
|
15
|
+
Requires-Dist: meshagent-api>=0.0.8
|
|
16
|
+
Requires-Dist: meshagent-tools>=0.0.8
|
|
17
|
+
Requires-Dist: meshagent-openai>=0.0.8
|
|
19
18
|
Requires-Dist: pydantic>=2.10.4
|
|
20
19
|
Requires-Dist: pydantic-ai>=0.0.23
|
|
21
20
|
Requires-Dist: chonkie>=0.5.1
|
|
22
21
|
Requires-Dist: chonkie[semantic]>=0.5.1
|
|
23
22
|
Requires-Dist: chonkie[openai]>=0.5.1
|
|
24
|
-
Dynamic: description-content-type
|
|
25
|
-
Dynamic: license
|
|
26
23
|
Dynamic: license-file
|
|
27
|
-
Dynamic: project-url
|
|
28
|
-
Dynamic: requires-dist
|
|
29
|
-
Dynamic: requires-python
|
|
30
|
-
Dynamic: summary
|
|
@@ -3,4 +3,5 @@ from .development import connect_development_agent
|
|
|
3
3
|
from .listener import Listener, ListenerContext
|
|
4
4
|
from .hosting import RemoteTaskRunnerServer
|
|
5
5
|
from .adapter import ToolResponseAdapter, LLMAdapter
|
|
6
|
-
from .thread_schema import thread_schema
|
|
6
|
+
from .thread_schema import thread_schema
|
|
7
|
+
from .version import __version__
|
|
@@ -4,16 +4,17 @@ from copy import deepcopy
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
from meshagent.api.room_server_client import RoomException, RequiredToolkit, Requirement, RequiredSchema
|
|
7
|
-
from meshagent.api import WebSocketClientProtocol, ToolDescription, ToolkitDescription, Participant, RemoteParticipant, meshagent_base_url, StorageEntry
|
|
7
|
+
from meshagent.api import WebSocketClientProtocol, ToolDescription, ToolkitDescription, Participant, RemoteParticipant, meshagent_base_url, StorageEntry, JsonResponse
|
|
8
8
|
from meshagent.api.protocol import Protocol
|
|
9
|
-
from meshagent.tools.toolkit import Toolkit, Tool, ToolContext
|
|
9
|
+
from meshagent.tools.toolkit import Toolkit, Tool, ToolContext, toolkit_factory, register_toolkit_factory
|
|
10
10
|
from meshagent.api.room_server_client import RoomClient, RoomException
|
|
11
11
|
from jsonschema import validate
|
|
12
12
|
from .context import AgentCallContext, AgentChatContext
|
|
13
13
|
from meshagent.api.schema_util import no_arguments_schema
|
|
14
|
+
from meshagent.api import MeshSchema
|
|
14
15
|
import logging
|
|
15
16
|
import asyncio
|
|
16
|
-
from typing import Optional
|
|
17
|
+
from typing import Optional, Dict, Callable, Coroutine
|
|
17
18
|
|
|
18
19
|
logger = logging.getLogger("agent")
|
|
19
20
|
logger.setLevel(logging.INFO)
|
|
@@ -144,7 +145,11 @@ class SingleRoomAgent(Agent):
|
|
|
144
145
|
|
|
145
146
|
if isinstance(requirement, RequiredToolkit):
|
|
146
147
|
|
|
147
|
-
if requirement.name
|
|
148
|
+
if toolkit_factory(requirement.name) != None:
|
|
149
|
+
# no need to install something we can create from a factory
|
|
150
|
+
continue
|
|
151
|
+
|
|
152
|
+
if requirement.name == "ui":
|
|
148
153
|
# TODO: maybe requirements can be marked as non installable?
|
|
149
154
|
continue
|
|
150
155
|
|
|
@@ -182,20 +187,34 @@ class SingleRoomAgent(Agent):
|
|
|
182
187
|
if installed:
|
|
183
188
|
await asyncio.sleep(5)
|
|
184
189
|
|
|
185
|
-
async def
|
|
190
|
+
async def get_required_toolkits(self, context: ToolContext) -> list[Toolkit]:
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
tool_target = context.caller
|
|
194
|
+
if context.on_behalf_of != None:
|
|
195
|
+
tool_target = context.on_behalf_of
|
|
186
196
|
|
|
187
197
|
toolkits_by_name = dict[str, ToolkitDescription]()
|
|
188
198
|
|
|
189
199
|
toolkits = list[Toolkit]()
|
|
190
200
|
|
|
191
|
-
visible_tools = await self._room.agents.list_toolkits(participant_id=
|
|
201
|
+
visible_tools = await self._room.agents.list_toolkits(participant_id=tool_target.id)
|
|
192
202
|
|
|
193
203
|
for toolkit_description in visible_tools:
|
|
194
204
|
toolkits_by_name[toolkit_description.name] = toolkit_description
|
|
195
205
|
|
|
206
|
+
|
|
196
207
|
for required_toolkit in self.requires:
|
|
197
208
|
|
|
198
209
|
if isinstance(required_toolkit, RequiredToolkit):
|
|
210
|
+
|
|
211
|
+
if toolkit_factory(required_toolkit.name) != None:
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
toolkit = await toolkit_factory(required_toolkit.name)(context, required_toolkit)
|
|
215
|
+
toolkits.append(toolkit)
|
|
216
|
+
continue
|
|
217
|
+
|
|
199
218
|
|
|
200
219
|
toolkit = toolkits_by_name.get(required_toolkit.name, None)
|
|
201
220
|
if toolkit == None:
|
|
@@ -208,14 +227,14 @@ class SingleRoomAgent(Agent):
|
|
|
208
227
|
|
|
209
228
|
for tool_description in toolkit.tools:
|
|
210
229
|
tool = RoomTool(
|
|
211
|
-
on_behalf_of_id=
|
|
230
|
+
on_behalf_of_id=tool_target.id,
|
|
212
231
|
toolkit_name=toolkit.name,
|
|
213
232
|
name=tool_description.name,
|
|
214
233
|
description=tool_description.description,
|
|
215
234
|
input_schema=tool_description.input_schema,
|
|
216
235
|
title=tool_description.title,
|
|
217
236
|
thumbnail_url=tool_description.thumbnail_url,
|
|
218
|
-
participant_id=
|
|
237
|
+
participant_id=tool_target.id,
|
|
219
238
|
defs = tool_description.defs
|
|
220
239
|
)
|
|
221
240
|
room_tools.append(tool)
|
|
@@ -232,14 +251,14 @@ class SingleRoomAgent(Agent):
|
|
|
232
251
|
raise RoomException(f"unable to locate required tool {required_tool}")
|
|
233
252
|
|
|
234
253
|
tool = RoomTool(
|
|
235
|
-
on_behalf_of_id=
|
|
254
|
+
on_behalf_of_id=tool_target.id,
|
|
236
255
|
toolkit_name=toolkit.name,
|
|
237
256
|
name=tool_description.name,
|
|
238
257
|
description=tool_description.description,
|
|
239
258
|
input_schema=tool_description.input_schema,
|
|
240
259
|
title=tool_description.title,
|
|
241
260
|
thumbnail_url=tool_description.thumbnail_url,
|
|
242
|
-
participant_id=
|
|
261
|
+
participant_id=tool_target.id,
|
|
243
262
|
defs = tool_description.defs
|
|
244
263
|
)
|
|
245
264
|
room_tools.append(tool)
|
|
@@ -366,6 +385,8 @@ class TaskRunner(SingleRoomAgent):
|
|
|
366
385
|
|
|
367
386
|
#context_json = message["context"]
|
|
368
387
|
|
|
388
|
+
chat_context = None
|
|
389
|
+
|
|
369
390
|
try:
|
|
370
391
|
chat_context = await self.init_chat_context()
|
|
371
392
|
|
|
@@ -400,9 +421,10 @@ class TaskRunner(SingleRoomAgent):
|
|
|
400
421
|
if on_behalf_of != None:
|
|
401
422
|
tool_target = on_behalf_of
|
|
402
423
|
|
|
424
|
+
|
|
403
425
|
toolkits = [
|
|
404
426
|
*self._toolkits,
|
|
405
|
-
*await self.
|
|
427
|
+
*await self.get_required_toolkits(context=ToolContext(room=self.room, caller=caller, on_behalf_of=on_behalf_of, caller_context={ "chat": chat_context.to_json() }))
|
|
406
428
|
]
|
|
407
429
|
|
|
408
430
|
context = AgentCallContext(chat=chat_context, room=self.room, caller=caller, on_behalf_of=on_behalf_of, toolkits=toolkits)
|
|
@@ -436,15 +458,28 @@ class TaskRunner(SingleRoomAgent):
|
|
|
436
458
|
|
|
437
459
|
await protocol.send(type="agent.ask_response", data=json.dumps({
|
|
438
460
|
"task_id" : task_id,
|
|
439
|
-
"
|
|
461
|
+
"answer" : response,
|
|
462
|
+
"caller_context" : {
|
|
463
|
+
"chat" : chat_context.to_json()
|
|
464
|
+
}
|
|
440
465
|
}))
|
|
441
466
|
|
|
442
467
|
except Exception as e:
|
|
443
468
|
logger.error("Task runner failed to complete task", exc_info=e)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
"
|
|
447
|
-
|
|
469
|
+
if chat_context != None:
|
|
470
|
+
|
|
471
|
+
await protocol.send(type="agent.ask_response", data=json.dumps({
|
|
472
|
+
"task_id" : task_id,
|
|
473
|
+
"error" : str(e),
|
|
474
|
+
"caller_context" : {
|
|
475
|
+
"chat" : chat_context.to_json()
|
|
476
|
+
}
|
|
477
|
+
}))
|
|
478
|
+
else:
|
|
479
|
+
await protocol.send(type="agent.ask_response", data=json.dumps({
|
|
480
|
+
"task_id" : task_id,
|
|
481
|
+
"error" : str(e),
|
|
482
|
+
}))
|
|
448
483
|
|
|
449
484
|
def on_done(task: asyncio.Task):
|
|
450
485
|
task.result()
|
|
@@ -452,11 +487,39 @@ class TaskRunner(SingleRoomAgent):
|
|
|
452
487
|
task = asyncio.create_task(worker())
|
|
453
488
|
task.add_done_callback(on_done)
|
|
454
489
|
|
|
490
|
+
|
|
455
491
|
class RunTaskTool(Tool):
|
|
456
|
-
def __init__(self, *, agent_name: str, input_schema: dict, rules = None, thumbnail_url = None):
|
|
457
|
-
super().__init__(name=
|
|
492
|
+
def __init__(self, *, name: str, agent_name: str, input_schema: dict, rules = None, thumbnail_url = None, title: Optional[str] = None, description: Optional[str] = None):
|
|
493
|
+
super().__init__(name=name, input_schema=input_schema, rules=rules, thumbnail_url=thumbnail_url, title=title, description=description)
|
|
458
494
|
|
|
459
495
|
self._agent_name = agent_name
|
|
460
496
|
|
|
461
497
|
async def execute(self, context: ToolContext, **kwargs):
|
|
462
|
-
return await context.room.agents.ask(agent=self._agent_name, arguments=kwargs)
|
|
498
|
+
return await context.room.agents.ask(agent=self._agent_name, arguments=kwargs)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
async def make_run_task_tool(context: ToolContext, toolkit: RequiredToolkit):
|
|
502
|
+
|
|
503
|
+
agents = await context.room.agents.list_agents()
|
|
504
|
+
tools = []
|
|
505
|
+
for agent_name in toolkit.tools:
|
|
506
|
+
agent = next((x for x in agents if x.name == agent_name), None)
|
|
507
|
+
|
|
508
|
+
if agent == None:
|
|
509
|
+
raise RoomException(f"agent was not found in the room {agent_name}")
|
|
510
|
+
|
|
511
|
+
tools.append(
|
|
512
|
+
RunTaskTool(
|
|
513
|
+
agent_name=agent_name,
|
|
514
|
+
name=f"run_{agent_name}",
|
|
515
|
+
input_schema=agent.input_schema,
|
|
516
|
+
title=agent.title,
|
|
517
|
+
description=agent.description
|
|
518
|
+
))
|
|
519
|
+
|
|
520
|
+
return Toolkit(
|
|
521
|
+
name="agents",
|
|
522
|
+
tools=tools
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
register_toolkit_factory("agents", make_run_task_tool)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from .agent import SingleRoomAgent, AgentChatContext, AgentCallContext
|
|
2
2
|
from meshagent.api.chan import Chan
|
|
3
3
|
from meshagent.api import RoomMessage, RoomException, RoomClient, RemoteParticipant, RequiredSchema, Requirement, Element, MeshDocument
|
|
4
|
-
from meshagent.tools import Toolkit
|
|
4
|
+
from meshagent.tools import Toolkit, ToolContext
|
|
5
5
|
from .adapter import LLMAdapter, ToolResponseAdapter
|
|
6
6
|
import asyncio
|
|
7
7
|
from typing import Optional
|
|
@@ -40,9 +40,8 @@ def get_thread_participants(*, room: RoomClient, thread: MeshDocument) -> list[R
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
class ChatThreadContext:
|
|
43
|
-
def __init__(self, *, chat: AgentChatContext, thread: MeshDocument,
|
|
43
|
+
def __init__(self, *, chat: AgentChatContext, thread: MeshDocument, participants: Optional[list[RemoteParticipant]] = None):
|
|
44
44
|
self.thread = thread
|
|
45
|
-
self.toolkits = toolkits
|
|
46
45
|
if participants == None:
|
|
47
46
|
participants = []
|
|
48
47
|
|
|
@@ -125,13 +124,14 @@ class ChatBot(SingleRoomAgent):
|
|
|
125
124
|
async def get_thread_participants(self, *, thread: MeshDocument):
|
|
126
125
|
return get_thread_participants(room=self._room, thread=thread)
|
|
127
126
|
|
|
128
|
-
async def
|
|
127
|
+
async def get_thread_toolkits(self, *, thread_context: ChatThreadContext, participant: RemoteParticipant) -> list[Toolkit]:
|
|
129
128
|
|
|
129
|
+
toolkits = await self.get_required_toolkits(context=ToolContext(room=self.room, caller=participant, caller_context={ "chat": thread_context.chat.to_json() }))
|
|
130
130
|
toaster = None
|
|
131
131
|
|
|
132
|
-
for toolkit in
|
|
132
|
+
for toolkit in toolkits:
|
|
133
133
|
|
|
134
|
-
if toolkit.name == "
|
|
134
|
+
if toolkit.name == "ui":
|
|
135
135
|
|
|
136
136
|
for tool in toolkit.tools:
|
|
137
137
|
|
|
@@ -147,10 +147,13 @@ class ChatBot(SingleRoomAgent):
|
|
|
147
147
|
|
|
148
148
|
return MultiToolkit(required=[ toaster ], base_toolkit=toolkit )
|
|
149
149
|
|
|
150
|
-
toolkits = list(map(multi_tool,
|
|
150
|
+
toolkits = list(map(multi_tool, toolkits))
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
|
|
153
|
+
return [
|
|
154
|
+
*self._toolkits,
|
|
155
|
+
*toolkits
|
|
156
|
+
]
|
|
154
157
|
|
|
155
158
|
async def init_chat_context(self) -> AgentChatContext:
|
|
156
159
|
context = self._llm_adapter.create_chat_context()
|
|
@@ -325,21 +328,16 @@ class ChatBot(SingleRoomAgent):
|
|
|
325
328
|
|
|
326
329
|
|
|
327
330
|
try:
|
|
331
|
+
|
|
332
|
+
|
|
328
333
|
|
|
329
334
|
if thread_context == None:
|
|
330
|
-
|
|
331
|
-
*self._toolkits,
|
|
332
|
-
*await self.get_required_tools(participant_id=chat_with_participant.id)
|
|
333
|
-
]
|
|
334
|
-
|
|
335
|
+
|
|
335
336
|
thread_context = ChatThreadContext(
|
|
336
337
|
chat=chat_context,
|
|
337
338
|
thread=thread,
|
|
338
|
-
toolkits=toolkits,
|
|
339
339
|
participants=get_thread_participants(room=self.room, thread=thread)
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
await self.init_thread_context(thread_context=thread_context)
|
|
340
|
+
)
|
|
343
341
|
|
|
344
342
|
def handle_event(evt):
|
|
345
343
|
llm_messages.send_nowait(evt)
|
|
@@ -348,7 +346,7 @@ class ChatBot(SingleRoomAgent):
|
|
|
348
346
|
response = await self._llm_adapter.next(
|
|
349
347
|
context=chat_context,
|
|
350
348
|
room=self._room,
|
|
351
|
-
toolkits=thread_context
|
|
349
|
+
toolkits=await self.get_thread_toolkits(thread_context=thread_context, participant=participant),
|
|
352
350
|
tool_adapter=self._tool_adapter,
|
|
353
351
|
event_handler=handle_event
|
|
354
352
|
)
|
|
@@ -8,7 +8,7 @@ from meshagent.api.participant import Participant
|
|
|
8
8
|
import uuid
|
|
9
9
|
|
|
10
10
|
class AgentChatContext:
|
|
11
|
-
def __init__(self, *, messages: Optional[list[dict]] = None, system_role: Optional[str] = None):
|
|
11
|
+
def __init__(self, *, messages: Optional[list[dict]] = None, system_role: Optional[str] = None, previous_messages: Optional[list[dict]] = None, previous_response_id: Optional[str] = None):
|
|
12
12
|
self.id = str(uuid.uuid4())
|
|
13
13
|
if messages == None:
|
|
14
14
|
messages = list[dict]()
|
|
@@ -17,8 +17,11 @@ class AgentChatContext:
|
|
|
17
17
|
system_role = "system"
|
|
18
18
|
self._system_role = system_role
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
if previous_messages == None:
|
|
21
|
+
previous_messages = list[dict]()
|
|
22
|
+
|
|
23
|
+
self._previous_response_id = previous_response_id
|
|
24
|
+
self._previous_messages = previous_messages
|
|
22
25
|
|
|
23
26
|
@property
|
|
24
27
|
def messages(self):
|
|
@@ -36,7 +39,7 @@ class AgentChatContext:
|
|
|
36
39
|
def previous_response_id(self):
|
|
37
40
|
return self._previous_response_id
|
|
38
41
|
|
|
39
|
-
def
|
|
42
|
+
def track_response(self, id: str):
|
|
40
43
|
self._previous_response_id = id
|
|
41
44
|
self._previous_messages.extend(self.messages)
|
|
42
45
|
self.messages.clear()
|
|
@@ -73,12 +76,14 @@ class AgentChatContext:
|
|
|
73
76
|
def to_json(self) -> dict:
|
|
74
77
|
return {
|
|
75
78
|
"messages" : self.messages,
|
|
76
|
-
"system_role" : self.system_role
|
|
79
|
+
"system_role" : self.system_role,
|
|
80
|
+
"previous_messages" : self.previous_messages,
|
|
81
|
+
"previous_response_id" : self.previous_response_id
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
@staticmethod
|
|
80
85
|
def from_json(json: dict):
|
|
81
|
-
return AgentChatContext(messages=json["messages"], system_role=json.get("system_role", None))
|
|
86
|
+
return AgentChatContext(messages=json["messages"], system_role=json.get("system_role", None), previous_messages=json.get("previous_messages", None), previous_response_id=json.get("previous_response_id", None))
|
|
82
87
|
|
|
83
88
|
class AgentCallContext:
|
|
84
89
|
def __init__(self, *, chat: AgentChatContext, room: RoomClient, toolkits: Optional[list[Toolkit]] = None, caller: Optional[Participant] = None, on_behalf_of: Optional[Participant] = None):
|
|
@@ -18,9 +18,6 @@ import os
|
|
|
18
18
|
|
|
19
19
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
21
|
def _async_debounce(wait):
|
|
25
22
|
def decorator(func):
|
|
26
23
|
task = None
|
|
@@ -370,10 +367,10 @@ class StorageIndexer(SingleRoomAgent):
|
|
|
370
367
|
logger.error("error while indexing", exc_info=e)
|
|
371
368
|
|
|
372
369
|
|
|
373
|
-
def _on_file_deleted(self, path: str):
|
|
370
|
+
def _on_file_deleted(self, path: str, participant_id: str):
|
|
374
371
|
self._chan.send_nowait(FileIndexEvent(path=path, deleted=True))
|
|
375
372
|
|
|
376
|
-
def _on_file_updated(self, path: str):
|
|
373
|
+
def _on_file_updated(self, path: str, participant_id: str):
|
|
377
374
|
self._chan.send_nowait(FileIndexEvent(path=path, deleted=False))
|
|
378
375
|
|
|
379
376
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.8"
|
|
@@ -17,29 +17,19 @@ logger.setLevel(logging.INFO)
|
|
|
17
17
|
# todo: thread should stop when participant stops?
|
|
18
18
|
|
|
19
19
|
class Worker(TaskRunner):
|
|
20
|
-
def __init__(self, *, name, title = None, description = None, requires = None, llm_adapter: LLMAdapter, tool_adapter: Optional[ToolResponseAdapter] = None, toolkits: Optional[list[Toolkit]] = None, rules : Optional[list[str]] = None, supports_tools: bool = True):
|
|
20
|
+
def __init__(self, *, queue: str, prompt: str, name, title = None, description = None, requires = None, llm_adapter: LLMAdapter, tool_adapter: Optional[ToolResponseAdapter] = None, toolkits: Optional[list[Toolkit]] = None, rules : Optional[list[str]] = None, supports_tools: bool = True):
|
|
21
21
|
super().__init__(
|
|
22
22
|
name=name,
|
|
23
23
|
title=title,
|
|
24
24
|
description=description,
|
|
25
25
|
requires=requires,
|
|
26
|
-
input_schema={
|
|
27
|
-
"type" : "object",
|
|
28
|
-
"additionalProperties" : False,
|
|
29
|
-
"required" : [ "prompt", "queue" ],
|
|
30
|
-
"properties" : {
|
|
31
|
-
"prompt" : {
|
|
32
|
-
"type" : "string"
|
|
33
|
-
},
|
|
34
|
-
"queue" : {
|
|
35
|
-
"type" : "string"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
26
|
output_schema=None,
|
|
40
27
|
supports_tools=supports_tools
|
|
41
28
|
)
|
|
42
29
|
|
|
30
|
+
self._queue = queue
|
|
31
|
+
self._prompt = prompt
|
|
32
|
+
|
|
43
33
|
if toolkits == None:
|
|
44
34
|
toolkits = []
|
|
45
35
|
|
|
@@ -59,8 +49,8 @@ class Worker(TaskRunner):
|
|
|
59
49
|
|
|
60
50
|
async def ask(self, *, context: AgentCallContext, arguments: dict):
|
|
61
51
|
|
|
62
|
-
queue =
|
|
63
|
-
prompt =
|
|
52
|
+
queue = self._queue
|
|
53
|
+
prompt = self._prompt
|
|
64
54
|
|
|
65
55
|
step_schema = {
|
|
66
56
|
"type" : "object",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.8
|
|
4
4
|
Summary: Agent Building Blocks for Meshagent
|
|
5
|
-
|
|
6
|
-
License: Apache License 2.0
|
|
5
|
+
License-Expression: Apache-2.0
|
|
7
6
|
Project-URL: Documentation, https://meshagent.com
|
|
8
7
|
Project-URL: Website, https://meshagent.com
|
|
9
8
|
Project-URL: Source, https://github.com/meshagent
|
|
@@ -13,18 +12,12 @@ License-File: LICENSE
|
|
|
13
12
|
Requires-Dist: pyjwt>=2.0.0
|
|
14
13
|
Requires-Dist: pytest>=8.3.4
|
|
15
14
|
Requires-Dist: pytest-asyncio>=0.24.0
|
|
16
|
-
Requires-Dist: meshagent-api>=0.0.
|
|
17
|
-
Requires-Dist: meshagent-tools>=0.0.
|
|
18
|
-
Requires-Dist: meshagent-openai>=0.0.
|
|
15
|
+
Requires-Dist: meshagent-api>=0.0.8
|
|
16
|
+
Requires-Dist: meshagent-tools>=0.0.8
|
|
17
|
+
Requires-Dist: meshagent-openai>=0.0.8
|
|
19
18
|
Requires-Dist: pydantic>=2.10.4
|
|
20
19
|
Requires-Dist: pydantic-ai>=0.0.23
|
|
21
20
|
Requires-Dist: chonkie>=0.5.1
|
|
22
21
|
Requires-Dist: chonkie[semantic]>=0.5.1
|
|
23
22
|
Requires-Dist: chonkie[openai]>=0.5.1
|
|
24
|
-
Dynamic: description-content-type
|
|
25
|
-
Dynamic: license
|
|
26
23
|
Dynamic: license-file
|
|
27
|
-
Dynamic: project-url
|
|
28
|
-
Dynamic: requires-dist
|
|
29
|
-
Dynamic: requires-python
|
|
30
|
-
Dynamic: summary
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pyjwt>=2.0.0
|
|
2
2
|
pytest>=8.3.4
|
|
3
3
|
pytest-asyncio>=0.24.0
|
|
4
|
-
meshagent-api>=0.0.
|
|
5
|
-
meshagent-tools>=0.0.
|
|
6
|
-
meshagent-openai>=0.0.
|
|
4
|
+
meshagent-api>=0.0.8
|
|
5
|
+
meshagent-tools>=0.0.8
|
|
6
|
+
meshagent-openai>=0.0.8
|
|
7
7
|
pydantic>=2.10.4
|
|
8
8
|
pydantic-ai>=0.0.23
|
|
9
9
|
chonkie>=0.5.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=61.0",
|
|
4
|
+
"wheel"
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "meshagent-agents"
|
|
10
|
+
dynamic = ["version", "readme"]
|
|
11
|
+
description = "Agent Building Blocks for Meshagent"
|
|
12
|
+
requires-python = ">=3.9.0"
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
classifiers = []
|
|
15
|
+
keywords = []
|
|
16
|
+
dependencies = [
|
|
17
|
+
"pyjwt>=2.0.0",
|
|
18
|
+
"pytest>=8.3.4",
|
|
19
|
+
"pytest-asyncio>=0.24.0",
|
|
20
|
+
"meshagent-api>=0.0.8",
|
|
21
|
+
"meshagent-tools>=0.0.8",
|
|
22
|
+
"meshagent-openai>=0.0.8",
|
|
23
|
+
"pydantic>=2.10.4",
|
|
24
|
+
"pydantic-ai>=0.0.23",
|
|
25
|
+
"chonkie>=0.5.1",
|
|
26
|
+
"chonkie[semantic]>=0.5.1",
|
|
27
|
+
"chonkie[openai]>=0.5.1"
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Documentation = "https://meshagent.com"
|
|
32
|
+
Website = "https://meshagent.com"
|
|
33
|
+
Source = "https://github.com/meshagent"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
include = ["meshagent.*"]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.package-data]
|
|
39
|
+
"meshagent.agents" = ["py.typed", "*.pyi", "**/*.pyi", "**/*.js"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.dynamic]
|
|
42
|
+
version = {attr = "meshagent.agents.version.__version__"}
|
|
43
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.6"
|
meshagent_agents-0.0.6/setup.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import pathlib
|
|
3
|
-
from typing import Any, Dict
|
|
4
|
-
|
|
5
|
-
import setuptools # type: ignore
|
|
6
|
-
|
|
7
|
-
here = pathlib.Path(__file__).parent.resolve()
|
|
8
|
-
about: Dict[Any, Any] = {}
|
|
9
|
-
with open(os.path.join(here, "meshagent", "agents", "version.py"), "r") as f:
|
|
10
|
-
exec(f.read(), about)
|
|
11
|
-
|
|
12
|
-
setuptools.setup(
|
|
13
|
-
name="meshagent-agents",
|
|
14
|
-
version=about["__version__"],
|
|
15
|
-
description="Agent Building Blocks for Meshagent",
|
|
16
|
-
long_description=(here / "README.md").read_text(encoding="utf-8"),
|
|
17
|
-
long_description_content_type="text/markdown",
|
|
18
|
-
url="",
|
|
19
|
-
classifiers=[
|
|
20
|
-
],
|
|
21
|
-
keywords=[],
|
|
22
|
-
license="Apache License 2.0",
|
|
23
|
-
packages=setuptools.find_namespace_packages(include=[
|
|
24
|
-
"meshagent.*",
|
|
25
|
-
]),
|
|
26
|
-
python_requires=">=3.9.0",
|
|
27
|
-
install_requires=[
|
|
28
|
-
"pyjwt>=2.0.0",
|
|
29
|
-
"pytest>=8.3.4",
|
|
30
|
-
"pytest-asyncio>=0.24.0",
|
|
31
|
-
"meshagent-api>=0.0.6",
|
|
32
|
-
"meshagent-tools>=0.0.6",
|
|
33
|
-
"meshagent-openai>=0.0.6",
|
|
34
|
-
"pydantic>=2.10.4",
|
|
35
|
-
"pydantic-ai>=0.0.23",
|
|
36
|
-
"chonkie>=0.5.1",
|
|
37
|
-
"chonkie[semantic]>=0.5.1",
|
|
38
|
-
"chonkie[openai]>=0.5.1"
|
|
39
|
-
],
|
|
40
|
-
package_data={
|
|
41
|
-
"meshagent.agents": ["py.typed", "*.pyi", "**/*.pyi", "**/*.js"],
|
|
42
|
-
},
|
|
43
|
-
project_urls={
|
|
44
|
-
"Documentation": "https://meshagent.com",
|
|
45
|
-
"Website": "https://meshagent.com",
|
|
46
|
-
"Source": "https://github.com/meshagent",
|
|
47
|
-
},
|
|
48
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshagent_agents-0.0.6 → meshagent_agents-0.0.8}/meshagent_agents.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|