langroid 0.56.0__py3-none-any.whl → 0.56.2__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.
@@ -50,6 +50,9 @@ Here is a summary of the dataframe:
50
50
  Do not assume any columns other than those shown.
51
51
  In the expression you submit to the `pandas_eval` tool/function,
52
52
  you are allowed to use the variable 'df' to refer to the dataframe.
53
+ IMPORTANT: You can only use expressions that return a value - assignment statements
54
+ (like df['col'] = value or temp = df['col']) are NOT allowed for security reasons.
55
+ To modify data, use methods like df.assign() that return a new dataframe.
53
56
 
54
57
  Sometimes you may not be able to answer the question in a single call to `pandas_eval`,
55
58
  so you can use a series of calls to `pandas_eval` to build up the answer.
@@ -63,6 +66,10 @@ Once you have the answer to the question, possibly after a few steps,
63
66
  say {DONE} and PRESENT THE ANSWER TO ME; do not just say {DONE}.
64
67
  If you receive an error message,
65
68
  try using the `pandas_eval` tool/function again with the corrected code.
69
+ If the error is due to an assignment statement (e.g., df['col'] = ...),
70
+ use df.assign(col=...) instead, which returns a new dataframe with the modified column.
71
+ For example: instead of df['airline'] = df['airline'].str.replace('*', ''),
72
+ use df.assign(airline=df['airline'].str.replace('*', '')).
66
73
 
67
74
  VERY IMPORTANT: When using the `pandas_eval` tool/function, DO NOT EXPLAIN ANYTHING,
68
75
  SIMPLY USE THE TOOL, with the CODE.
@@ -88,10 +88,9 @@ class TaskTool(ToolMessage):
88
88
  description="Optional max iterations for the sub-agent to run the task",
89
89
  )
90
90
 
91
- def handle(self, agent: ChatAgent) -> Optional[ChatDocument]:
91
+ def _set_up_task(self, agent: ChatAgent) -> Task:
92
92
  """
93
- Handle the TaskTool by creating a sub-agent with specified tools
94
- and running the task non-interactively.
93
+ Helper method to set up a task for the sub-agent.
95
94
 
96
95
  Args:
97
96
  agent: The parent ChatAgent that is handling this tool
@@ -144,6 +143,32 @@ class TaskTool(ToolMessage):
144
143
  # Create a non-interactive task
145
144
  task = Task(sub_agent, interactive=False)
146
145
 
146
+ return task
147
+
148
+ def handle(self, agent: ChatAgent) -> Optional[ChatDocument]:
149
+ """
150
+
151
+ Handle the TaskTool by creating a sub-agent with specified tools
152
+ and running the task non-interactively.
153
+
154
+ Args:
155
+ agent: The parent ChatAgent that is handling this tool
156
+ """
157
+
158
+ task = self._set_up_task(agent)
147
159
  # Run the task on the prompt, and return the result
148
160
  result = task.run(self.prompt, turns=self.max_iterations or 10)
149
161
  return result
162
+
163
+ async def handle_async(self, agent: ChatAgent) -> Optional[ChatDocument]:
164
+ """
165
+ Async method to handle the TaskTool by creating a sub-agent with specified tools
166
+ and running the task non-interactively.
167
+
168
+ Args:
169
+ agent: The parent ChatAgent that is handling this tool
170
+ """
171
+ task = self._set_up_task(agent)
172
+ # Run the task on the prompt, and return the result
173
+ result = await task.run_async(self.prompt, turns=self.max_iterations or 10)
174
+ return result
@@ -16,6 +16,7 @@ COMMON_USE_DF_METHODS = {
16
16
  "any",
17
17
  "apply",
18
18
  "applymap",
19
+ "assign",
19
20
  "at",
20
21
  "at_time",
21
22
  "between_time",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.56.0
3
+ Version: 0.56.2
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -345,6 +345,10 @@ teacher_task.run()
345
345
  <summary> <b>Click to expand</b></summary>
346
346
 
347
347
  - **Jun 2025:**
348
+ - [0.56.0](https://github.com/langroid/langroid/releases/tag/0.56.0) `TaskTool` for delegating tasks to sub-agents -
349
+ enables agents to spawn sub-agents with specific tools and configurations.
350
+ - [0.55.0](https://github.com/langroid/langroid/releases/tag/0.55.0) Event-based task termination with `done_sequences` -
351
+ declarative task completion using event patterns.
348
352
  - [0.54.0](https://github.com/langroid/langroid/releases/tag/0.54.0) Portkey AI Gateway support - access 200+ models
349
353
  across providers through unified API with caching, retries, observability.
350
354
  - **Mar-Apr 2025:**
@@ -21,7 +21,7 @@ langroid/agent/special/lance_doc_chat_agent.py,sha256=s8xoRs0gGaFtDYFUSIRchsgDVb
21
21
  langroid/agent/special/lance_tools.py,sha256=qS8x4wi8mrqfbYV2ztFzrcxyhHQ0ZWOc-zkYiH7awj0,2105
22
22
  langroid/agent/special/relevance_extractor_agent.py,sha256=zIx8GUdVo1aGW6ASla0NPQjYYIpmriK_TYMijqAx3F8,4796
23
23
  langroid/agent/special/retriever_agent.py,sha256=o2UfqiCGME0t85SZ6qjK041_WZYqXSuV1SeH_3KtVuc,1931
24
- langroid/agent/special/table_chat_agent.py,sha256=WS-E3QqI6Wm67-GNAcfIIl_TW7C-kYzlpd461hwLz6Y,10403
24
+ langroid/agent/special/table_chat_agent.py,sha256=T2YMFpOnW4YV-QXvB34MbaBGXBPiWeCiqO1bVKFykbg,10943
25
25
  langroid/agent/special/arangodb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  langroid/agent/special/arangodb/arangodb_agent.py,sha256=12Y54c84c9qXV-YXRBcI5HaqyiY75JR4TmqlURYKJAM,25851
27
27
  langroid/agent/special/arangodb/system_messages.py,sha256=udwfLleTdyz_DuxHuoiv2wHEZoAPBPbwdF_ivjIfP5c,6867
@@ -54,7 +54,7 @@ langroid/agent/tools/recipient_tool.py,sha256=dr0yTxgNEIoxUYxH6TtaExC4G_8WdJ0xGo
54
54
  langroid/agent/tools/retrieval_tool.py,sha256=zcAV20PP_6VzSd-UE-IJcabaBseFL_QNz59Bnig8-lE,946
55
55
  langroid/agent/tools/rewind_tool.py,sha256=XAXL3BpNhCmBGYq_qi_sZfHJuIw7NY2jp4wnojJ7WRs,5606
56
56
  langroid/agent/tools/segment_extract_tool.py,sha256=__srZ_VGYLVOdPrITUM8S0HpmX4q7r5FHWMDdHdEv8w,1440
57
- langroid/agent/tools/task_tool.py,sha256=jM1HjhPU6gicTjPZ6TBEeAFgGMWGz-ylVS0M1tb_ELk,5705
57
+ langroid/agent/tools/task_tool.py,sha256=O-3-tALocGuwfxXikBzRWFenFKZWIlOoRVvnZ5mf7io,6514
58
58
  langroid/agent/tools/tavily_search_tool.py,sha256=soI-j0HdgVQLf09wRQScaEK4b5RpAX9C4cwOivRFWWI,1903
59
59
  langroid/agent/tools/mcp/__init__.py,sha256=DJNM0VeFnFS3pJKCyFGggT8JVjVu0rBzrGzasT1HaSM,387
60
60
  langroid/agent/tools/mcp/decorators.py,sha256=h7dterhsmvWJ8q4mp_OopmuG2DF71ty8cZwOyzdDZuk,1127
@@ -118,7 +118,7 @@ langroid/utils/git_utils.py,sha256=WnflJ3R3owhlD0LNdSJakcKhExcEehE1UW5jYVQl8JY,7
118
118
  langroid/utils/globals.py,sha256=Az9dOFqR6n9CoTYSqa2kLikQWS0oCQ9DFQIQAnG-2q8,1355
119
119
  langroid/utils/logging.py,sha256=kmdpj1ozH1apf3o00Zgz-ZT-S4BHqUfF81GkY0Gf578,7262
120
120
  langroid/utils/object_registry.py,sha256=iPz9GHzvmCeVoidB3JdAMEKcxJEqTdUr0otQEexDZ5s,2100
121
- langroid/utils/pandas_utils.py,sha256=Zz_-dKogZR2Ijw5QNTHC2EcEmzgODPU-2_MVgS3274c,7266
121
+ langroid/utils/pandas_utils.py,sha256=IaEtdy4IkIh6fjc7XXpczwjhgWodoGmJX50LxoYSEeI,7280
122
122
  langroid/utils/pydantic_utils.py,sha256=R7Ps8VP56-eSo-LYHWllFo-SJ2zDmdItuuYpUq2gGJ8,20854
123
123
  langroid/utils/system.py,sha256=q3QJtTSapIwNe8MMhGEM03wgxPLmZiD47_sF1pKx53I,8472
124
124
  langroid/utils/types.py,sha256=-BvyIf_LmAJ5jR9NC7S4CSVNEr3XayAaxJ5o0TiIej0,2992
@@ -137,7 +137,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
137
137
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
138
138
  langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
139
139
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
140
- langroid-0.56.0.dist-info/METADATA,sha256=Ce8x84ihG8zSmHt62EzuTYlxxLH68R-CgT1ksrKzC7A,65366
141
- langroid-0.56.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
142
- langroid-0.56.0.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
- langroid-0.56.0.dist-info/RECORD,,
140
+ langroid-0.56.2.dist-info/METADATA,sha256=xViaD-RgD0cPpfoT2q50ORTwar8EgXJjRVWuifS7dKw,65744
141
+ langroid-0.56.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
142
+ langroid-0.56.2.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
143
+ langroid-0.56.2.dist-info/RECORD,,