Skip to main content
Generated from CLI help, the runtime event catalog and SDK source JSDoc by scripts/generate-play-sdk-reference.ts. Do not edit manually.

Query retained logs

--step, --level, --query, --count, --sum, or --group-by select structured logs for one run. Bounds and --where filter those log records. --step matches the recorded authored step. --level warn includes warn and error. --query searches the full retained message literally, including percent signs and underscores. runs events applies these operations to lifecycle events, receipt events, and events across the organization. Structured reads default to the last hour and 50 records or groups per page, with a maximum of 200. Records appear newest first, and summary groups use ascending keys. --count returns an exact retained count and rejects --limit, --cursor, and --payloads. --group-by pages all matching groups, and --sum totals numeric fields or returns an ungrouped count and sum without --group-by. Numeric sums reject strings and booleans, and groups distinguish missing values from null. The reader cannot reconstruct sampling or expired history. --fields returns fields, types, and operators. where accepts scalar equality, { eq, ne, gt, gte, lt, lte, in, exists }, nested context: { key: ... }, flat "context.key", and { and: [...] } / { or: [...] }. String predicates accept equality, inequality, ranges, in, exists, &&, ||, parentheses, and $.field. Strings need JSON double quotes, while numbers, booleans, and null remain unquoted. Missing fields do not match comparisons, so use exists false for missing values. Filters allow 64 comparisons and 8 KiB, and custom context fields must be recorded scalars rather than nested payload data.
client.runs.logs(runId, options) remains the text reader. Use logs.query/count/summarize/fields for structured logs. Use client.runs.events.list/count/summarize/fields for events. Omit runId to read across the organization. Each method makes one request per page or aggregate.
Lists return flat logs or events, page: { returnedCount, hasMore, nextCursor }, frozen query criteria, and retention: { retainedSince, retentionDays }. Relative bounds resolve once with inclusive since and exclusive until. Frozen criteria fix the window rather than a snapshot, so newly available events may change later pages or aggregates. Start a fresh list to find late arrivals ahead of its cursor. Follow next.page or reuse query with cursor: page.nextCursor when hasMore. Criteria exclude page options and the positional log run ID, retain an event run ID, and preserve SDK Preview selection. Recorded step, level, source, attempt, and context stay together. Absent historical fields stay absent. Counts return matchedCount and exact: true. Summaries return groups, groupBy, measures, and an independent page, with keys and named numeric measures in each group. Missing keys use { "missing": true }, distinct from null or "<missing>". HTTP uses POST /api/v2/runs/events with a flat body containing operation: "list" | "count" | "summarize" | "fields", resource: "logs" | "events", runId, criteria, and options. Log list, count, and summary requests require runId, but field requests do not. Summaries require groupBy, with [] for an ungrouped aggregate. Summaries accept measures: [{ op: "count" }, { op: "sum", field: "context.durationMs", as: "durationMs" }]. The SDK, HTTP API, and CLI use the same filter checks. The existing GET and text-log contracts remain available below.

Read logs or search events

—failed reads terminal context only when the overall run failed. A completed run can still contain failed rows: use runs events <run-id> --kind receipt.failed --payloads --json and inspect the run dataset. runs get <run-id> --json reports row outcome counts. A run ID alone reads text logs. Use the returned nextCursor with —cursor for older lines. Without a run ID, or with a search flag, the command searches events. A supplied run ID narrows event search. Event search rejects —out, —failed, and —log-level. Search defaults to the last hour with newest events first and a maximum lookback of seven days. Follow the returned next.logs command for the next page. —payloads adds available event details or saved work results, not dataset rows. Text logs default to 200 lines, while compatibility event search defaults to 100 events (maximum 200), or 10 with payloads and 16 MiB. Check retention warnings. —out saves all available log lines.

Known event kinds

Compatibility event search with —where

String fields are eventId, orgId, runId, playName, runtimeScope, kind, status, source, level, stepId, stepKind, datasetId, phase, provider, and operation. producerAttempt is a positive integer, context.<key> accepts flat string, number, or boolean log fields, and —kind selects run and step outcomes. Filters contain at most eight $.field == value predicates and 512 bytes, joined with && within single shell quotes. Missing fields do not match, and strings need double quotes while numbers and booleans remain unquoted. OR, ranges, wildcards, and text or payload search are unavailable, and examples need values from your actual events. status is not inferred from kind, and provider/operation match recorded activity.observed events, not every provider call. Bare runs logs --where, --since, and --kind retain this equality grammar. Text --failed, --out, and --log-level retain their established behavior. Context examples use deepline.log("Lookup finished", { context: { companyId: "acme_123", attempt: 2, cached: false } }).

Retrieve results

--payloads adds eventPayload details or saved payload results. The response identifies unavailable details. Select an exact returned eventId with its original --since/--until window. Events remain available for seven days, but details may have different retention. Redirecting JSON saves one page, so follow next.logs for compatibility search or next.page for structured reads. Use --out run.log for all text, or runs export --format json --out results.json for dataset rows.
New tool results retain sanitized input under payload.output.meta.callEvidence.input and output under payload.output.toolResponse.rawV2. callEvidence.providerRequests contains observed HTTP requests, response status, and failed response bodies. The result retains successful output once in toolResponse.rawV2. Deepline removes credentials and provider billing fields. Multipart, binary, streaming, oversized, or unobserved evidence includes a reason for unavailable details. Older results may have no input evidence. Find new saved failed-call records with --kind receipt.completed --where '$.context.callStatus == "failed" && $.context.callKey == "lookup"' --payloads. Details have payload.output.kind: "tool_call_evidence", status: "failed", callEvidence and the original error. receipt.completed means Deepline saved the diagnostic. Use step.failed for the failure that caused it.

SDK and HTTP field contract

client.runs.searchEvents(options) calls GET /api/v2/runs/events and returns RunsEventSearchResult. Options map to query parameters, except includePayloads maps to payloads=true. Preview runtime uses runtime credentials. Raw HTTP defaults since to one hour before until.