agno 2.3.7__py3-none-any.whl → 2.3.8__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.
- agno/agent/agent.py +371 -367
- agno/db/mongo/async_mongo.py +0 -24
- agno/db/mongo/mongo.py +0 -16
- agno/db/mysql/mysql.py +0 -19
- agno/db/postgres/async_postgres.py +0 -21
- agno/db/postgres/postgres.py +0 -23
- agno/db/redis/redis.py +0 -4
- agno/db/singlestore/singlestore.py +0 -11
- agno/db/sqlite/async_sqlite.py +0 -24
- agno/db/sqlite/sqlite.py +0 -20
- agno/models/base.py +134 -11
- agno/models/openai/responses.py +3 -2
- agno/os/interfaces/a2a/utils.py +1 -1
- agno/os/middleware/jwt.py +8 -6
- agno/team/team.py +88 -86
- agno/tools/workflow.py +8 -1
- agno/workflow/parallel.py +8 -2
- agno/workflow/step.py +3 -3
- {agno-2.3.7.dist-info → agno-2.3.8.dist-info}/METADATA +2 -2
- {agno-2.3.7.dist-info → agno-2.3.8.dist-info}/RECORD +23 -24
- agno/tools/memori.py +0 -339
- {agno-2.3.7.dist-info → agno-2.3.8.dist-info}/WHEEL +0 -0
- {agno-2.3.7.dist-info → agno-2.3.8.dist-info}/licenses/LICENSE +0 -0
- {agno-2.3.7.dist-info → agno-2.3.8.dist-info}/top_level.txt +0 -0
agno/db/mongo/async_mongo.py
CHANGED
|
@@ -2265,14 +2265,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2265
2265
|
if trace.workflow_id is not None:
|
|
2266
2266
|
update_values["workflow_id"] = trace.workflow_id
|
|
2267
2267
|
|
|
2268
|
-
log_debug(
|
|
2269
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2270
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2271
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2272
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2273
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2274
|
-
)
|
|
2275
|
-
|
|
2276
2268
|
await collection.update_one({"trace_id": trace.trace_id}, {"$set": update_values})
|
|
2277
2269
|
else:
|
|
2278
2270
|
trace_dict = trace.to_dict()
|
|
@@ -2380,11 +2372,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2380
2372
|
try:
|
|
2381
2373
|
from agno.tracing.schemas import Trace as TraceSchema
|
|
2382
2374
|
|
|
2383
|
-
log_debug(
|
|
2384
|
-
f"get_traces called with filters: run_id={run_id}, session_id={session_id}, "
|
|
2385
|
-
f"user_id={user_id}, agent_id={agent_id}, page={page}, limit={limit}"
|
|
2386
|
-
)
|
|
2387
|
-
|
|
2388
2375
|
collection = await self._get_collection(table_type="traces")
|
|
2389
2376
|
if collection is None:
|
|
2390
2377
|
log_debug("Traces collection not found")
|
|
@@ -2398,7 +2385,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2398
2385
|
if run_id:
|
|
2399
2386
|
query["run_id"] = run_id
|
|
2400
2387
|
if session_id:
|
|
2401
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2402
2388
|
query["session_id"] = session_id
|
|
2403
2389
|
if user_id:
|
|
2404
2390
|
query["user_id"] = user_id
|
|
@@ -2420,14 +2406,12 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2420
2406
|
|
|
2421
2407
|
# Get total count
|
|
2422
2408
|
total_count = await collection.count_documents(query)
|
|
2423
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2424
2409
|
|
|
2425
2410
|
# Apply pagination
|
|
2426
2411
|
skip = ((page or 1) - 1) * (limit or 20)
|
|
2427
2412
|
cursor = collection.find(query).sort("start_time", -1).skip(skip).limit(limit or 20)
|
|
2428
2413
|
|
|
2429
2414
|
results = await cursor.to_list(length=None)
|
|
2430
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2431
2415
|
|
|
2432
2416
|
traces = []
|
|
2433
2417
|
for row in results:
|
|
@@ -2481,12 +2465,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2481
2465
|
workflow_id, first_trace_at, last_trace_at.
|
|
2482
2466
|
"""
|
|
2483
2467
|
try:
|
|
2484
|
-
log_debug(
|
|
2485
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2486
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2487
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2488
|
-
)
|
|
2489
|
-
|
|
2490
2468
|
collection = await self._get_collection(table_type="traces")
|
|
2491
2469
|
if collection is None:
|
|
2492
2470
|
log_debug("Traces collection not found")
|
|
@@ -2532,7 +2510,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2532
2510
|
count_pipeline = pipeline + [{"$count": "total"}]
|
|
2533
2511
|
count_result = await collection.aggregate(count_pipeline).to_list(length=1)
|
|
2534
2512
|
total_count = count_result[0]["total"] if count_result else 0
|
|
2535
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2536
2513
|
|
|
2537
2514
|
# Apply pagination
|
|
2538
2515
|
skip = ((page or 1) - 1) * (limit or 20)
|
|
@@ -2540,7 +2517,6 @@ class AsyncMongoDb(AsyncBaseDb):
|
|
|
2540
2517
|
pipeline.append({"$limit": limit or 20})
|
|
2541
2518
|
|
|
2542
2519
|
results = await collection.aggregate(pipeline).to_list(length=None)
|
|
2543
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2544
2520
|
|
|
2545
2521
|
# Convert to list of dicts with datetime objects
|
|
2546
2522
|
stats_list = []
|
agno/db/mongo/mongo.py
CHANGED
|
@@ -2217,11 +2217,6 @@ class MongoDb(BaseDb):
|
|
|
2217
2217
|
try:
|
|
2218
2218
|
from agno.tracing.schemas import Trace as TraceSchema
|
|
2219
2219
|
|
|
2220
|
-
log_debug(
|
|
2221
|
-
f"get_traces called with filters: run_id={run_id}, session_id={session_id}, "
|
|
2222
|
-
f"user_id={user_id}, agent_id={agent_id}, page={page}, limit={limit}"
|
|
2223
|
-
)
|
|
2224
|
-
|
|
2225
2220
|
collection = self._get_collection(table_type="traces")
|
|
2226
2221
|
if collection is None:
|
|
2227
2222
|
log_debug("Traces collection not found")
|
|
@@ -2235,7 +2230,6 @@ class MongoDb(BaseDb):
|
|
|
2235
2230
|
if run_id:
|
|
2236
2231
|
query["run_id"] = run_id
|
|
2237
2232
|
if session_id:
|
|
2238
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2239
2233
|
query["session_id"] = session_id
|
|
2240
2234
|
if user_id:
|
|
2241
2235
|
query["user_id"] = user_id
|
|
@@ -2257,14 +2251,12 @@ class MongoDb(BaseDb):
|
|
|
2257
2251
|
|
|
2258
2252
|
# Get total count
|
|
2259
2253
|
total_count = collection.count_documents(query)
|
|
2260
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2261
2254
|
|
|
2262
2255
|
# Apply pagination
|
|
2263
2256
|
skip = ((page or 1) - 1) * (limit or 20)
|
|
2264
2257
|
cursor = collection.find(query).sort("start_time", -1).skip(skip).limit(limit or 20)
|
|
2265
2258
|
|
|
2266
2259
|
results = list(cursor)
|
|
2267
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2268
2260
|
|
|
2269
2261
|
traces = []
|
|
2270
2262
|
for row in results:
|
|
@@ -2318,12 +2310,6 @@ class MongoDb(BaseDb):
|
|
|
2318
2310
|
workflow_id, first_trace_at, last_trace_at.
|
|
2319
2311
|
"""
|
|
2320
2312
|
try:
|
|
2321
|
-
log_debug(
|
|
2322
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2323
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2324
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2325
|
-
)
|
|
2326
|
-
|
|
2327
2313
|
collection = self._get_collection(table_type="traces")
|
|
2328
2314
|
if collection is None:
|
|
2329
2315
|
log_debug("Traces collection not found")
|
|
@@ -2369,7 +2355,6 @@ class MongoDb(BaseDb):
|
|
|
2369
2355
|
count_pipeline = pipeline + [{"$count": "total"}]
|
|
2370
2356
|
count_result = list(collection.aggregate(count_pipeline))
|
|
2371
2357
|
total_count = count_result[0]["total"] if count_result else 0
|
|
2372
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2373
2358
|
|
|
2374
2359
|
# Apply pagination
|
|
2375
2360
|
skip = ((page or 1) - 1) * (limit or 20)
|
|
@@ -2377,7 +2362,6 @@ class MongoDb(BaseDb):
|
|
|
2377
2362
|
pipeline.append({"$limit": limit or 20})
|
|
2378
2363
|
|
|
2379
2364
|
results = list(collection.aggregate(pipeline))
|
|
2380
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2381
2365
|
|
|
2382
2366
|
# Convert to list of dicts with datetime objects
|
|
2383
2367
|
stats_list = []
|
agno/db/mysql/mysql.py
CHANGED
|
@@ -2514,14 +2514,6 @@ class MySQLDb(BaseDb):
|
|
|
2514
2514
|
if trace.workflow_id is not None:
|
|
2515
2515
|
update_values["workflow_id"] = trace.workflow_id
|
|
2516
2516
|
|
|
2517
|
-
log_debug(
|
|
2518
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2519
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2520
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2521
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2522
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2523
|
-
)
|
|
2524
|
-
|
|
2525
2517
|
stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2526
2518
|
sess.execute(stmt)
|
|
2527
2519
|
else:
|
|
@@ -2642,7 +2634,6 @@ class MySQLDb(BaseDb):
|
|
|
2642
2634
|
if run_id:
|
|
2643
2635
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2644
2636
|
if session_id:
|
|
2645
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2646
2637
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2647
2638
|
if user_id:
|
|
2648
2639
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2664,14 +2655,12 @@ class MySQLDb(BaseDb):
|
|
|
2664
2655
|
# Get total count
|
|
2665
2656
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2666
2657
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2667
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2668
2658
|
|
|
2669
2659
|
# Apply pagination
|
|
2670
2660
|
offset = (page - 1) * limit if page and limit else 0
|
|
2671
2661
|
paginated_stmt = base_stmt.order_by(table.c.start_time.desc()).limit(limit).offset(offset)
|
|
2672
2662
|
|
|
2673
2663
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2674
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2675
2664
|
|
|
2676
2665
|
traces = [Trace.from_dict(dict(row._mapping)) for row in results]
|
|
2677
2666
|
return traces, total_count
|
|
@@ -2709,12 +2698,6 @@ class MySQLDb(BaseDb):
|
|
|
2709
2698
|
workflow_id, first_trace_at, last_trace_at.
|
|
2710
2699
|
"""
|
|
2711
2700
|
try:
|
|
2712
|
-
log_debug(
|
|
2713
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2714
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2715
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2716
|
-
)
|
|
2717
|
-
|
|
2718
2701
|
table = self._get_table(table_type="traces")
|
|
2719
2702
|
if table is None:
|
|
2720
2703
|
log_debug("Traces table not found")
|
|
@@ -2758,14 +2741,12 @@ class MySQLDb(BaseDb):
|
|
|
2758
2741
|
# Get total count of sessions
|
|
2759
2742
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2760
2743
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2761
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2762
2744
|
|
|
2763
2745
|
# Apply pagination and ordering
|
|
2764
2746
|
offset = (page - 1) * limit if page and limit else 0
|
|
2765
2747
|
paginated_stmt = base_stmt.order_by(func.max(table.c.created_at).desc()).limit(limit).offset(offset)
|
|
2766
2748
|
|
|
2767
2749
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2768
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2769
2750
|
|
|
2770
2751
|
# Convert to list of dicts with datetime objects
|
|
2771
2752
|
stats_list = []
|
|
@@ -2186,14 +2186,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2186
2186
|
if trace.workflow_id is not None:
|
|
2187
2187
|
update_values["workflow_id"] = trace.workflow_id
|
|
2188
2188
|
|
|
2189
|
-
log_debug(
|
|
2190
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2191
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2192
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2193
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2194
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2195
|
-
)
|
|
2196
|
-
|
|
2197
2189
|
stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2198
2190
|
await sess.execute(stmt)
|
|
2199
2191
|
else:
|
|
@@ -2293,10 +2285,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2293
2285
|
try:
|
|
2294
2286
|
from agno.tracing.schemas import Trace
|
|
2295
2287
|
|
|
2296
|
-
log_debug(
|
|
2297
|
-
f"get_traces called with filters: run_id={run_id}, session_id={session_id}, user_id={user_id}, agent_id={agent_id}, page={page}, limit={limit}"
|
|
2298
|
-
)
|
|
2299
|
-
|
|
2300
2288
|
table = await self._get_table(table_type="traces")
|
|
2301
2289
|
|
|
2302
2290
|
# Get spans table for JOIN
|
|
@@ -2310,7 +2298,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2310
2298
|
if run_id:
|
|
2311
2299
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2312
2300
|
if session_id:
|
|
2313
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2314
2301
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2315
2302
|
if user_id:
|
|
2316
2303
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2378,12 +2365,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2378
2365
|
workflow_id, first_trace_at, last_trace_at.
|
|
2379
2366
|
"""
|
|
2380
2367
|
try:
|
|
2381
|
-
log_debug(
|
|
2382
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2383
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2384
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2385
|
-
)
|
|
2386
|
-
|
|
2387
2368
|
table = await self._get_table(table_type="traces")
|
|
2388
2369
|
|
|
2389
2370
|
async with self.async_session_factory() as sess:
|
|
@@ -2424,7 +2405,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2424
2405
|
# Get total count of sessions
|
|
2425
2406
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2426
2407
|
total_count = await sess.scalar(count_stmt) or 0
|
|
2427
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2428
2408
|
|
|
2429
2409
|
# Apply pagination and ordering
|
|
2430
2410
|
offset = (page - 1) * limit if page and limit else 0
|
|
@@ -2432,7 +2412,6 @@ class AsyncPostgresDb(AsyncBaseDb):
|
|
|
2432
2412
|
|
|
2433
2413
|
result = await sess.execute(paginated_stmt)
|
|
2434
2414
|
results = result.fetchall()
|
|
2435
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2436
2415
|
|
|
2437
2416
|
# Convert to list of dicts with datetime objects
|
|
2438
2417
|
stats_list = []
|
agno/db/postgres/postgres.py
CHANGED
|
@@ -2466,14 +2466,6 @@ class PostgresDb(BaseDb):
|
|
|
2466
2466
|
if trace.workflow_id is not None:
|
|
2467
2467
|
update_values["workflow_id"] = trace.workflow_id
|
|
2468
2468
|
|
|
2469
|
-
log_debug(
|
|
2470
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2471
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2472
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2473
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2474
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2475
|
-
)
|
|
2476
|
-
|
|
2477
2469
|
stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2478
2470
|
sess.execute(stmt)
|
|
2479
2471
|
else:
|
|
@@ -2574,10 +2566,6 @@ class PostgresDb(BaseDb):
|
|
|
2574
2566
|
try:
|
|
2575
2567
|
from agno.tracing.schemas import Trace
|
|
2576
2568
|
|
|
2577
|
-
log_debug(
|
|
2578
|
-
f"get_traces called with filters: run_id={run_id}, session_id={session_id}, user_id={user_id}, agent_id={agent_id}, page={page}, limit={limit}"
|
|
2579
|
-
)
|
|
2580
|
-
|
|
2581
2569
|
table = self._get_table(table_type="traces")
|
|
2582
2570
|
if table is None:
|
|
2583
2571
|
log_debug("Traces table not found")
|
|
@@ -2594,7 +2582,6 @@ class PostgresDb(BaseDb):
|
|
|
2594
2582
|
if run_id:
|
|
2595
2583
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2596
2584
|
if session_id:
|
|
2597
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2598
2585
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2599
2586
|
if user_id:
|
|
2600
2587
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2616,14 +2603,12 @@ class PostgresDb(BaseDb):
|
|
|
2616
2603
|
# Get total count
|
|
2617
2604
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2618
2605
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2619
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2620
2606
|
|
|
2621
2607
|
# Apply pagination
|
|
2622
2608
|
offset = (page - 1) * limit if page and limit else 0
|
|
2623
2609
|
paginated_stmt = base_stmt.order_by(table.c.start_time.desc()).limit(limit).offset(offset)
|
|
2624
2610
|
|
|
2625
2611
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2626
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2627
2612
|
|
|
2628
2613
|
traces = [Trace.from_dict(dict(row._mapping)) for row in results]
|
|
2629
2614
|
return traces, total_count
|
|
@@ -2661,12 +2646,6 @@ class PostgresDb(BaseDb):
|
|
|
2661
2646
|
first_trace_at, last_trace_at.
|
|
2662
2647
|
"""
|
|
2663
2648
|
try:
|
|
2664
|
-
log_debug(
|
|
2665
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2666
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2667
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2668
|
-
)
|
|
2669
|
-
|
|
2670
2649
|
table = self._get_table(table_type="traces")
|
|
2671
2650
|
if table is None:
|
|
2672
2651
|
log_debug("Traces table not found")
|
|
@@ -2710,14 +2689,12 @@ class PostgresDb(BaseDb):
|
|
|
2710
2689
|
# Get total count of sessions
|
|
2711
2690
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2712
2691
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2713
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2714
2692
|
|
|
2715
2693
|
# Apply pagination and ordering
|
|
2716
2694
|
offset = (page - 1) * limit if page and limit else 0
|
|
2717
2695
|
paginated_stmt = base_stmt.order_by(func.max(table.c.created_at).desc()).limit(limit).offset(offset)
|
|
2718
2696
|
|
|
2719
2697
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2720
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2721
2698
|
|
|
2722
2699
|
# Convert to list of dicts with datetime objects
|
|
2723
2700
|
stats_list = []
|
agno/db/redis/redis.py
CHANGED
|
@@ -1919,14 +1919,12 @@ class RedisDb(BaseDb):
|
|
|
1919
1919
|
filtered_traces.append(trace)
|
|
1920
1920
|
|
|
1921
1921
|
total_count = len(filtered_traces)
|
|
1922
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
1923
1922
|
|
|
1924
1923
|
# Sort by start_time descending
|
|
1925
1924
|
filtered_traces.sort(key=lambda x: x.get("start_time", ""), reverse=True)
|
|
1926
1925
|
|
|
1927
1926
|
# Apply pagination
|
|
1928
1927
|
paginated_traces = apply_pagination(records=filtered_traces, limit=limit, page=page)
|
|
1929
|
-
log_debug(f"Returning page {page} with {len(paginated_traces)} traces")
|
|
1930
1928
|
|
|
1931
1929
|
traces = []
|
|
1932
1930
|
for row in paginated_traces:
|
|
@@ -2025,11 +2023,9 @@ class RedisDb(BaseDb):
|
|
|
2025
2023
|
stats_list.sort(key=lambda x: x.get("last_trace_at", ""), reverse=True)
|
|
2026
2024
|
|
|
2027
2025
|
total_count = len(stats_list)
|
|
2028
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2029
2026
|
|
|
2030
2027
|
# Apply pagination
|
|
2031
2028
|
paginated_stats = apply_pagination(records=stats_list, limit=limit, page=page)
|
|
2032
|
-
log_debug(f"Returning page {page} with {len(paginated_stats)} session stats")
|
|
2033
2029
|
|
|
2034
2030
|
# Convert ISO strings to datetime objects
|
|
2035
2031
|
for stat in paginated_stats:
|
|
@@ -2461,14 +2461,6 @@ class SingleStoreDb(BaseDb):
|
|
|
2461
2461
|
if trace.workflow_id is not None:
|
|
2462
2462
|
update_values["workflow_id"] = trace.workflow_id
|
|
2463
2463
|
|
|
2464
|
-
log_debug(
|
|
2465
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2466
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2467
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2468
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2469
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2470
|
-
)
|
|
2471
|
-
|
|
2472
2464
|
update_stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2473
2465
|
sess.execute(update_stmt)
|
|
2474
2466
|
else:
|
|
@@ -2589,7 +2581,6 @@ class SingleStoreDb(BaseDb):
|
|
|
2589
2581
|
if run_id:
|
|
2590
2582
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2591
2583
|
if session_id:
|
|
2592
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2593
2584
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2594
2585
|
if user_id:
|
|
2595
2586
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2611,14 +2602,12 @@ class SingleStoreDb(BaseDb):
|
|
|
2611
2602
|
# Get total count
|
|
2612
2603
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2613
2604
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2614
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2615
2605
|
|
|
2616
2606
|
# Apply pagination
|
|
2617
2607
|
offset = (page - 1) * limit if page and limit else 0
|
|
2618
2608
|
paginated_stmt = base_stmt.order_by(table.c.start_time.desc()).limit(limit).offset(offset)
|
|
2619
2609
|
|
|
2620
2610
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2621
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2622
2611
|
|
|
2623
2612
|
traces = [Trace.from_dict(dict(row._mapping)) for row in results]
|
|
2624
2613
|
return traces, total_count
|
agno/db/sqlite/async_sqlite.py
CHANGED
|
@@ -363,7 +363,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
363
363
|
return Table(table_name, self.metadata, autoload_with=connection)
|
|
364
364
|
|
|
365
365
|
table = await conn.run_sync(load_table)
|
|
366
|
-
log_debug(f"Loaded existing table {table_name}")
|
|
367
366
|
return table
|
|
368
367
|
|
|
369
368
|
except Exception as e:
|
|
@@ -2513,14 +2512,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2513
2512
|
if trace.workflow_id is not None:
|
|
2514
2513
|
update_values["workflow_id"] = trace.workflow_id
|
|
2515
2514
|
|
|
2516
|
-
log_debug(
|
|
2517
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2518
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2519
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2520
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2521
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2522
|
-
)
|
|
2523
|
-
|
|
2524
2515
|
stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2525
2516
|
await sess.execute(stmt)
|
|
2526
2517
|
else:
|
|
@@ -2622,10 +2613,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2622
2613
|
try:
|
|
2623
2614
|
from agno.tracing.schemas import Trace
|
|
2624
2615
|
|
|
2625
|
-
log_debug(
|
|
2626
|
-
f"get_traces called with filters: run_id={run_id}, session_id={session_id}, user_id={user_id}, agent_id={agent_id}, page={page}, limit={limit}"
|
|
2627
|
-
)
|
|
2628
|
-
|
|
2629
2616
|
table = await self._get_table(table_type="traces")
|
|
2630
2617
|
if table is None:
|
|
2631
2618
|
log_debug("Traces table not found")
|
|
@@ -2642,7 +2629,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2642
2629
|
if run_id:
|
|
2643
2630
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2644
2631
|
if session_id:
|
|
2645
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2646
2632
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2647
2633
|
if user_id:
|
|
2648
2634
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2664,7 +2650,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2664
2650
|
# Get total count
|
|
2665
2651
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2666
2652
|
total_count = await sess.scalar(count_stmt) or 0
|
|
2667
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2668
2653
|
|
|
2669
2654
|
# Apply pagination
|
|
2670
2655
|
offset = (page - 1) * limit if page and limit else 0
|
|
@@ -2672,7 +2657,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2672
2657
|
|
|
2673
2658
|
result = await sess.execute(paginated_stmt)
|
|
2674
2659
|
results = result.fetchall()
|
|
2675
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2676
2660
|
|
|
2677
2661
|
traces = [Trace.from_dict(dict(row._mapping)) for row in results]
|
|
2678
2662
|
return traces, total_count
|
|
@@ -2710,12 +2694,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2710
2694
|
workflow_id, first_trace_at, last_trace_at.
|
|
2711
2695
|
"""
|
|
2712
2696
|
try:
|
|
2713
|
-
log_debug(
|
|
2714
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2715
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2716
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2717
|
-
)
|
|
2718
|
-
|
|
2719
2697
|
table = await self._get_table(table_type="traces")
|
|
2720
2698
|
if table is None:
|
|
2721
2699
|
log_debug("Traces table not found")
|
|
@@ -2759,7 +2737,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2759
2737
|
# Get total count of sessions
|
|
2760
2738
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2761
2739
|
total_count = await sess.scalar(count_stmt) or 0
|
|
2762
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2763
2740
|
|
|
2764
2741
|
# Apply pagination and ordering
|
|
2765
2742
|
offset = (page - 1) * limit if page and limit else 0
|
|
@@ -2767,7 +2744,6 @@ class AsyncSqliteDb(AsyncBaseDb):
|
|
|
2767
2744
|
|
|
2768
2745
|
result = await sess.execute(paginated_stmt)
|
|
2769
2746
|
results = result.fetchall()
|
|
2770
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2771
2747
|
|
|
2772
2748
|
# Convert to list of dicts with datetime objects
|
|
2773
2749
|
stats_list = []
|
agno/db/sqlite/sqlite.py
CHANGED
|
@@ -362,7 +362,6 @@ class SqliteDb(BaseDb):
|
|
|
362
362
|
|
|
363
363
|
try:
|
|
364
364
|
table = Table(table_name, self.metadata, autoload_with=self.db_engine)
|
|
365
|
-
log_debug(f"Loaded existing table {table_name}")
|
|
366
365
|
return table
|
|
367
366
|
|
|
368
367
|
except Exception as e:
|
|
@@ -2217,14 +2216,6 @@ class SqliteDb(BaseDb):
|
|
|
2217
2216
|
if trace.workflow_id is not None:
|
|
2218
2217
|
update_values["workflow_id"] = trace.workflow_id
|
|
2219
2218
|
|
|
2220
|
-
log_debug(
|
|
2221
|
-
f" Updating trace with context: run_id={update_values.get('run_id', 'unchanged')}, "
|
|
2222
|
-
f"session_id={update_values.get('session_id', 'unchanged')}, "
|
|
2223
|
-
f"user_id={update_values.get('user_id', 'unchanged')}, "
|
|
2224
|
-
f"agent_id={update_values.get('agent_id', 'unchanged')}, "
|
|
2225
|
-
f"team_id={update_values.get('team_id', 'unchanged')}, "
|
|
2226
|
-
)
|
|
2227
|
-
|
|
2228
2219
|
stmt = update(table).where(table.c.trace_id == trace.trace_id).values(**update_values)
|
|
2229
2220
|
sess.execute(stmt)
|
|
2230
2221
|
else:
|
|
@@ -2347,7 +2338,6 @@ class SqliteDb(BaseDb):
|
|
|
2347
2338
|
if run_id:
|
|
2348
2339
|
base_stmt = base_stmt.where(table.c.run_id == run_id)
|
|
2349
2340
|
if session_id:
|
|
2350
|
-
log_debug(f"Filtering by session_id={session_id}")
|
|
2351
2341
|
base_stmt = base_stmt.where(table.c.session_id == session_id)
|
|
2352
2342
|
if user_id:
|
|
2353
2343
|
base_stmt = base_stmt.where(table.c.user_id == user_id)
|
|
@@ -2369,14 +2359,12 @@ class SqliteDb(BaseDb):
|
|
|
2369
2359
|
# Get total count
|
|
2370
2360
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2371
2361
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2372
|
-
log_debug(f"Total matching traces: {total_count}")
|
|
2373
2362
|
|
|
2374
2363
|
# Apply pagination
|
|
2375
2364
|
offset = (page - 1) * limit if page and limit else 0
|
|
2376
2365
|
paginated_stmt = base_stmt.order_by(table.c.start_time.desc()).limit(limit).offset(offset)
|
|
2377
2366
|
|
|
2378
2367
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2379
|
-
log_debug(f"Returning page {page} with {len(results)} traces")
|
|
2380
2368
|
|
|
2381
2369
|
traces = [Trace.from_dict(dict(row._mapping)) for row in results]
|
|
2382
2370
|
return traces, total_count
|
|
@@ -2414,12 +2402,6 @@ class SqliteDb(BaseDb):
|
|
|
2414
2402
|
try:
|
|
2415
2403
|
from sqlalchemy import func
|
|
2416
2404
|
|
|
2417
|
-
log_debug(
|
|
2418
|
-
f"get_trace_stats called with filters: user_id={user_id}, agent_id={agent_id}, "
|
|
2419
|
-
f"workflow_id={workflow_id}, team_id={team_id}, "
|
|
2420
|
-
f"start_time={start_time}, end_time={end_time}, page={page}, limit={limit}"
|
|
2421
|
-
)
|
|
2422
|
-
|
|
2423
2405
|
table = self._get_table(table_type="traces")
|
|
2424
2406
|
if table is None:
|
|
2425
2407
|
log_debug("Traces table not found")
|
|
@@ -2463,14 +2445,12 @@ class SqliteDb(BaseDb):
|
|
|
2463
2445
|
# Get total count of sessions
|
|
2464
2446
|
count_stmt = select(func.count()).select_from(base_stmt.alias())
|
|
2465
2447
|
total_count = sess.execute(count_stmt).scalar() or 0
|
|
2466
|
-
log_debug(f"Total matching sessions: {total_count}")
|
|
2467
2448
|
|
|
2468
2449
|
# Apply pagination and ordering
|
|
2469
2450
|
offset = (page - 1) * limit if page and limit else 0
|
|
2470
2451
|
paginated_stmt = base_stmt.order_by(func.max(table.c.created_at).desc()).limit(limit).offset(offset)
|
|
2471
2452
|
|
|
2472
2453
|
results = sess.execute(paginated_stmt).fetchall()
|
|
2473
|
-
log_debug(f"Returning page {page} with {len(results)} session stats")
|
|
2474
2454
|
|
|
2475
2455
|
# Convert to list of dicts with datetime objects
|
|
2476
2456
|
from datetime import datetime
|