meshagent-agents 0.8.0__tar.gz → 0.12.0__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.
- meshagent_agents-0.12.0/CHANGELOG.md +44 -0
- {meshagent_agents-0.8.0/meshagent_agents.egg-info → meshagent_agents-0.12.0}/PKG-INFO +7 -6
- meshagent_agents-0.12.0/meshagent/agents/adapter.py +147 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/agent.py +8 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/chat.py +251 -355
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/context.py +55 -20
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/llmrunner.py +44 -1
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/mail.py +155 -3
- meshagent_agents-0.12.0/meshagent/agents/version.py +1 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/widget_schema.py +103 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/worker.py +1 -1
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0/meshagent_agents.egg-info}/PKG-INFO +7 -6
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent_agents.egg-info/requires.txt +6 -5
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/pyproject.toml +7 -6
- meshagent_agents-0.8.0/CHANGELOG.md +0 -238
- meshagent_agents-0.8.0/meshagent/agents/adapter.py +0 -72
- meshagent_agents-0.8.0/meshagent/agents/version.py +0 -1
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/LICENSE +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/MANIFEST.in +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/README.md +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/__init__.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/config.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/config_test.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/development.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/indexer.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/listener.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/planning.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/prompt.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/pydantic_agent.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/__init__.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/document.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/gallery.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/presentation.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/schema.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/super_editor_document.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/schemas/transcript.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/single_shot_writer.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/thread_schema.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/utils.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent/agents/writer.py +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent_agents.egg-info/SOURCES.txt +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent_agents.egg-info/dependency_links.txt +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/meshagent_agents.egg-info/top_level.txt +0 -0
- {meshagent_agents-0.8.0 → meshagent_agents-0.12.0}/setup.cfg +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
## [0.12.0]
|
|
2
|
+
- Reduce worker-queue logging verbosity to avoid logging full message payloads
|
|
3
|
+
|
|
4
|
+
## [0.11.0]
|
|
5
|
+
- Stability
|
|
6
|
+
|
|
7
|
+
## [0.10.1]
|
|
8
|
+
- Stability
|
|
9
|
+
|
|
10
|
+
## [0.10.0]
|
|
11
|
+
- Stability
|
|
12
|
+
|
|
13
|
+
## [0.9.3]
|
|
14
|
+
- Stability
|
|
15
|
+
|
|
16
|
+
## [0.9.2]
|
|
17
|
+
- Stability
|
|
18
|
+
|
|
19
|
+
## [0.9.1]
|
|
20
|
+
- Stability
|
|
21
|
+
|
|
22
|
+
## [0.9.0]
|
|
23
|
+
- Stability
|
|
24
|
+
|
|
25
|
+
## [0.8.4]
|
|
26
|
+
- Stability
|
|
27
|
+
|
|
28
|
+
## [0.8.3]
|
|
29
|
+
- Stability
|
|
30
|
+
|
|
31
|
+
## [0.8.2]
|
|
32
|
+
- Stability
|
|
33
|
+
|
|
34
|
+
## [0.8.1]
|
|
35
|
+
- Stability
|
|
36
|
+
|
|
37
|
+
## [0.8.0]
|
|
38
|
+
- Stability
|
|
39
|
+
|
|
40
|
+
## [0.7.2]
|
|
41
|
+
- Stability
|
|
42
|
+
|
|
43
|
+
## [0.7.1]
|
|
44
|
+
- Stability
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
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,20 @@ 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.12.0
|
|
16
|
+
Requires-Dist: meshagent-tools~=0.12.0
|
|
17
|
+
Requires-Dist: meshagent-openai~=0.12.0
|
|
18
18
|
Requires-Dist: pydantic~=2.11
|
|
19
19
|
Requires-Dist: opentelemetry-distro~=0.54b1
|
|
20
|
+
Requires-Dist: mistune~=3.1.4
|
|
20
21
|
Provides-Extra: all
|
|
21
|
-
Requires-Dist: meshagent-api[all]~=0.
|
|
22
|
+
Requires-Dist: meshagent-api[all]~=0.12.0; extra == "all"
|
|
22
23
|
Requires-Dist: chonkie~=0.5.1; extra == "all"
|
|
23
24
|
Requires-Dist: chonkie[semantic]~=0.5.1; extra == "all"
|
|
24
25
|
Requires-Dist: chonkie[openai]~=0.5.1; extra == "all"
|
|
25
26
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "all"
|
|
26
27
|
Provides-Extra: sync
|
|
27
|
-
Requires-Dist: meshagent-api[sync]~=0.
|
|
28
|
+
Requires-Dist: meshagent-api[sync]~=0.12.0; extra == "sync"
|
|
28
29
|
Provides-Extra: mail
|
|
29
30
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "mail"
|
|
30
31
|
Provides-Extra: rag
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from .agent import AgentChatContext
|
|
3
|
+
from jsonschema import validate
|
|
4
|
+
from meshagent.tools import Response, Toolkit, ToolkitBuilder, ToolkitConfig
|
|
5
|
+
from meshagent.api import RoomClient, RoomException, RemoteParticipant
|
|
6
|
+
from typing import Any, Optional, Callable, TypeVar, Generic, Literal
|
|
7
|
+
|
|
8
|
+
TEvent = TypeVar("T")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ToolResponseAdapter(ABC):
|
|
12
|
+
def __init__(self):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
async def to_plain_text(self, *, room: RoomClient, response: Response):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
async def create_messages(
|
|
21
|
+
self,
|
|
22
|
+
*,
|
|
23
|
+
context: AgentChatContext,
|
|
24
|
+
tool_call: Any,
|
|
25
|
+
room: RoomClient,
|
|
26
|
+
response: Response,
|
|
27
|
+
) -> list:
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class LLMAdapter(Generic[TEvent]):
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def default_model(self) -> str: ...
|
|
34
|
+
|
|
35
|
+
def create_chat_context(self) -> AgentChatContext:
|
|
36
|
+
return AgentChatContext()
|
|
37
|
+
|
|
38
|
+
async def check_for_termination(
|
|
39
|
+
self, *, context: AgentChatContext, room: RoomClient
|
|
40
|
+
):
|
|
41
|
+
return True
|
|
42
|
+
|
|
43
|
+
def tool_providers(self, *, model: str) -> list[ToolkitBuilder]:
|
|
44
|
+
return []
|
|
45
|
+
|
|
46
|
+
def make_toolkit(self, *, model: str, config: ToolkitConfig) -> Toolkit:
|
|
47
|
+
for tool in self.tool_providers(model=model):
|
|
48
|
+
if tool.name == config.name:
|
|
49
|
+
return Toolkit(
|
|
50
|
+
name=config.name, tools=[tool.make(model=model, config=config)]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
raise RoomException(f"Unexpected tool: {config.name} for model {model}")
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
async def next(
|
|
57
|
+
self,
|
|
58
|
+
*,
|
|
59
|
+
context: AgentChatContext,
|
|
60
|
+
room: RoomClient,
|
|
61
|
+
toolkits: list[Toolkit],
|
|
62
|
+
tool_adapter: Optional[ToolResponseAdapter] = None,
|
|
63
|
+
output_schema: Optional[dict] = None,
|
|
64
|
+
event_handler: Optional[Callable[[TEvent], None]] = None,
|
|
65
|
+
model: Optional[str] = None,
|
|
66
|
+
on_behalf_of: Optional[RemoteParticipant] = None,
|
|
67
|
+
) -> Any:
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
def validate(response: dict, output_schema: dict):
|
|
71
|
+
validate(response, output_schema)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class MessageStreamLLMAdapter(LLMAdapter):
|
|
75
|
+
def __init__(
|
|
76
|
+
self, *, participant_name: str, context_mode: Literal["diff", "full"] = "diff"
|
|
77
|
+
):
|
|
78
|
+
self.participant_name = participant_name
|
|
79
|
+
self.context_mode = context_mode
|
|
80
|
+
|
|
81
|
+
def default_model(self) -> str:
|
|
82
|
+
return "toolkit"
|
|
83
|
+
|
|
84
|
+
def create_chat_context(self) -> AgentChatContext:
|
|
85
|
+
return AgentChatContext()
|
|
86
|
+
|
|
87
|
+
async def check_for_termination(
|
|
88
|
+
self, *, context: AgentChatContext, room: RoomClient
|
|
89
|
+
):
|
|
90
|
+
return True
|
|
91
|
+
|
|
92
|
+
async def next(
|
|
93
|
+
self,
|
|
94
|
+
*,
|
|
95
|
+
context: AgentChatContext,
|
|
96
|
+
room: RoomClient,
|
|
97
|
+
toolkits: list[Toolkit],
|
|
98
|
+
tool_adapter: Optional[ToolResponseAdapter] = None,
|
|
99
|
+
output_schema: Optional[dict] = None,
|
|
100
|
+
event_handler: Optional[Callable[[TEvent], None]] = None,
|
|
101
|
+
model: Optional[str] = None,
|
|
102
|
+
on_behalf_of: Optional[RemoteParticipant] = None,
|
|
103
|
+
) -> Any:
|
|
104
|
+
participant = room.messaging.get_participant_by_name(self.participant_name)
|
|
105
|
+
if participant is None:
|
|
106
|
+
raise RoomException("participant is not currently connected")
|
|
107
|
+
|
|
108
|
+
stream = await room.messaging.create_stream(
|
|
109
|
+
to=participant,
|
|
110
|
+
header={
|
|
111
|
+
"context": context.to_json(),
|
|
112
|
+
"model": model,
|
|
113
|
+
"output_schema": output_schema,
|
|
114
|
+
"on_behalf_of_id": on_behalf_of.id if on_behalf_of else None,
|
|
115
|
+
},
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
error = None
|
|
119
|
+
output = None
|
|
120
|
+
try:
|
|
121
|
+
async for chunk in stream.read_chunks():
|
|
122
|
+
event = chunk.header.get("event")
|
|
123
|
+
if event is not None and event_handler is not None:
|
|
124
|
+
event_handler(event)
|
|
125
|
+
|
|
126
|
+
output = chunk.header.get("output")
|
|
127
|
+
if output is not None:
|
|
128
|
+
output.append(output)
|
|
129
|
+
|
|
130
|
+
if chunk.header.get("done"):
|
|
131
|
+
break
|
|
132
|
+
|
|
133
|
+
except Exception as ex:
|
|
134
|
+
error = ex
|
|
135
|
+
|
|
136
|
+
await stream.close()
|
|
137
|
+
|
|
138
|
+
if self.context_mode == "diff":
|
|
139
|
+
context.messages.clear()
|
|
140
|
+
|
|
141
|
+
if error:
|
|
142
|
+
raise error
|
|
143
|
+
|
|
144
|
+
return output
|
|
145
|
+
|
|
146
|
+
def validate(response: dict, output_schema: dict):
|
|
147
|
+
validate(response, output_schema)
|
|
@@ -343,6 +343,7 @@ class TaskRunner(SingleRoomAgent):
|
|
|
343
343
|
output_schema: Optional[dict] = None,
|
|
344
344
|
labels: Optional[list[str]] = None,
|
|
345
345
|
toolkits: Optional[list[Toolkit]] = None,
|
|
346
|
+
annotations: Optional[list[str]] = None,
|
|
346
347
|
):
|
|
347
348
|
super().__init__(
|
|
348
349
|
name=name,
|
|
@@ -370,6 +371,7 @@ class TaskRunner(SingleRoomAgent):
|
|
|
370
371
|
self._supports_tools = supports_tools
|
|
371
372
|
self._input_schema = input_schema
|
|
372
373
|
self._output_schema = output_schema
|
|
374
|
+
self._annotations = annotations
|
|
373
375
|
|
|
374
376
|
async def validate_arguments(self, arguments: dict):
|
|
375
377
|
validate(arguments, self.input_schema)
|
|
@@ -385,6 +387,10 @@ class TaskRunner(SingleRoomAgent):
|
|
|
385
387
|
def supports_tools(self):
|
|
386
388
|
return self._supports_tools
|
|
387
389
|
|
|
390
|
+
@property
|
|
391
|
+
def annotations(self):
|
|
392
|
+
return self._annotations
|
|
393
|
+
|
|
388
394
|
@property
|
|
389
395
|
def input_schema(self):
|
|
390
396
|
return self._input_schema
|
|
@@ -403,6 +409,7 @@ class TaskRunner(SingleRoomAgent):
|
|
|
403
409
|
"requires": list(map(lambda x: x.to_json(), self.requires)),
|
|
404
410
|
"supports_tools": self.supports_tools,
|
|
405
411
|
"labels": self.labels,
|
|
412
|
+
"annotations": self.annotations,
|
|
406
413
|
}
|
|
407
414
|
|
|
408
415
|
async def _register(self):
|
|
@@ -418,6 +425,7 @@ class TaskRunner(SingleRoomAgent):
|
|
|
418
425
|
"requires": list(map(lambda x: x.to_json(), self.requires)),
|
|
419
426
|
"supports_tools": self.supports_tools,
|
|
420
427
|
"labels": self.labels,
|
|
428
|
+
"annotations": self.annotations,
|
|
421
429
|
},
|
|
422
430
|
)
|
|
423
431
|
)["id"]
|