meshagent-agents 0.5.15__tar.gz → 0.6.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.

Potentially problematic release.


This version of meshagent-agents might be problematic. Click here for more details.

Files changed (40) hide show
  1. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/CHANGELOG.md +15 -0
  2. {meshagent_agents-0.5.15/meshagent_agents.egg-info → meshagent_agents-0.6.0}/PKG-INFO +8 -8
  3. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/README.md +1 -1
  4. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/__init__.py +0 -2
  5. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/adapter.py +22 -5
  6. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/agent.py +28 -29
  7. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/chat.py +519 -175
  8. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/context.py +16 -1
  9. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/development.py +3 -1
  10. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/indexer.py +2 -2
  11. meshagent_agents-0.6.0/meshagent/agents/llmrunner.py +169 -0
  12. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/mail.py +15 -17
  13. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/planning.py +3 -3
  14. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/pydantic.py +1 -1
  15. meshagent_agents-0.6.0/meshagent/agents/schemas/transcript.py +77 -0
  16. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/thread_schema.py +58 -7
  17. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/utils.py +0 -2
  18. meshagent_agents-0.6.0/meshagent/agents/version.py +1 -0
  19. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/worker.py +8 -4
  20. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/writer.py +1 -1
  21. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0/meshagent_agents.egg-info}/PKG-INFO +8 -8
  22. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent_agents.egg-info/SOURCES.txt +2 -1
  23. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent_agents.egg-info/requires.txt +5 -5
  24. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/pyproject.toml +6 -6
  25. meshagent_agents-0.5.15/meshagent/agents/hosting.py +0 -182
  26. meshagent_agents-0.5.15/meshagent/agents/version.py +0 -1
  27. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/LICENSE +0 -0
  28. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/MANIFEST.in +0 -0
  29. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/listener.py +0 -0
  30. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/prompt.py +0 -0
  31. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/__init__.py +0 -0
  32. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/document.py +0 -0
  33. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/gallery.py +0 -0
  34. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/presentation.py +0 -0
  35. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/schema.py +0 -0
  36. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/schemas/super_editor_document.py +0 -0
  37. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent/agents/single_shot_writer.py +0 -0
  38. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent_agents.egg-info/dependency_links.txt +0 -0
  39. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/meshagent_agents.egg-info/top_level.txt +0 -0
  40. {meshagent_agents-0.5.15 → meshagent_agents-0.6.0}/setup.cfg +0 -0
@@ -1,3 +1,18 @@
1
+ ## [0.6.0]
2
+ - Stability
3
+
4
+ ## [0.5.19]
5
+ - Stability
6
+
7
+ ## [0.5.18]
8
+ - Stability
9
+
10
+ ## [0.5.17]
11
+ - Stability
12
+
13
+ ## [0.5.16]
14
+ - Stability
15
+
1
16
  ## [0.5.15]
2
17
  - Stability
3
18
 
@@ -1,30 +1,30 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshagent-agents
3
- Version: 0.5.15
3
+ Version: 0.6.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
7
7
  Project-URL: Website, https://www.meshagent.com
8
8
  Project-URL: Source, https://www.meshagent.com
9
- Requires-Python: >=3.12
9
+ Requires-Python: >=3.13
10
10
  Description-Content-Type: text/markdown
11
11
  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.5.15
16
- Requires-Dist: meshagent-tools~=0.5.15
17
- Requires-Dist: meshagent-openai~=0.5.15
15
+ Requires-Dist: meshagent-api~=0.6.0
16
+ Requires-Dist: meshagent-tools~=0.6.0
17
+ Requires-Dist: meshagent-openai~=0.6.0
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.5.15; extra == "all"
21
+ Requires-Dist: meshagent-api[all]~=0.6.0; 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.5.15; extra == "sync"
27
+ Requires-Dist: meshagent-api[sync]~=0.6.0; extra == "sync"
28
28
  Provides-Extra: mail
29
29
  Requires-Dist: aiosmtplib~=4.0.1; extra == "mail"
30
30
  Provides-Extra: rag
@@ -54,7 +54,7 @@ The ``TaskRunner`` agent is useful when you want to invoke an agent with a well-
54
54
  The ``Worker`` is a queue-based ``SingleRoomAgent`` that processes queued messages with an LLM and optional tools. This is particularly helpful for running asynchronous jobs. With the ``Worker`` agent you can create a set of tasks that need to run in a Room and the ``Worker`` will execute all of the tasks in the queue.
55
55
 
56
56
  ### ChatBot
57
- The ``ChatBot`` is a conversational agent derived from the ``SingleRoomAgent``. It wires an LLMAdapter, optoinal tools, and manages chat threads for each user. This means multiple users can be in the same room interacting with a chat agent, but each user will have private messages with the agent. Check out the [Build and Deploy a Chat Agent](https://docs.meshagent.com/agents/standard/buildanddeploychatbot) example to learn how to create a simple Chat Agent without tools then add built-in MeshAgent tools and custom tools to the agent.
57
+ The ``ChatBot`` is a conversational agent derived from the ``SingleRoomAgent``. It wires an LLMAdapter, optoinal tools, and manages chat threads for each user. This means multiple users can be in the same room interacting with a chat agent, but each user will have private messages with the agent. Check out the [Build a Chat Agent](https://docs.meshagent.com/agents/standard/buildanddeploychatbot) example to learn how to create a simple Chat Agent without tools then add built-in MeshAgent tools and custom tools to the agent.
58
58
 
59
59
  ---
60
60
  ### Learn more about MeshAgent on our website or check out the docs for additional examples!
@@ -19,7 +19,7 @@ The ``TaskRunner`` agent is useful when you want to invoke an agent with a well-
19
19
  The ``Worker`` is a queue-based ``SingleRoomAgent`` that processes queued messages with an LLM and optional tools. This is particularly helpful for running asynchronous jobs. With the ``Worker`` agent you can create a set of tasks that need to run in a Room and the ``Worker`` will execute all of the tasks in the queue.
20
20
 
21
21
  ### ChatBot
22
- The ``ChatBot`` is a conversational agent derived from the ``SingleRoomAgent``. It wires an LLMAdapter, optoinal tools, and manages chat threads for each user. This means multiple users can be in the same room interacting with a chat agent, but each user will have private messages with the agent. Check out the [Build and Deploy a Chat Agent](https://docs.meshagent.com/agents/standard/buildanddeploychatbot) example to learn how to create a simple Chat Agent without tools then add built-in MeshAgent tools and custom tools to the agent.
22
+ The ``ChatBot`` is a conversational agent derived from the ``SingleRoomAgent``. It wires an LLMAdapter, optoinal tools, and manages chat threads for each user. This means multiple users can be in the same room interacting with a chat agent, but each user will have private messages with the agent. Check out the [Build a Chat Agent](https://docs.meshagent.com/agents/standard/buildanddeploychatbot) example to learn how to create a simple Chat Agent without tools then add built-in MeshAgent tools and custom tools to the agent.
23
23
 
24
24
  ---
25
25
  ### Learn more about MeshAgent on our website or check out the docs for additional examples!
@@ -8,7 +8,6 @@ from .agent import (
8
8
  )
9
9
  from .development import connect_development_agent
10
10
  from .listener import Listener, ListenerContext
11
- from .hosting import RemoteTaskRunnerServer
12
11
  from .adapter import ToolResponseAdapter, LLMAdapter
13
12
  from .thread_schema import thread_schema
14
13
  from .version import __version__
@@ -24,7 +23,6 @@ __all__ = [
24
23
  connect_development_agent,
25
24
  Listener,
26
25
  ListenerContext,
27
- RemoteTaskRunnerServer,
28
26
  ToolResponseAdapter,
29
27
  LLMAdapter,
30
28
  thread_schema,
@@ -1,11 +1,11 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from .agent import AgentChatContext
3
3
  from jsonschema import validate
4
- from meshagent.tools.toolkit import Response, Toolkit
5
- from meshagent.api import RoomClient
4
+ from meshagent.tools import Response, Toolkit, ToolkitBuilder, ToolkitConfig
5
+ from meshagent.api import RoomClient, RoomException, RemoteParticipant
6
6
  from typing import Any, Optional, Callable, TypeVar, Generic
7
7
 
8
- T = TypeVar("T")
8
+ TEvent = TypeVar("T")
9
9
 
10
10
 
11
11
  class ToolResponseAdapter(ABC):
@@ -28,7 +28,10 @@ class ToolResponseAdapter(ABC):
28
28
  pass
29
29
 
30
30
 
31
- class LLMAdapter(Generic[T]):
31
+ class LLMAdapter(Generic[TEvent]):
32
+ @abstractmethod
33
+ def default_model(self) -> str: ...
34
+
32
35
  def create_chat_context(self) -> AgentChatContext:
33
36
  return AgentChatContext()
34
37
 
@@ -38,6 +41,18 @@ class LLMAdapter(Generic[T]):
38
41
  ):
39
42
  return True
40
43
 
44
+ def tool_providers(self, *, model: str) -> list[ToolkitBuilder]:
45
+ return []
46
+
47
+ def make_toolkit(self, *, model: str, config: ToolkitConfig) -> Toolkit:
48
+ for tool in self.tool_providers(model=model):
49
+ if tool.name == config.name:
50
+ return Toolkit(
51
+ name=config.name, tools=[tool.make(model=model, config=config)]
52
+ )
53
+
54
+ raise RoomException(f"Unexpected tool: {config.name} for model {model}")
55
+
41
56
  @abstractmethod
42
57
  async def next(
43
58
  self,
@@ -47,7 +62,9 @@ class LLMAdapter(Generic[T]):
47
62
  toolkits: list[Toolkit],
48
63
  tool_adapter: Optional[ToolResponseAdapter] = None,
49
64
  output_schema: Optional[dict] = None,
50
- event_handler: Optional[Callable[[T], None]] = None,
65
+ event_handler: Optional[Callable[[TEvent], None]] = None,
66
+ model: Optional[str] = None,
67
+ on_behalf_of: Optional[RemoteParticipant] = None,
51
68
  ) -> Any:
52
69
  pass
53
70
 
@@ -12,16 +12,13 @@ from meshagent.api import (
12
12
  ToolkitDescription,
13
13
  Participant,
14
14
  RemoteParticipant,
15
- meshagent_base_url,
16
15
  StorageEntry,
17
16
  )
18
17
  from meshagent.api.protocol import Protocol
19
- from meshagent.tools.toolkit import (
18
+ from meshagent.tools import (
20
19
  Toolkit,
21
20
  Tool,
22
21
  ToolContext,
23
- toolkit_factory,
24
- register_toolkit_factory,
25
22
  )
26
23
  from meshagent.api.room_server_client import RoomClient
27
24
  from jsonschema import validate
@@ -194,12 +191,10 @@ class SingleRoomAgent(Agent):
194
191
 
195
192
  installed = False
196
193
 
194
+ builtin_agents_url = "http://localhost:8080"
195
+
197
196
  for requirement in self.requires:
198
197
  if isinstance(requirement, RequiredToolkit):
199
- if toolkit_factory(requirement.name) is not None:
200
- # no need to install something we can create from a factory
201
- continue
202
-
203
198
  if requirement.name == "ui":
204
199
  # TODO: maybe requirements can be marked as non installable?
205
200
  continue
@@ -207,12 +202,14 @@ class SingleRoomAgent(Agent):
207
202
  if requirement.name not in toolkits_by_name:
208
203
  installed = True
209
204
 
210
- logger.info(f"Installing required tool {requirement.name}")
205
+ logger.info(f"calling required tool into room {requirement.name}")
211
206
 
212
- if requirement.name.startswith("https://"):
207
+ if requirement.name.startswith(
208
+ "https://"
209
+ ) or requirement.name.startswith("http://"):
213
210
  url = requirement.name
214
211
  else:
215
- url = f"{meshagent_base_url()}/toolkits/{requirement.name}"
212
+ url = f"{builtin_agents_url}/toolkits/{requirement.name}"
216
213
 
217
214
  await self._room.agents.make_call(
218
215
  url=url, name=requirement.name, arguments={}
@@ -224,10 +221,12 @@ class SingleRoomAgent(Agent):
224
221
 
225
222
  logger.info(f"Installing required schema {requirement.name}")
226
223
 
227
- if requirement.name.startswith("https://"):
224
+ if requirement.name.startswith(
225
+ "https://"
226
+ ) or requirement.name.startswith("http://"):
228
227
  url = requirement.name
229
228
  else:
230
- url = f"{meshagent_base_url()}/schemas/{requirement.name}"
229
+ url = f"{builtin_agents_url}/schemas/{requirement.name}"
231
230
 
232
231
  await self._room.agents.make_call(
233
232
  url=url, name=requirement.name, arguments={}
@@ -239,7 +238,9 @@ class SingleRoomAgent(Agent):
239
238
  if installed:
240
239
  await asyncio.sleep(5)
241
240
 
242
- async def get_required_toolkits(self, context: ToolContext) -> list[Toolkit]:
241
+ async def get_toolkits(
242
+ self, context: ToolContext, remote_toolkits: list[RequiredToolkit]
243
+ ):
243
244
  tool_target = context.caller
244
245
  if context.on_behalf_of is not None:
245
246
  tool_target = context.on_behalf_of
@@ -255,20 +256,18 @@ class SingleRoomAgent(Agent):
255
256
  for toolkit_description in visible_tools:
256
257
  toolkits_by_name[toolkit_description.name] = toolkit_description
257
258
 
258
- for required_toolkit in self.requires:
259
+ for required_toolkit in remote_toolkits:
259
260
  if isinstance(required_toolkit, RequiredToolkit):
260
- if toolkit_factory(required_toolkit.name) is not None:
261
- toolkit = await toolkit_factory(required_toolkit.name)(
262
- context, required_toolkit
263
- )
264
- toolkits.append(toolkit)
265
- continue
266
-
267
261
  toolkit = toolkits_by_name.get(required_toolkit.name, None)
268
262
  if toolkit is None:
269
- raise RoomException(
270
- f"unable to locate required toolkit {required_toolkit.name}"
271
- )
263
+ if context.on_behalf_of is not None:
264
+ raise RoomException(
265
+ f"unable to get toolkit {required_toolkit.name} on behalf of {context.on_behalf_of}"
266
+ )
267
+ else:
268
+ raise RoomException(
269
+ f"unable to get toolkit {required_toolkit.name} for caller {context.caller.id}"
270
+ )
272
271
 
273
272
  room_tools = list[RoomTool]()
274
273
 
@@ -296,7 +295,7 @@ class SingleRoomAgent(Agent):
296
295
  tool_description = tools_by_name.get(required_tool, None)
297
296
  if tool_description is None:
298
297
  raise RoomException(
299
- f"unable to locate required tool {required_tool}"
298
+ f"unable to locate required tool {required_tool} in toolkit {required_toolkit.name}"
300
299
  )
301
300
 
302
301
  tool = RoomTool(
@@ -324,6 +323,9 @@ class SingleRoomAgent(Agent):
324
323
 
325
324
  return toolkits
326
325
 
326
+ async def get_required_toolkits(self, context: ToolContext) -> list[Toolkit]:
327
+ return await self.get_toolkits(context, self.requires)
328
+
327
329
 
328
330
  class TaskRunner(SingleRoomAgent):
329
331
  def __init__(
@@ -624,6 +626,3 @@ async def make_run_task_tool(context: ToolContext, toolkit: RequiredToolkit):
624
626
  )
625
627
 
626
628
  return Toolkit(name="agents", tools=tools)
627
-
628
-
629
- register_toolkit_factory("agents", make_run_task_tool)