Fetch backtest logs
get_backtest_logsFetch runtime logs for an identified historical backtest simulation. This tool does not read live/paper bot or scheduled-deployment logs. Use get_deployment_logs for those runtime logs and list_deployment_artifacts/query_deployment_artifact for decisions, preserving the discovered deploymentId and runId. A deploymentId or deployment runId is not a backtestId. Use this, not get_backtest_artifact or query_csv, for backtest runtime errors, warnings, tracebacks, startup lines, order/fill log lines, broker messages, strategy print/log output, and questions like why a backtest failed or why it made no trades. backtestId must be the actual backtest run id from list_backtests or an explicit user-provided backtest id; never pass a strategy id, aiStrategyId, revisionId, browser URL revisionId, conversation id, or placeholder such as . Keep the same backtestId for every log/artifact/query call in one answer unless the user explicitly asks to compare multiple runs. Do not mix stats/trades/agent_detail/log evidence from different backtest ids. Supports time-range filtering (startTimeIso/endTimeIso), CloudWatch filter patterns (query), local multi-query diagnostics (queries), diagnosticPreset, noise suppression, pagination (nextToken), and grep-style context lines. Default limit is bounded; use limit near 1000 when diagnosing failures. For failed/no-trade/runtime-failure backtests, logs are mandatory evidence before editing code when logs are available. Prefer one batched queries call with at least three bounded searches: errors/exceptions/tracebacks, orders/trades/fills/positions, and strategy/runtime/main.py/on_trading_iteration lines. A single newest-first page or one warning line is not enough for root cause. For completed-backtest performance-improvement or tuning questions, this tool is also required evidence when logs are available; stats/trades/agent_detail queries do not replace runtime log checks. Use one batched queries call covering errors/exceptions, order/trade/fill/position activity, and strategy/runtime lines before final advice. diagnosticPreset values: broker_order_failure searches broker/order rejects, permission failures, and tracebacks; runtime_failure searches crashes, imports, dependency/build failures, kills, and exceptions; startup searches startup/stream/broker initialization; orders searches order/fill/cancel/reject activity. Pass contextLines (0-50) with query, queries, or a preset to preserve surrounding lines. When contextLines, queries, diagnosticPreset, or noise suppression is set, the tool fetches one bounded raw CloudWatch window and filters locally so surrounding context is preserved. The response includes runtimeProvenance. It uses the exact run's structured settings.json.lumibot_version as the primary source, then the canonical bootstrap package-metadata line INFO: lumibot version: ... from the fetched raw CloudWatch window as a fallback or corroborating source. It reports conflicts instead of choosing one value, and preserves provenance even when the requested filtered log view omits the startup line. Treat runtimeProvenance.runtimeVersion as the installed runtime version only when its status is confirmed; a LumiBot source/reference version is not runtime evidence. The response also includes logs, perQuery match counts, totalLines, scannedLines, returnedLines, scannedStart/scannedEnd timestamps when visible, noiseSuppressedLines, truncatedQueryCount, nextToken, and paginationWarning when more pages may need checking. Broad queries are capped; if truncatedQueryCount is nonzero, run a narrower follow-up query. Do not substitute runtime log CSV artifacts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | ||
| limit | No | ||
| query | No | ||
| queries | No | ||
| nextToken | No | ||
| backtestId | Yes | Actual backtest run UUID for a historical simulation, from list_backtests or an explicitly identified user-provided backtest. A bot/deployment id or a list_deployment_runs runId is not a backtestId: use get_deployment_logs with that deploymentId instead. Do not use a strategy id, aiStrategyId, revisionId, browser URL revisionId, conversation id, or a placeholder such as <unknown>. | |
| endTimeIso | No | ||
| contextLines | No | ||
| startTimeIso | No | ||
| suppressNoise | No | ||
| diagnosticPreset | No |