aury-agent 0.0.7__py3-none-any.whl → 0.0.10__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.
@@ -21,15 +21,10 @@ if TYPE_CHECKING:
21
21
 
22
22
 
23
23
  class MessageBackendMiddleware(BaseMiddleware):
24
- """Middleware that persists messages directly via MessageBackend.
24
+ """Middleware that persists messages via MessageBackend.
25
25
 
26
- This is the recommended middleware for message persistence.
27
- Uses backends.message from the context for direct storage.
28
-
29
- Features:
30
- - Saves both truncated (for LLM context) and raw (for audit) messages
31
- - Supports namespace isolation for sub-agents
32
- - Works with any MessageBackend implementation
26
+ Simple middleware that passes messages to the backend.
27
+ Storage details (raw/truncated handling) are left to the application layer.
33
28
 
34
29
  Example:
35
30
  agent = ReactAgent.create(
@@ -38,21 +33,6 @@ class MessageBackendMiddleware(BaseMiddleware):
38
33
  )
39
34
  """
40
35
 
41
- def __init__(
42
- self,
43
- *,
44
- save_raw: bool = False,
45
- max_history: int = 100,
46
- ):
47
- """Initialize MessageBackendMiddleware.
48
-
49
- Args:
50
- save_raw: Also save raw (untruncated) messages for audit
51
- max_history: Max messages to keep in history (for truncation)
52
- """
53
- self.save_raw = save_raw
54
- self.max_history = max_history
55
-
56
36
  async def on_message_save(
57
37
  self,
58
38
  message: dict[str, Any],
@@ -78,45 +58,17 @@ class MessageBackendMiddleware(BaseMiddleware):
78
58
  return message
79
59
 
80
60
  backend = ctx.backends.message
81
-
82
- # Extract message fields
83
- role = message.get("role", "")
84
- content = message.get("content", "")
85
61
  invocation_id = ctx.invocation_id or ""
86
62
  agent_id = ctx.agent_id
87
- tool_call_id = message.get("tool_call_id")
88
-
89
- # Build message dict for backend
90
- msg_dict = {
91
- "role": role,
92
- "content": content,
93
- }
94
- if tool_call_id:
95
- msg_dict["tool_call_id"] = tool_call_id
96
63
 
97
- # Include tool_calls if present (for assistant messages)
98
- if "tool_calls" in message:
99
- msg_dict["tool_calls"] = message["tool_calls"]
100
-
101
- # Save truncated message (for LLM context)
64
+ # Save message
102
65
  await backend.add(
103
66
  session_id=session_id,
104
- message=msg_dict,
105
- type="truncated",
67
+ message=message,
106
68
  agent_id=agent_id,
107
69
  invocation_id=invocation_id,
108
70
  )
109
71
 
110
- # Optionally save raw message (for audit)
111
- if self.save_raw:
112
- await backend.add(
113
- session_id=session_id,
114
- message=message, # Full original message
115
- type="raw",
116
- agent_id=agent_id,
117
- invocation_id=invocation_id,
118
- )
119
-
120
72
  # Pass through to other middlewares
121
73
  return message
122
74
 
@@ -40,6 +40,7 @@ def create_react_agent(
40
40
  snapshot: "SnapshotBackend | None" = None,
41
41
  # ContextProvider system
42
42
  context_providers: "list[ContextProvider] | None" = None,
43
+ message_provider: "ContextProvider | None" = None,
43
44
  enable_history: bool = True,
44
45
  history_limit: int = 50,
45
46
  # Tool customization
@@ -64,8 +65,9 @@ def create_react_agent(
64
65
  memory: Memory manager (optional)
65
66
  snapshot: Snapshot backend (optional)
66
67
  context_providers: Additional custom context providers (optional)
67
- enable_history: Enable message history (default True)
68
- history_limit: Max conversation turns to keep (default 50)
68
+ message_provider: Custom message context provider (replaces default MessageContextProvider)
69
+ enable_history: Enable message history (default True, ignored if message_provider is set)
70
+ history_limit: Max conversation turns to keep (default 50, ignored if message_provider is set)
69
71
  delegate_tool_class: Custom DelegateTool class (optional)
70
72
 
71
73
  Returns:
@@ -128,7 +130,7 @@ def create_react_agent(
128
130
  middleware_chain = MiddlewareChain()
129
131
  # Add message persistence middleware first (uses backends.message)
130
132
  if enable_history and backends.message is not None:
131
- middleware_chain.use(MessageBackendMiddleware(max_history=history_limit))
133
+ middleware_chain.use(MessageBackendMiddleware())
132
134
  # Add user middlewares
133
135
  if middlewares:
134
136
  for mw in middlewares:
@@ -152,10 +154,13 @@ def create_react_agent(
152
154
  # === Build providers ===
153
155
  default_providers: list["ContextProvider"] = []
154
156
 
155
- # MessageContextProvider - for fetching history (uses backends.message)
156
- if enable_history:
157
- message_provider = MessageContextProvider(max_messages=history_limit * 2)
157
+ # MessageContextProvider - for fetching history
158
+ # Use custom message_provider if provided, otherwise use default
159
+ if message_provider is not None:
158
160
  default_providers.append(message_provider)
161
+ elif enable_history:
162
+ default_message_provider = MessageContextProvider(max_messages=history_limit * 2)
163
+ default_providers.append(default_message_provider)
159
164
 
160
165
  # Combine default + custom context_providers
161
166
  all_providers = default_providers + (context_providers or [])
aury/agents/react/step.py CHANGED
@@ -293,10 +293,10 @@ async def execute_step(agent: "ReactAgent") -> str | None:
293
293
  if event.type == "content":
294
294
  # Text content
295
295
  if event.delta:
296
- # === Middleware: on_model_stream ===
297
- stream_chunk = {"delta": event.delta, "type": "content"}
296
+ # === Middleware: on_text_stream ===
297
+ stream_chunk = {"delta": event.delta}
298
298
  if agent.middleware:
299
- stream_chunk = await agent.middleware.process_stream_chunk(
299
+ stream_chunk = await agent.middleware.process_text_stream(
300
300
  stream_chunk
301
301
  )
302
302
  if stream_chunk is None:
@@ -328,10 +328,10 @@ async def execute_step(agent: "ReactAgent") -> str | None:
328
328
  # Thinking content - only emit if thinking is enabled
329
329
  stream_thinking = agent._get_stream_thinking()
330
330
  if event.delta and enable_thinking:
331
- # === Middleware: on_model_stream (type=thinking) ===
332
- stream_chunk = {"delta": event.delta, "type": "thinking"}
331
+ # === Middleware: on_thinking_stream ===
332
+ stream_chunk = {"delta": event.delta}
333
333
  if agent.middleware:
334
- stream_chunk = await agent.middleware.process_stream_chunk(
334
+ stream_chunk = await agent.middleware.process_thinking_stream(
335
335
  stream_chunk
336
336
  )
337
337
  if stream_chunk is None:
@@ -548,6 +548,67 @@ async def execute_step(agent: "ReactAgent") -> str | None:
548
548
  data={"message": event.error or "Unknown LLM error"},
549
549
  ))
550
550
 
551
+ # === Middleware: on_text_stream_end (flush buffered content) ===
552
+ if agent.middleware:
553
+ final_chunks = await agent.middleware.process_text_stream_end()
554
+ for final_chunk in final_chunks:
555
+ final_delta = final_chunk.get("delta", "")
556
+ if final_delta:
557
+ agent._text_buffer += final_delta
558
+ # Emit the final text content
559
+ if agent._current_text_block_id is None:
560
+ agent._current_text_block_id = generate_id("blk")
561
+ await agent.ctx.emit(BlockEvent(
562
+ block_id=agent._current_text_block_id,
563
+ kind=BlockKind.TEXT,
564
+ op=BlockOp.DELTA,
565
+ data={"content": final_delta},
566
+ ))
567
+ logger.debug(
568
+ f"Emitted final text chunk from middleware: {len(final_delta)} chars",
569
+ extra={"invocation_id": agent._current_invocation.id},
570
+ )
571
+
572
+ # Emit text block completed status
573
+ if agent._current_text_block_id:
574
+ await agent.ctx.emit(BlockEvent(
575
+ block_id=agent._current_text_block_id,
576
+ kind=BlockKind.TEXT,
577
+ op=BlockOp.PATCH,
578
+ data={"status": "completed"},
579
+ ))
580
+
581
+ # === Middleware: on_thinking_stream_end (flush buffered thinking) ===
582
+ if agent.middleware:
583
+ thinking_chunks = await agent.middleware.process_thinking_stream_end()
584
+ for thinking_chunk in thinking_chunks:
585
+ thinking_delta = thinking_chunk.get("delta", "")
586
+ if thinking_delta:
587
+ agent._thinking_buffer += thinking_delta
588
+ # Emit the final thinking content (if streaming thinking)
589
+ if agent.config.stream_thinking:
590
+ if agent._current_thinking_block_id is None:
591
+ agent._current_thinking_block_id = generate_id("blk")
592
+ await agent.ctx.emit(BlockEvent(
593
+ block_id=agent._current_thinking_block_id,
594
+ kind=BlockKind.THINKING,
595
+ op=BlockOp.DELTA,
596
+ data={"content": thinking_delta},
597
+ ))
598
+ logger.debug(
599
+ f"Emitted final thinking chunk from middleware: {len(thinking_delta)} chars",
600
+ extra={"invocation_id": agent._current_invocation.id},
601
+ )
602
+
603
+ # Emit thinking block completed status
604
+ if agent._current_thinking_block_id:
605
+ await agent.ctx.emit(BlockEvent(
606
+ block_id=agent._current_thinking_block_id,
607
+ kind=BlockKind.THINKING,
608
+ op=BlockOp.PATCH,
609
+ data={"status": "completed"},
610
+ ))
611
+
551
612
  # If thinking was buffered, emit it now
552
613
  if agent._thinking_buffer and not agent.config.stream_thinking:
553
614
  await agent.ctx.emit(BlockEvent(
@@ -288,6 +288,7 @@ async def process_tool_results(agent: "ReactAgent") -> None:
288
288
  role="tool",
289
289
  content=invocation.result,
290
290
  tool_call_id=invocation.tool_call_id,
291
+ name=invocation.tool_name, # Required for Gemini
291
292
  )
292
293
  )
293
294
 
@@ -339,6 +340,7 @@ async def process_tool_results(agent: "ReactAgent") -> None:
339
340
  {
340
341
  "type": "tool_result",
341
342
  "tool_use_id": invocation.tool_call_id,
343
+ "tool_name": invocation.tool_name,
342
344
  "content": result.output,
343
345
  "is_error": invocation.is_error,
344
346
  }
@@ -352,5 +354,6 @@ async def process_tool_results(agent: "ReactAgent") -> None:
352
354
  role="tool",
353
355
  content=tr["content"],
354
356
  tool_call_id=tr["tool_use_id"],
357
+ name=tr["tool_name"], # Required for Gemini
355
358
  )
356
359
  )
@@ -6,7 +6,7 @@ import inspect
6
6
  from functools import wraps
7
7
  from typing import Any, Callable, get_type_hints, get_origin, get_args, Union
8
8
 
9
- from ..core.types.tool import BaseTool, ToolContext, ToolResult, ToolInfo
9
+ from ..core.types.tool import BaseTool, ToolContext, ToolResult, ToolInfo, ToolConfig
10
10
 
11
11
 
12
12
  def _type_to_schema(t: type) -> dict[str, Any]:
@@ -196,20 +196,12 @@ def tool(
196
196
  accepts_ctx = "ctx" in sig.parameters or "context" in sig.parameters
197
197
  ctx_param_name = "ctx" if "ctx" in sig.parameters else "context"
198
198
 
199
- class FunctionTool:
199
+ class FunctionTool(BaseTool):
200
200
  """Tool created from decorated function."""
201
201
 
202
- @property
203
- def name(self) -> str:
204
- return tool_name
205
-
206
- @property
207
- def description(self) -> str:
208
- return tool_desc
209
-
210
- @property
211
- def parameters(self) -> dict[str, Any]:
212
- return parameters_schema
202
+ _name = tool_name
203
+ _description = tool_desc
204
+ _parameters = parameters_schema
213
205
 
214
206
  async def execute(
215
207
  self,
@@ -237,13 +229,6 @@ def tool(
237
229
 
238
230
  except Exception as e:
239
231
  return ToolResult.error(str(e))
240
-
241
- def get_info(self) -> ToolInfo:
242
- return ToolInfo(
243
- name=tool_name,
244
- description=tool_desc,
245
- parameters=parameters_schema,
246
- )
247
232
 
248
233
  return FunctionTool()
249
234
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aury-agent
3
- Version: 0.0.7
3
+ Version: 0.0.10
4
4
  Summary: Aury Agent Framework - React Agent and Workflow orchestration
5
5
  Author: Aury Team
6
6
  License: MIT
@@ -2,7 +2,7 @@ aury/__init__.py,sha256=yTnJ3EOYYknROar-CUqU825NRcsc06fAp_dEIEUwRMI,94
2
2
  aury/agents/__init__.py,sha256=kaSH-1392iNti6GfFJra9nl7lu4iz1QHANz-y7IDl8Q,1842
3
3
  aury/agents/plugin.py,sha256=V2KCu4MIBoar6BmCevKp7AzGZvHbGi3CizQSE2gCOzs,5438
4
4
  aury/agents/a2a/__init__.py,sha256=xwZLlAOhv2nGU6FHaCd8lygaJ5IPdVnvw-cB_w1Dwxg,4979
5
- aury/agents/backends/__init__.py,sha256=f7AOdMM2Tj9Qn7uJTR5SvMiA3slbrItHW6uDtiyy0R8,5946
5
+ aury/agents/backends/__init__.py,sha256=7vFpBzRUvWDUKv1aadFgIeQ8zcX-9F2J_BDRvT5BsiM,5898
6
6
  aury/agents/backends/sandbox.py,sha256=imOItqBu47GUc8sqHKDJFYlRoBlfn4VV-8CG8cL9480,8029
7
7
  aury/agents/backends/shell.py,sha256=Bc72UQ5LVu-ZKxb7K3V8wS8UI_WV0pib-F2Ou7_p3Rw,6006
8
8
  aury/agents/backends/artifact/__init__.py,sha256=YMKBSAoItGQMTqKBodWg8xaitJOMuOq4MGI9MuzpjkE,210
@@ -18,9 +18,9 @@ aury/agents/backends/invocation/types.py,sha256=2b3DcCmum6Ctkn7JuNZeSvnxRlN_VJ9Z
18
18
  aury/agents/backends/memory/__init__.py,sha256=mIaSJOnFNybMPNNOtR2zch_wFs6b11JFMp9LL8tvOLM,162
19
19
  aury/agents/backends/memory/memory.py,sha256=HWpME3vl4nLM5J3lv_iHuKjpbbLBLWE23SFFDG8NQJk,5621
20
20
  aury/agents/backends/memory/types.py,sha256=qbKPZc-E_SMnGVq1Eh_5Da_3Fp235p6xzV9b044qI2A,3680
21
- aury/agents/backends/message/__init__.py,sha256=Ea1WhfRsYjfsXvc2yzQVDSuKvLCZ0XXj-os-RgfmT6k,199
22
- aury/agents/backends/message/memory.py,sha256=yqh8lq1Hh1USaM7C4q-a8RbWRKFsyUSI2KGs1G1ZW74,3715
23
- aury/agents/backends/message/types.py,sha256=YepmOcfRUdtnaKXk6Oua6yKNeyDyB7fOkIWPt-Qknzc,3610
21
+ aury/agents/backends/message/__init__.py,sha256=NgQZPYZ7NJfZ59OXSx_s7LRvkXGYtkXx9f-F5QatLys,167
22
+ aury/agents/backends/message/memory.py,sha256=9DNMotsjje_jfwsixmgNlSxrigO93m6zgkFRbgrLxbU,2916
23
+ aury/agents/backends/message/types.py,sha256=eYRmjGbnD3NG84Tdz_OmfqnRe_j_ovHT6sgXxQ4mM14,2564
24
24
  aury/agents/backends/session/__init__.py,sha256=27WuH6ulc3RBrPN3pTK2iittVdGno5iMlY9knBKnZ-E,167
25
25
  aury/agents/backends/session/memory.py,sha256=qMBnNgq5HxA39VHGUtftzJqCtsSpHWuetqF5nFFnmgQ,2837
26
26
  aury/agents/backends/session/types.py,sha256=ukfmE__QIbDNeMz0pj6gYEyjHYtGgolpqPGEu7X_u6E,3309
@@ -50,13 +50,13 @@ aury/agents/context_providers/__init__.py,sha256=QlbTh2vAHbxfZcXjcY5mOsLqOiYkIYG
50
50
  aury/agents/context_providers/artifact.py,sha256=tjjaseE2iosKLx6BAJ7kR5xmo9VsNY2ukkbj5NLHlC0,9144
51
51
  aury/agents/context_providers/base.py,sha256=FhFRWJS_afDFTHl7Yjr6vGIje58IpEOlEolgqpFR-QQ,6246
52
52
  aury/agents/context_providers/memory.py,sha256=HKIR5fRNzsZSV1-IjV325cTYIFqmNVPFPujufSI1CrY,1942
53
- aury/agents/context_providers/message.py,sha256=3YkscDxhTzKkkCtCTOdRJHabXym0crJlu3eP2_A0lYY,4558
53
+ aury/agents/context_providers/message.py,sha256=LDQ1BPozyunh_4FM9WLcnf4CX3piOeD94zUkn9QG84o,4524
54
54
  aury/agents/context_providers/skill.py,sha256=w_R1txvu45ruMjuOtckuD9oG_hqeFGqAa_NZ_0T8WNs,1355
55
55
  aury/agents/context_providers/subagent.py,sha256=Y-6bYjaq6nbLS9d3siyy5eAt6SzFfk6N3Y1WU209lhI,1364
56
56
  aury/agents/context_providers/tool.py,sha256=wQGmcZi_XuB9ukweg5PUVO93GLzley0xftje-iVSfq8,2266
57
57
  aury/agents/core/__init__.py,sha256=-euIGAwoe2gU_2xEqJ8YmOMnDOaOlgWXwXxzIQnDG8E,1716
58
58
  aury/agents/core/base.py,sha256=nqsQ7fG0HZ08bqJh7KdpBgIxtJzDXZ6qLMf5hZ5vBuc,21279
59
- aury/agents/core/context.py,sha256=fDJ9S1sPuFbQJ9XihGdiPXDqZB01SxijxhiOose6C00,28933
59
+ aury/agents/core/context.py,sha256=co_v6Mz7fYR0jaTlUHlnSBWaOgr_1_84lVO0FPo_tKo,28932
60
60
  aury/agents/core/context_builder.py,sha256=HF0hfnKBVCmlcFDmdyj53org90318ixmZl1LYQBl0fM,9075
61
61
  aury/agents/core/factory.py,sha256=8rx_2jD9Sj2tK-8_We09fHT1czjbN-yF1ws0hmUX2w4,6829
62
62
  aury/agents/core/isolator.py,sha256=zi_ZXk-a6b7D2EAeWH3FKkO5_7PwK975zRd9enbBf_E,2916
@@ -79,7 +79,7 @@ aury/agents/core/types/message.py,sha256=W0d8elddcbvW98bejDkHIzKiTigr6O5KxVuVUne
79
79
  aury/agents/core/types/recall.py,sha256=BZSDgv8Q0eK7Sshc-jA6ycpFpMHzndZ-lS86MPto9-c,4898
80
80
  aury/agents/core/types/session.py,sha256=oRn9jKFe8Tg-12ZFQcGJ0VLaJIWBfk8YQDzXUuXSNEk,9406
81
81
  aury/agents/core/types/subagent.py,sha256=vIxDkfekAaHj_V2UdSIaygDKb5RjiLqi8twTnhIUF_o,4651
82
- aury/agents/core/types/tool.py,sha256=DqlK306lmeabb61BscqHbhdN7mx3whzndh3GYGqSb8Q,6366
82
+ aury/agents/core/types/tool.py,sha256=sP0mA_YufOjlPnEKcQSAbp719GkJulNuvQ76yYmahFU,7213
83
83
  aury/agents/eval/__init__.py,sha256=uRGZN-RBpNlwOmrn66EwZBNKufDVKgMc3tODuMM6WB4,8850
84
84
  aury/agents/hitl/__init__.py,sha256=6H8cBU-dSR0eSOGWte_Iy7OvTKGDl4ZMb0E56KrfFkw,1020
85
85
  aury/agents/hitl/ask_user.py,sha256=3MAJOo0rI0Wl7ZpZdDSQVBkO0GJFYH6bT7hnrcED4qI,9071
@@ -90,7 +90,7 @@ aury/agents/hitl/revert.py,sha256=i3F8Zcibuo3fjhJTK-rQEYSPMKxmRQeua5cjoDzAR14,66
90
90
  aury/agents/llm/__init__.py,sha256=teantqedfyQ6IxLD6LayLr2cbgFYbMT2I4TUSfkOrQ4,625
91
91
  aury/agents/llm/adapter.py,sha256=icX_RVk738PqxueCFj58WTPVhFXQpgNkjn__u2dZDEM,14916
92
92
  aury/agents/llm/openai.py,sha256=v4Qlc5EIJDNcqkGHA2aIEaTTKaPVGMPf1227aKcef58,11192
93
- aury/agents/llm/provider.py,sha256=zZ5xfbOEfcYSORrg05rylKVtfOzdzvolQ4GTPWEir2A,15376
93
+ aury/agents/llm/provider.py,sha256=oE7sBF64pq8h1-bowSwApmAl3SVlHV_I4aCMePD29Mk,16106
94
94
  aury/agents/mcp/__init__.py,sha256=7zsY-5LhQBLpiQI-XWe2uUHdTwJrDHrr0pDd_SXfO3o,4355
95
95
  aury/agents/memory/__init__.py,sha256=PMGMQ1VE-j3M0n4dIeb9DYO3qrCyv5AMSfMWTyhPARE,816
96
96
  aury/agents/memory/compaction.py,sha256=3inOVsbwSgTghcsSLgvUdX8IG2J6_0Qbr36vAqanV0M,12757
@@ -98,27 +98,25 @@ aury/agents/memory/manager.py,sha256=9UsuZUYmp5Pju9lRa0bsque6gHpLIE5UwdqtQKZ3fO0
98
98
  aury/agents/memory/processor.py,sha256=Y4PZIMFdNtn_TQ3fRdhynFLUgcURi8Xu-ZeRq5kDS_s,4816
99
99
  aury/agents/memory/store.py,sha256=SX5AYMbifCEFfLqPahhDRZLswZK0g6vFy523F1CTUWg,5822
100
100
  aury/agents/memory/types.py,sha256=N8Rhc79OEjdJ3Xe7iG1AwnWK1Ej6b-zI51FIqmyGmLg,4560
101
- aury/agents/messages/__init__.py,sha256=NiDuJPpzlWkQ-kQT7uxxZrWUVWJ0JS_x3q7QlTmaF3Y,930
101
+ aury/agents/messages/__init__.py,sha256=AAKgyGtnI60APvIo8RBgipF1jyaaOydUlL1TZVwXUH4,715
102
102
  aury/agents/messages/config.py,sha256=1ed8Akbna75Z5-eR6qnDPBFo91qwbdkSgQHc3wF5uBQ,1685
103
- aury/agents/messages/raw_store.py,sha256=QT6tJlJO-cBXKuVqYUsGXavWrA0cAsoJp6zcgMx6anY,6788
104
103
  aury/agents/messages/store.py,sha256=1zE24GHnXpPOhDQbehmAGQpNxW9Gv1-sas9dm0FYt4s,3969
105
104
  aury/agents/messages/types.py,sha256=riNl-C6f_zakpS673U0KRlAVSvQg5L4Pd6FNs2Isssg,2582
106
- aury/agents/middleware/__init__.py,sha256=T-A9u_T_x8QwgamDjUJc5GhF0VfMwOGLYezspypo4eg,896
107
- aury/agents/middleware/base.py,sha256=pm07DHWydXPug47_WkB4z57XhxvPcHR-oKo_U2UAOyo,9501
108
- aury/agents/middleware/chain.py,sha256=pp49Orth_ILEQkM8lmVT_1PFMnICpycqL4YfHShS82I,15359
109
- aury/agents/middleware/message.py,sha256=1Zw7c2WWjUFzKQ21mC_Ga0j6UbLnp4VHp4SC5FhsWSo,3581
105
+ aury/agents/middleware/__init__.py,sha256=8iafxYOQtYgzYUorN68gdq2xFbiGLd-D7JR263lIf9U,822
106
+ aury/agents/middleware/base.py,sha256=M4sKdIPOqHOsiiYveQaqgZgK-n4bQW2FSg5pbah_b04,10445
107
+ aury/agents/middleware/chain.py,sha256=7HlTvTZI5bOMIzp3UbIjCwhqXytJTgMndz8zhGnxEg8,17609
108
+ aury/agents/middleware/message.py,sha256=hDGGb0QwL04K2llbUId1938sd4DIJSpq_KnRJ6fcriE,2017
110
109
  aury/agents/middleware/message_container.py,sha256=0I_C-mIVVUqSzMzaYKUZGPtJUbV3Plo1msW8BIU-3RE,4073
111
- aury/agents/middleware/raw_message.py,sha256=ogcvGhqYLu6j35UJC4AGydokC91PHEQY81t-lcNy9y4,5064
112
110
  aury/agents/middleware/truncation.py,sha256=SM1ldZ6kC-joQVaoukNwFqKiHQ0symJAnzBJVANkxmg,4786
113
111
  aury/agents/middleware/types.py,sha256=T63AgePVSs4b1NT0MZ5PyaQJBLoVqNoAQt9NSGjBwBs,2512
114
112
  aury/agents/react/__init__.py,sha256=yixRP3RSXQtVaamtwjaOpmW55sZb-xp4XRjxYcy0HfU,90
115
113
  aury/agents/react/agent.py,sha256=DYWxuspMs3srOuxW4Sxis_Hkg4R6YkM0aM-rLRjD9Oo,23300
116
114
  aury/agents/react/context.py,sha256=Q7pY5j6b-OvKAmI1UsuawC3BmVxFkKN1oXxeBTVFejQ,11067
117
- aury/agents/react/factory.py,sha256=Y5S1wxIU2gvQsIb_7xBz8Nzr4IUZZkuF10hIbkT_DHk,10423
115
+ aury/agents/react/factory.py,sha256=7aWb2YqSdlIq161Ke0JZwnjpaA9U7Q5xejAnkrmjMUw,10776
118
116
  aury/agents/react/pause.py,sha256=bcrhbuoJQUz7WxZSsKr5qjxQlDdpwai54ns_qio0du4,7306
119
117
  aury/agents/react/persistence.py,sha256=bwRk5Dq1qIoIbfOsVe6BhGCuXJM5TUX-zyHt9zEVPzw,5845
120
- aury/agents/react/step.py,sha256=Btwo9VtPKNpetaLnBWtJ6bdRCYl13n7bmXmoNbTZr38,26302
121
- aury/agents/react/tools.py,sha256=0mDKeVIl6lmy3nLn0b_t-F0mEmtt7wwl7IbpV-Lfer4,13186
118
+ aury/agents/react/step.py,sha256=oUvmVUlzGX6aa_YcbhHAmA3UHgKJcMvK3IrMFzEX-IM,28994
119
+ aury/agents/react/tools.py,sha256=VxXec1K8C0h85yQZBVOQt0dhsmhSKCVV7iV_LXlasAs,13368
122
120
  aury/agents/sandbox/__init__.py,sha256=adH29NhzpZUIFVCxhRUZxyANKpFauUjsPVd8iktUOaI,635
123
121
  aury/agents/sandbox/local.py,sha256=Dl-zJZ5FUz7WONtuze7MdpCDBjm9YZbjLIkGa9lYbwY,8328
124
122
  aury/agents/sandbox/remote.py,sha256=6NcYIs_thjyxa5LgIqwoPNsHYpT70DG6xGbjDYV6-X4,6444
@@ -127,7 +125,7 @@ aury/agents/skill/__init__.py,sha256=CkWSSclFphXCrQkQDbf6ndclP4dsLvWYhSW8Wj5lVcw
127
125
  aury/agents/skill/loader.py,sha256=g2mhC0CLzP0s8BlNk21e_IEonHNyekK7EbqUOFkfOHc,5516
128
126
  aury/agents/skill/types.py,sha256=yDzMxF9S5D4NNA3k1KnQvhhVBd4plCu2oJXCWTO1jSI,2696
129
127
  aury/agents/tool/__init__.py,sha256=_IC06waxr9cC-HXdalwDByOBAZgfQiMwjsXypj-9mVE,731
130
- aury/agents/tool/decorator.py,sha256=u6x3NNGcXEPf1dp1amaJKQhIdApqm8redYsUcBYqZy4,8484
128
+ aury/agents/tool/decorator.py,sha256=dTd9tj851ydik-cjClsHB97gN34qXsv3IV9677y7u5g,8052
131
129
  aury/agents/tool/set.py,sha256=6UgI12E2b-C0Kfwg3KUr4e5kraBK887wbveAs8GudyY,7728
132
130
  aury/agents/tool/builtin/__init__.py,sha256=Pp5NlE0i1jiNlfZ6kVH-iSeE553RMysa4icmOgPzezI,513
133
131
  aury/agents/tool/builtin/ask_user.py,sha256=RnAJ969YE77AYG_foI7KlVsISvHj5Ykrdz0l2ZYZh-g,4871
@@ -149,7 +147,7 @@ aury/agents/workflow/expression.py,sha256=Hsx2jBigtt5zbJb9uK9pveipqMbBBUUAvlgYjB
149
147
  aury/agents/workflow/parser.py,sha256=mfiFZ_TtFq3IxAqPlTGcNkluiZ8ww16y3NYwbmbsrwE,6149
150
148
  aury/agents/workflow/state.py,sha256=AxTSo7P9b1DbWjGdQdzFY4_7m6CJGNFo7xkGK28SPZw,4234
151
149
  aury/agents/workflow/types.py,sha256=PVvjTQRgTObx5Mq_lXFogyLjGChOi5pUgcJwF5ZzVtg,2354
152
- aury_agent-0.0.7.dist-info/METADATA,sha256=r_qHU4CPbYLk0v9qkQQRWabo_oyfRbDdXrAwMiWCykA,2114
153
- aury_agent-0.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
154
- aury_agent-0.0.7.dist-info/entry_points.txt,sha256=7EC5SMAKdC9HZLG8RfPhGno4OKOeSjaGsOWi1gOL-K8,56
155
- aury_agent-0.0.7.dist-info/RECORD,,
150
+ aury_agent-0.0.10.dist-info/METADATA,sha256=O36iw-FfvggVYFrIhm5tnHP33J3jS9vsrQCZdMCgCJA,2115
151
+ aury_agent-0.0.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
152
+ aury_agent-0.0.10.dist-info/entry_points.txt,sha256=7EC5SMAKdC9HZLG8RfPhGno4OKOeSjaGsOWi1gOL-K8,56
153
+ aury_agent-0.0.10.dist-info/RECORD,,
@@ -1,224 +0,0 @@
1
- """Raw message store for complete message storage.
2
-
3
- RawMessageStore stores complete, untruncated messages for:
4
- - HITL recovery (restore exact state)
5
- - Full-context recall (when truncated history is insufficient)
6
- - Audit/debugging
7
-
8
- Messages are stored per invocation and can be cleaned up after invocation completes.
9
- """
10
- from __future__ import annotations
11
-
12
- from typing import Any, Protocol, runtime_checkable
13
- from datetime import datetime
14
-
15
- from ..core.types.session import generate_id
16
-
17
-
18
- @runtime_checkable
19
- class RawMessageStore(Protocol):
20
- """Protocol for raw message storage.
21
-
22
- Stores complete messages per invocation.
23
- """
24
-
25
- async def add(
26
- self,
27
- invocation_id: str,
28
- message: dict[str, Any],
29
- ) -> str:
30
- """Add a message and return its ID.
31
-
32
- Args:
33
- invocation_id: Invocation this message belongs to
34
- message: Complete message dict
35
-
36
- Returns:
37
- Generated message ID
38
- """
39
- ...
40
-
41
- async def get(self, msg_id: str) -> dict[str, Any] | None:
42
- """Get a single message by ID.
43
-
44
- Args:
45
- msg_id: Message ID
46
-
47
- Returns:
48
- Message dict or None if not found
49
- """
50
- ...
51
-
52
- async def get_many(self, msg_ids: list[str]) -> list[dict[str, Any]]:
53
- """Get multiple messages by IDs.
54
-
55
- Args:
56
- msg_ids: List of message IDs
57
-
58
- Returns:
59
- List of message dicts (in same order, None for missing)
60
- """
61
- ...
62
-
63
- async def get_by_invocation(self, invocation_id: str) -> list[dict[str, Any]]:
64
- """Get all messages for an invocation.
65
-
66
- Args:
67
- invocation_id: Invocation ID
68
-
69
- Returns:
70
- List of messages in chronological order
71
- """
72
- ...
73
-
74
- async def delete_by_invocation(self, invocation_id: str) -> int:
75
- """Delete all messages for an invocation.
76
-
77
- Args:
78
- invocation_id: Invocation ID
79
-
80
- Returns:
81
- Number of messages deleted
82
- """
83
- ...
84
-
85
-
86
- class StateBackendRawMessageStore:
87
- """RawMessageStore implementation backed by StateBackend."""
88
-
89
- def __init__(self, backend: Any): # StateBackend
90
- """Initialize with StateBackend.
91
-
92
- Args:
93
- backend: StateBackend instance
94
- """
95
- self._backend = backend
96
-
97
- async def add(
98
- self,
99
- invocation_id: str,
100
- message: dict[str, Any],
101
- ) -> str:
102
- """Add a message using StateBackend."""
103
- msg_id = generate_id("rmsg")
104
-
105
- # Store message with metadata
106
- await self._backend.set("raw_messages", msg_id, {
107
- "id": msg_id,
108
- "invocation_id": invocation_id,
109
- "message": message,
110
- "created_at": datetime.now().isoformat(),
111
- })
112
-
113
- # Add to invocation's message list
114
- inv_key = f"raw_msg_ids:{invocation_id}"
115
- msg_ids = await self._backend.get("raw_messages", inv_key) or []
116
- msg_ids.append(msg_id)
117
- await self._backend.set("raw_messages", inv_key, msg_ids)
118
-
119
- return msg_id
120
-
121
- async def get(self, msg_id: str) -> dict[str, Any] | None:
122
- """Get a single message."""
123
- data = await self._backend.get("raw_messages", msg_id)
124
- if data:
125
- return data.get("message")
126
- return None
127
-
128
- async def get_many(self, msg_ids: list[str]) -> list[dict[str, Any]]:
129
- """Get multiple messages."""
130
- results = []
131
- for msg_id in msg_ids:
132
- msg = await self.get(msg_id)
133
- if msg:
134
- results.append(msg)
135
- return results
136
-
137
- async def get_by_invocation(self, invocation_id: str) -> list[dict[str, Any]]:
138
- """Get all messages for an invocation."""
139
- inv_key = f"raw_msg_ids:{invocation_id}"
140
- msg_ids = await self._backend.get("raw_messages", inv_key) or []
141
- return await self.get_many(msg_ids)
142
-
143
- async def delete_by_invocation(self, invocation_id: str) -> int:
144
- """Delete all messages for an invocation."""
145
- inv_key = f"raw_msg_ids:{invocation_id}"
146
- msg_ids = await self._backend.get("raw_messages", inv_key) or []
147
-
148
- # Delete each message
149
- for msg_id in msg_ids:
150
- await self._backend.remove("raw_messages", msg_id)
151
-
152
- # Delete the index
153
- await self._backend.remove("raw_messages", inv_key)
154
-
155
- return len(msg_ids)
156
-
157
-
158
- class InMemoryRawMessageStore:
159
- """In-memory raw message store for testing."""
160
-
161
- def __init__(self) -> None:
162
- self._messages: dict[str, dict[str, Any]] = {} # msg_id -> message data
163
- self._invocation_index: dict[str, list[str]] = {} # inv_id -> [msg_ids]
164
-
165
- async def add(
166
- self,
167
- invocation_id: str,
168
- message: dict[str, Any],
169
- ) -> str:
170
- """Add a message."""
171
- msg_id = generate_id("rmsg")
172
-
173
- self._messages[msg_id] = {
174
- "id": msg_id,
175
- "invocation_id": invocation_id,
176
- "message": message,
177
- "created_at": datetime.now().isoformat(),
178
- }
179
-
180
- if invocation_id not in self._invocation_index:
181
- self._invocation_index[invocation_id] = []
182
- self._invocation_index[invocation_id].append(msg_id)
183
-
184
- return msg_id
185
-
186
- async def get(self, msg_id: str) -> dict[str, Any] | None:
187
- """Get a single message."""
188
- data = self._messages.get(msg_id)
189
- if data:
190
- return data.get("message")
191
- return None
192
-
193
- async def get_many(self, msg_ids: list[str]) -> list[dict[str, Any]]:
194
- """Get multiple messages."""
195
- results = []
196
- for msg_id in msg_ids:
197
- msg = await self.get(msg_id)
198
- if msg:
199
- results.append(msg)
200
- return results
201
-
202
- async def get_by_invocation(self, invocation_id: str) -> list[dict[str, Any]]:
203
- """Get all messages for an invocation."""
204
- msg_ids = self._invocation_index.get(invocation_id, [])
205
- return await self.get_many(msg_ids)
206
-
207
- async def delete_by_invocation(self, invocation_id: str) -> int:
208
- """Delete all messages for an invocation."""
209
- msg_ids = self._invocation_index.pop(invocation_id, [])
210
- for msg_id in msg_ids:
211
- self._messages.pop(msg_id, None)
212
- return len(msg_ids)
213
-
214
- def clear(self) -> None:
215
- """Clear all messages (for testing)."""
216
- self._messages.clear()
217
- self._invocation_index.clear()
218
-
219
-
220
- __all__ = [
221
- "RawMessageStore",
222
- "StateBackendRawMessageStore",
223
- "InMemoryRawMessageStore",
224
- ]