aury-agent 0.0.14__py3-none-any.whl → 0.0.15__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.
@@ -46,6 +46,14 @@ class ToolContext:
46
46
  # Caller's middleware chain (for sub-agent inheritance)
47
47
  middleware: Any | None = None # MiddlewareChain
48
48
 
49
+ # Step number in the current invocation (for usage tracking)
50
+ step: int | None = None
51
+
52
+ @property
53
+ def tool_call_id(self) -> str:
54
+ """Alias for call_id for backward compatibility."""
55
+ return self.call_id
56
+
49
57
  async def emit(self, block: Any) -> None:
50
58
  """Emit a block event.
51
59
 
aury/agents/react/step.py CHANGED
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import time
6
7
  from typing import TYPE_CHECKING, Any
7
8
 
8
9
  from ..core.base import ToolInjectionMode
@@ -263,12 +264,14 @@ async def execute_step(agent: "ReactAgent") -> str | None:
263
264
  )
264
265
 
265
266
  # Call LLM
267
+ llm_start_time = time.time()
266
268
  await agent.bus.publish(
267
269
  Events.LLM_START,
268
270
  {
269
271
  "provider": agent.llm.provider,
270
272
  "model": agent.llm.model,
271
273
  "step": agent._current_step,
274
+ "invocation_id": agent._current_invocation.id if agent._current_invocation else None,
272
275
  "enable_thinking": enable_thinking,
273
276
  },
274
277
  )
@@ -556,6 +559,9 @@ async def execute_step(agent: "ReactAgent") -> str | None:
556
559
 
557
560
  elif event.type == "usage":
558
561
  if event.usage:
562
+ # Calculate duration
563
+ duration_ms = int((time.time() - llm_start_time) * 1000)
564
+
559
565
  # Store usage for middleware
560
566
  agent._last_usage = {
561
567
  "provider": agent.llm.provider,
@@ -565,6 +571,12 @@ async def execute_step(agent: "ReactAgent") -> str | None:
565
571
  "cache_read_tokens": event.usage.cache_read_tokens,
566
572
  "cache_write_tokens": event.usage.cache_write_tokens,
567
573
  "reasoning_tokens": event.usage.reasoning_tokens,
574
+ # Additional context for billing/tracking
575
+ "invocation_id": agent._current_invocation.id if agent._current_invocation else None,
576
+ "step": agent._current_step,
577
+ "duration_ms": duration_ms,
578
+ # Include ctx.metadata for trace_id, tenant_id, etc.
579
+ "meta": dict(agent.ctx.metadata) if agent.ctx.metadata else {},
568
580
  }
569
581
  await agent.bus.publish(
570
582
  Events.USAGE_RECORDED,
@@ -226,6 +226,7 @@ async def execute_tool(
226
226
  abort_signal=agent._abort,
227
227
  update_metadata=agent._noop_update_metadata,
228
228
  middleware=agent.middleware,
229
+ step=agent._current_step,
229
230
  )
230
231
 
231
232
  # Emit running status before execution
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aury-agent
3
- Version: 0.0.14
3
+ Version: 0.0.15
4
4
  Summary: Aury Agent Framework - React Agent and Workflow orchestration
5
5
  Author: Aury Team
6
6
  License: MIT
@@ -82,7 +82,7 @@ aury/agents/core/types/message.py,sha256=W0d8elddcbvW98bejDkHIzKiTigr6O5KxVuVUne
82
82
  aury/agents/core/types/recall.py,sha256=BZSDgv8Q0eK7Sshc-jA6ycpFpMHzndZ-lS86MPto9-c,4898
83
83
  aury/agents/core/types/session.py,sha256=JX7Zg3ojKaGE4pixIoqGgWHPvgRs19hb9mY2IDA1ICM,9656
84
84
  aury/agents/core/types/subagent.py,sha256=vIxDkfekAaHj_V2UdSIaygDKb5RjiLqi8twTnhIUF_o,4651
85
- aury/agents/core/types/tool.py,sha256=Fg3Fq9yodPx-j530zLMSNwwWkfzWApHjUcFDGtZkwdE,14448
85
+ aury/agents/core/types/tool.py,sha256=ccpCCP9VuTiJzAl4agtMqBYJEPxNYNo58VRBCYImsno,14688
86
86
  aury/agents/eval/__init__.py,sha256=uRGZN-RBpNlwOmrn66EwZBNKufDVKgMc3tODuMM6WB4,8850
87
87
  aury/agents/hitl/__init__.py,sha256=gcxGdXB9UlttWBXB4dNHwwAN3Vc2ZfmSMpaGM6BmsSE,1062
88
88
  aury/agents/hitl/ask_user.py,sha256=RtBHe29-UyiSxQDB-yMgxzO9BWmXyMaDm5xvD6iI5oo,9298
@@ -118,8 +118,8 @@ aury/agents/react/context.py,sha256=gARzqE4ez_xxA5JQJ2XoK-_2hnkV9MohscLnXpvYaL0,
118
118
  aury/agents/react/factory.py,sha256=3JOqFrOkp_UJMiBNitliP28s7C9eDP7YwuYIfigDCB4,10840
119
119
  aury/agents/react/pause.py,sha256=nUE2wHUDJsLdA3FHcnKVD9PdsGCrjQW1V8ZJUcssS5A,7857
120
120
  aury/agents/react/persistence.py,sha256=4BYmx3Dxu1grEpt4Qw3fUG26LgYyAhRnXVQC03OJDtE,6354
121
- aury/agents/react/step.py,sha256=pnG1xZ3pkK26CSVH8hx85J6L9pbg8jIRXi8P_SRvjjw,30470
122
- aury/agents/react/tools.py,sha256=rIZk3tKLUA_JiUaGvAJFiWgtVmUSWg-cU2iGVp-1LRc,18866
121
+ aury/agents/react/step.py,sha256=0-Qj205ux1Y9vLOoChv5zGjcz60MvIneAcSjKqGW7YA,31162
122
+ aury/agents/react/tools.py,sha256=dE2FfJa2iImsV0TNiP1QCw69rB0aGOhGYwMqObMUwJs,18904
123
123
  aury/agents/sandbox/__init__.py,sha256=adH29NhzpZUIFVCxhRUZxyANKpFauUjsPVd8iktUOaI,635
124
124
  aury/agents/sandbox/local.py,sha256=Dl-zJZ5FUz7WONtuze7MdpCDBjm9YZbjLIkGa9lYbwY,8328
125
125
  aury/agents/sandbox/remote.py,sha256=6NcYIs_thjyxa5LgIqwoPNsHYpT70DG6xGbjDYV6-X4,6444
@@ -150,7 +150,7 @@ aury/agents/workflow/expression.py,sha256=Hsx2jBigtt5zbJb9uK9pveipqMbBBUUAvlgYjB
150
150
  aury/agents/workflow/parser.py,sha256=mfiFZ_TtFq3IxAqPlTGcNkluiZ8ww16y3NYwbmbsrwE,6149
151
151
  aury/agents/workflow/state.py,sha256=AxTSo7P9b1DbWjGdQdzFY4_7m6CJGNFo7xkGK28SPZw,4234
152
152
  aury/agents/workflow/types.py,sha256=PVvjTQRgTObx5Mq_lXFogyLjGChOi5pUgcJwF5ZzVtg,2354
153
- aury_agent-0.0.14.dist-info/METADATA,sha256=J9hqoZ94RCaqkdCJCzwIbOkPLFRz-lIBhyyTjlOifPw,2115
154
- aury_agent-0.0.14.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
155
- aury_agent-0.0.14.dist-info/entry_points.txt,sha256=7EC5SMAKdC9HZLG8RfPhGno4OKOeSjaGsOWi1gOL-K8,56
156
- aury_agent-0.0.14.dist-info/RECORD,,
153
+ aury_agent-0.0.15.dist-info/METADATA,sha256=jS3XZmaGW9usD3GvRQsmmu03PQ-QxW6M2yQHOHugrDE,2115
154
+ aury_agent-0.0.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
155
+ aury_agent-0.0.15.dist-info/entry_points.txt,sha256=7EC5SMAKdC9HZLG8RfPhGno4OKOeSjaGsOWi1gOL-K8,56
156
+ aury_agent-0.0.15.dist-info/RECORD,,