meshagent-agents 0.2.1__tar.gz → 0.3.1__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.2.1 → meshagent_agents-0.3.1}/CHANGELOG.md +6 -0
- {meshagent_agents-0.2.1/meshagent_agents.egg-info → meshagent_agents-0.3.1}/PKG-INFO +6 -6
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/agent.py +7 -13
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/chat.py +55 -2
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/thread_schema.py +22 -1
- meshagent_agents-0.3.1/meshagent/agents/version.py +1 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/worker.py +38 -27
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1/meshagent_agents.egg-info}/PKG-INFO +6 -6
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent_agents.egg-info/requires.txt +5 -5
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/pyproject.toml +5 -5
- meshagent_agents-0.2.1/meshagent/agents/version.py +0 -1
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/LICENSE +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/MANIFEST.in +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/README.md +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/__init__.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/adapter.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/context.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/development.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/hosting.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/indexer.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/listener.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/mail.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/planning.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/prompt.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/pydantic.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/__init__.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/document.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/gallery.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/presentation.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/schema.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/super_editor_document.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/single_shot_writer.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/utils.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/writer.py +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent_agents.egg-info/SOURCES.txt +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent_agents.egg-info/dependency_links.txt +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent_agents.egg-info/top_level.txt +0 -0
- {meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Agent Building Blocks for Meshagent
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://docs.meshagent.com
|
|
@@ -12,19 +12,19 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: pyjwt~=2.10
|
|
13
13
|
Requires-Dist: pytest~=8.4
|
|
14
14
|
Requires-Dist: pytest-asyncio~=0.26
|
|
15
|
-
Requires-Dist: meshagent-api~=0.
|
|
16
|
-
Requires-Dist: meshagent-tools~=0.
|
|
17
|
-
Requires-Dist: meshagent-openai~=0.
|
|
15
|
+
Requires-Dist: meshagent-api~=0.3.1
|
|
16
|
+
Requires-Dist: meshagent-tools~=0.3.1
|
|
17
|
+
Requires-Dist: meshagent-openai~=0.3.1
|
|
18
18
|
Requires-Dist: pydantic~=2.11
|
|
19
19
|
Requires-Dist: opentelemetry-distro~=0.54b1
|
|
20
20
|
Provides-Extra: all
|
|
21
|
-
Requires-Dist: meshagent-api[all]~=0.
|
|
21
|
+
Requires-Dist: meshagent-api[all]~=0.3.1; extra == "all"
|
|
22
22
|
Requires-Dist: chonkie~=0.5.1; extra == "all"
|
|
23
23
|
Requires-Dist: chonkie[semantic]~=0.5.1; extra == "all"
|
|
24
24
|
Requires-Dist: chonkie[openai]~=0.5.1; extra == "all"
|
|
25
25
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "all"
|
|
26
26
|
Provides-Extra: sync
|
|
27
|
-
Requires-Dist: meshagent-api[sync]~=0.
|
|
27
|
+
Requires-Dist: meshagent-api[sync]~=0.3.1; extra == "sync"
|
|
28
28
|
Provides-Extra: mail
|
|
29
29
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "mail"
|
|
30
30
|
Provides-Extra: rag
|
|
@@ -222,22 +222,16 @@ class SingleRoomAgent(Agent):
|
|
|
222
222
|
if requirement.name not in schemas_by_name:
|
|
223
223
|
installed = True
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
logger.info(f"Installing required schema {requirement.name}")
|
|
226
226
|
|
|
227
|
-
if
|
|
228
|
-
|
|
229
|
-
pass
|
|
227
|
+
if requirement.name.startswith("https://"):
|
|
228
|
+
url = requirement.name
|
|
230
229
|
else:
|
|
231
|
-
|
|
230
|
+
url = f"{meshagent_base_url()}/schemas/{requirement.name}"
|
|
232
231
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
url = f"{meshagent_base_url()}/schemas/{requirement.name}"
|
|
237
|
-
|
|
238
|
-
await self._room.agents.make_call(
|
|
239
|
-
url=url, name=requirement.name, arguments={}
|
|
240
|
-
)
|
|
232
|
+
await self._room.agents.make_call(
|
|
233
|
+
url=url, name=requirement.name, arguments={}
|
|
234
|
+
)
|
|
241
235
|
|
|
242
236
|
else:
|
|
243
237
|
raise RoomException("unsupported requirement")
|
|
@@ -11,7 +11,7 @@ from meshagent.api import (
|
|
|
11
11
|
)
|
|
12
12
|
from meshagent.tools import Toolkit, ToolContext
|
|
13
13
|
from .adapter import LLMAdapter, ToolResponseAdapter
|
|
14
|
-
from meshagent.openai.tools.responses_adapter import ImageGenerationTool
|
|
14
|
+
from meshagent.openai.tools.responses_adapter import ImageGenerationTool, LocalShellTool
|
|
15
15
|
import asyncio
|
|
16
16
|
from typing import Optional
|
|
17
17
|
import logging
|
|
@@ -24,12 +24,55 @@ from openai.types.responses import ResponseStreamEvent
|
|
|
24
24
|
from asyncio import CancelledError
|
|
25
25
|
|
|
26
26
|
from opentelemetry import trace
|
|
27
|
+
import shlex
|
|
27
28
|
|
|
28
29
|
tracer = trace.get_tracer("meshagent.chatbot")
|
|
29
30
|
|
|
30
31
|
logger = logging.getLogger("chat")
|
|
31
32
|
|
|
32
33
|
|
|
34
|
+
class ChatBotThreadLocalShellTool(LocalShellTool):
|
|
35
|
+
def __init__(self, *, thread_context: "ChatThreadContext"):
|
|
36
|
+
super().__init__()
|
|
37
|
+
self.thread_context = thread_context
|
|
38
|
+
|
|
39
|
+
async def execute_shell_command(
|
|
40
|
+
self,
|
|
41
|
+
context,
|
|
42
|
+
*,
|
|
43
|
+
command,
|
|
44
|
+
env,
|
|
45
|
+
type,
|
|
46
|
+
timeout_ms=None,
|
|
47
|
+
user=None,
|
|
48
|
+
working_directory=None,
|
|
49
|
+
):
|
|
50
|
+
messages = None
|
|
51
|
+
|
|
52
|
+
for prop in self.thread_context.thread.root.get_children():
|
|
53
|
+
if prop.tag_name == "messages":
|
|
54
|
+
messages = prop
|
|
55
|
+
|
|
56
|
+
exec_element = messages.append_child(
|
|
57
|
+
tag_name="exec",
|
|
58
|
+
attributes={"command": shlex.join(command), "pwd": working_directory},
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
result = await super().execute_shell_command(
|
|
62
|
+
context,
|
|
63
|
+
command=command,
|
|
64
|
+
env=env,
|
|
65
|
+
type=type,
|
|
66
|
+
timeout_ms=timeout_ms,
|
|
67
|
+
user=user,
|
|
68
|
+
working_directory=working_directory,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
exec_element.set_attribute("result", result)
|
|
72
|
+
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
|
|
33
76
|
class ChatBotThreadOpenAIImageGenerationTool(ImageGenerationTool):
|
|
34
77
|
def __init__(
|
|
35
78
|
self,
|
|
@@ -188,6 +231,7 @@ class ChatThreadContext:
|
|
|
188
231
|
*,
|
|
189
232
|
chat: AgentChatContext,
|
|
190
233
|
thread: MeshDocument,
|
|
234
|
+
path: str,
|
|
191
235
|
participants: Optional[list[RemoteParticipant]] = None,
|
|
192
236
|
):
|
|
193
237
|
self.thread = thread
|
|
@@ -196,6 +240,7 @@ class ChatThreadContext:
|
|
|
196
240
|
|
|
197
241
|
self.participants = participants
|
|
198
242
|
self.chat = chat
|
|
243
|
+
self.path = path
|
|
199
244
|
|
|
200
245
|
|
|
201
246
|
# todo: thread should stop when participant stops?
|
|
@@ -500,7 +545,10 @@ class ChatBot(SingleRoomAgent):
|
|
|
500
545
|
doc_messages = prop
|
|
501
546
|
|
|
502
547
|
for element in doc_messages.get_children():
|
|
503
|
-
if
|
|
548
|
+
if (
|
|
549
|
+
isinstance(element, Element)
|
|
550
|
+
and element.tag_name == "message"
|
|
551
|
+
):
|
|
504
552
|
msg = element["text"]
|
|
505
553
|
if (
|
|
506
554
|
element["author_name"]
|
|
@@ -608,12 +656,17 @@ class ChatBot(SingleRoomAgent):
|
|
|
608
656
|
try:
|
|
609
657
|
if thread_context is None:
|
|
610
658
|
thread_context = ChatThreadContext(
|
|
659
|
+
path=path,
|
|
611
660
|
chat=chat_context,
|
|
612
661
|
thread=thread,
|
|
613
662
|
participants=get_thread_participants(
|
|
614
663
|
room=self.room, thread=thread
|
|
615
664
|
),
|
|
616
665
|
)
|
|
666
|
+
else:
|
|
667
|
+
thread_context.participants = get_thread_participants(
|
|
668
|
+
room=self.room, thread=thread
|
|
669
|
+
)
|
|
617
670
|
|
|
618
671
|
def handle_event(evt):
|
|
619
672
|
llm_messages.send_nowait(evt)
|
|
@@ -35,7 +35,7 @@ thread_schema = MeshSchema(
|
|
|
35
35
|
properties=[
|
|
36
36
|
ChildProperty(
|
|
37
37
|
name="items",
|
|
38
|
-
child_tag_names=["message"],
|
|
38
|
+
child_tag_names=["message", "exec"],
|
|
39
39
|
description="the messages in this thread",
|
|
40
40
|
)
|
|
41
41
|
],
|
|
@@ -66,6 +66,27 @@ thread_schema = MeshSchema(
|
|
|
66
66
|
),
|
|
67
67
|
],
|
|
68
68
|
),
|
|
69
|
+
ElementType(
|
|
70
|
+
tag_name="exec",
|
|
71
|
+
description="a command execution",
|
|
72
|
+
properties=[
|
|
73
|
+
ValueProperty(
|
|
74
|
+
name="command",
|
|
75
|
+
description="a command that was executed",
|
|
76
|
+
type="string",
|
|
77
|
+
),
|
|
78
|
+
ValueProperty(
|
|
79
|
+
name="result",
|
|
80
|
+
description="the result of the command",
|
|
81
|
+
type="string",
|
|
82
|
+
),
|
|
83
|
+
ValueProperty(
|
|
84
|
+
name="pwd",
|
|
85
|
+
description="the working directory the command was executed in",
|
|
86
|
+
type="string",
|
|
87
|
+
),
|
|
88
|
+
],
|
|
89
|
+
),
|
|
69
90
|
ElementType(
|
|
70
91
|
tag_name="message",
|
|
71
92
|
description="a message sent in the conversation",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.1"
|
|
@@ -95,31 +95,42 @@ class Worker(SingleRoomAgent):
|
|
|
95
95
|
*self._toolkits,
|
|
96
96
|
]
|
|
97
97
|
|
|
98
|
+
backoff = 0
|
|
98
99
|
while not self._done:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
100
|
+
try:
|
|
101
|
+
message = await room.queues.receive(
|
|
102
|
+
name=self._queue, create=True, wait=True
|
|
103
|
+
)
|
|
104
|
+
backoff = 0
|
|
105
|
+
if message is not None:
|
|
106
|
+
logger.info(f"received message on worker queue {message}")
|
|
107
|
+
try:
|
|
108
|
+
chat_context = await self.init_chat_context()
|
|
109
|
+
|
|
110
|
+
chat_context.append_rules(
|
|
111
|
+
rules=[
|
|
112
|
+
*self._rules,
|
|
113
|
+
]
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
await self.append_message_context(
|
|
117
|
+
room=room, message=message, chat_context=chat_context
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
await self.process_message(
|
|
121
|
+
chat_context=chat_context,
|
|
122
|
+
room=room,
|
|
123
|
+
message=message,
|
|
124
|
+
toolkits=toolkits,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
except Exception as e:
|
|
128
|
+
logger.error(f"Failed to process: {e}\n{message}", exc_info=e)
|
|
129
|
+
|
|
130
|
+
except Exception as e:
|
|
131
|
+
logger.error(
|
|
132
|
+
f"Worker error while receiving: {e}, will retry", exc_info=e
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
asyncio.sleep(0.1 * pow(2, backoff))
|
|
136
|
+
backoff = backoff + 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Agent Building Blocks for Meshagent
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://docs.meshagent.com
|
|
@@ -12,19 +12,19 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: pyjwt~=2.10
|
|
13
13
|
Requires-Dist: pytest~=8.4
|
|
14
14
|
Requires-Dist: pytest-asyncio~=0.26
|
|
15
|
-
Requires-Dist: meshagent-api~=0.
|
|
16
|
-
Requires-Dist: meshagent-tools~=0.
|
|
17
|
-
Requires-Dist: meshagent-openai~=0.
|
|
15
|
+
Requires-Dist: meshagent-api~=0.3.1
|
|
16
|
+
Requires-Dist: meshagent-tools~=0.3.1
|
|
17
|
+
Requires-Dist: meshagent-openai~=0.3.1
|
|
18
18
|
Requires-Dist: pydantic~=2.11
|
|
19
19
|
Requires-Dist: opentelemetry-distro~=0.54b1
|
|
20
20
|
Provides-Extra: all
|
|
21
|
-
Requires-Dist: meshagent-api[all]~=0.
|
|
21
|
+
Requires-Dist: meshagent-api[all]~=0.3.1; extra == "all"
|
|
22
22
|
Requires-Dist: chonkie~=0.5.1; extra == "all"
|
|
23
23
|
Requires-Dist: chonkie[semantic]~=0.5.1; extra == "all"
|
|
24
24
|
Requires-Dist: chonkie[openai]~=0.5.1; extra == "all"
|
|
25
25
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "all"
|
|
26
26
|
Provides-Extra: sync
|
|
27
|
-
Requires-Dist: meshagent-api[sync]~=0.
|
|
27
|
+
Requires-Dist: meshagent-api[sync]~=0.3.1; extra == "sync"
|
|
28
28
|
Provides-Extra: mail
|
|
29
29
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "mail"
|
|
30
30
|
Provides-Extra: rag
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
pyjwt~=2.10
|
|
2
2
|
pytest~=8.4
|
|
3
3
|
pytest-asyncio~=0.26
|
|
4
|
-
meshagent-api~=0.
|
|
5
|
-
meshagent-tools~=0.
|
|
6
|
-
meshagent-openai~=0.
|
|
4
|
+
meshagent-api~=0.3.1
|
|
5
|
+
meshagent-tools~=0.3.1
|
|
6
|
+
meshagent-openai~=0.3.1
|
|
7
7
|
pydantic~=2.11
|
|
8
8
|
opentelemetry-distro~=0.54b1
|
|
9
9
|
|
|
10
10
|
[all]
|
|
11
|
-
meshagent-api[all]~=0.
|
|
11
|
+
meshagent-api[all]~=0.3.1
|
|
12
12
|
chonkie~=0.5.1
|
|
13
13
|
chonkie[semantic]~=0.5.1
|
|
14
14
|
chonkie[openai]~=0.5.1
|
|
@@ -23,4 +23,4 @@ chonkie[semantic]~=0.5.1
|
|
|
23
23
|
chonkie[openai]~=0.5.1
|
|
24
24
|
|
|
25
25
|
[sync]
|
|
26
|
-
meshagent-api[sync]~=0.
|
|
26
|
+
meshagent-api[sync]~=0.3.1
|
|
@@ -17,16 +17,16 @@ dependencies = [
|
|
|
17
17
|
"pyjwt~=2.10",
|
|
18
18
|
"pytest~=8.4",
|
|
19
19
|
"pytest-asyncio~=0.26",
|
|
20
|
-
"meshagent-api~=0.
|
|
21
|
-
"meshagent-tools~=0.
|
|
22
|
-
"meshagent-openai~=0.
|
|
20
|
+
"meshagent-api~=0.3.1",
|
|
21
|
+
"meshagent-tools~=0.3.1",
|
|
22
|
+
"meshagent-openai~=0.3.1",
|
|
23
23
|
"pydantic~=2.11",
|
|
24
24
|
"opentelemetry-distro~=0.54b1"
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
28
28
|
all = [
|
|
29
|
-
"meshagent-api[all]~=0.
|
|
29
|
+
"meshagent-api[all]~=0.3.1",
|
|
30
30
|
"chonkie~=0.5.1",
|
|
31
31
|
"chonkie[semantic]~=0.5.1",
|
|
32
32
|
"chonkie[openai]~=0.5.1",
|
|
@@ -34,7 +34,7 @@ all = [
|
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
sync = [
|
|
37
|
-
"meshagent-api[sync]~=0.
|
|
37
|
+
"meshagent-api[sync]~=0.3.1",
|
|
38
38
|
]
|
|
39
39
|
|
|
40
40
|
mail = [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.1"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent/agents/schemas/super_editor_document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{meshagent_agents-0.2.1 → meshagent_agents-0.3.1}/meshagent_agents.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|