Investigation playbooks
Five investigations an agent is asked for most, each as the user would ask and as the calls the agent makes. They
follow the Agent quickstart loop; every call is a complete tools/call parameter object,
checked against the tools TKTail serves - replace the values in angle brackets with what TKTail returned. The prompts
are examples of what users say; any wording works.
A request: where did it fail?
“Find every record of request R1 and tell me where it failed.”
“Did a request in payments.log fail in orders.jsonl within 10 seconds?”
-
Discover - the open sources and their formats: does a format have a
requestIdfield, or is the id only in the text?{ "name": "tktail_list_sources", "arguments": {} } -
Narrow - one search over every open source: the field where the format has it, the text where it does not.
{ "name": "tktail_search", "arguments": { "definition": { "sources": [{ "kind": "open" }], "predicate": { "any": [ { "field": { "name": "requestId", "op": "eq", "value": "<request id>" } }, { "text": "requestId=<request id>" } ] } }, "maxResults": 50, "withFields": true } } -
Inspect - the records around the error result (its
evidenceRef, or its source and line):{ "name": "tktail_get_records_around", "arguments": { "sourceId": "<payments sourceId>", "line": 2, "before": 5, "after": 5 } } -
Correlate - the relationship in time, as a sequence: a request received in one log, an error for the same request in another within 10 seconds.
{ "name": "tktail_search", "arguments": { "definition": { "sources": [{ "kind": "source", "path": "<payments sourceId>" }, { "kind": "source", "path": "<orders sourceId>" }], "predicate": { "all": [] }, "sequence": { "steps": [ { "sources": [0], "predicate": { "all": [{ "text": "Request received" }] } }, { "sources": [1], "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] }, "window": { "after": "previous", "earliestMs": 0, "latestMs": 10000 } } ], "correlation": [ { "name": "requestId", "compare": "exact", "steps": [ { "input": "message", "extract": "after", "text": "requestId=" }, { "input": "field", "field": "requestId" } ] } ], "policy": "earliest" } } } } -
Report - each sequence’s members in order with their times and sources; say if the search was incomplete.
An alert: what happened, and watching for it
“What happened in the last Payment errors incident?”
-
The alerts and the newest incident of one of them:
{ "name": "tktail_list_alerts", "arguments": {} }{ "name": "tktail_list_alert_occurrences", "arguments": { "alertNumber": 3, "limit": 1 } } -
The incident and the evidence it kept - the trigger record, the records before and after it, events, metric samples - each item with its own state:
{ "name": "tktail_get_alert_occurrence", "arguments": { "occurrenceId": "<occurrenceId>" } }{ "name": "tktail_get_occurrence_evidence", "arguments": { "occurrenceId": "<occurrenceId>", "item": 1, "limit": 20 } } -
Report what fired, when, and what the evidence shows; an item that is
partialorfailedsays why.
“Watch orders.jsonl for ERROR records and keep the records around each one.”
Saving needs the user’s permissions Allow AI to save searches and Metric Sets and Allow AI to manage alerts; without them, validate and give the alert to the user to create in Manage Alerts.
-
Check the alert with TKTail - this writes nothing and needs no permission:
{ "name": "tktail_validate_alert", "arguments": { "alert": { "name": "Order errors", "severity": "error", "condition": { "sources": [{ "kind": "source", "path": "<orders sourceId>" }], "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] } }, "trigger": { "kind": "everyMatch" }, "actions": ["notify"], "capture": { "items": [{ "kind": "file", "recordsBefore": 5, "recordsAfter": 5 }] } } } } -
With the user’s consent, save the same
alertwithtktail_save_alert, and the condition as a Saved Search:{ "name": "tktail_save_search", "arguments": { "name": "Order errors", "definition": { "sources": [{ "kind": "source", "path": "<orders sourceId>" }], "predicate": { "all": [{ "field": { "name": "level", "op": "eq", "value": "ERROR" } }] } } } } -
To change a saved one later, read it first (
tktail_get_alert,tktail_get_saved_search) and pass itsversionasexpectedVersion- a change to something the user edited since is refused, never overwritten.
An unknown format: why is this plain text?
“Why is this log shown as plain text? Write a format for it.”
-
How TKTail chose the format, and what the detector saw:
{ "name": "tktail_detect_format", "arguments": { "sourceId": "<sourceId>" } } -
A sample of the log’s records as TKTail frames them:
{ "name": "tktail_get_source_sample", "arguments": { "sourceId": "<sourceId>", "records": 20 } } -
A draft profile fitted to the log (
delimitedfor CSV-like logs,lineBasedormultilineotherwise), then the profile with the fields named and given their roles - checked, and previewed on the log’s own records until every record parses:{ "name": "tktail_new_format_draft", "arguments": { "sourceId": "<sourceId>", "template": "lineBased" } }{ "name": "tktail_validate_format", "arguments": { "definition": { "schemaVersion": 1, "id": "orders.worker", "name": "Orders worker", "framing": { "kind": "line" }, "envelope": { "pattern": "^(?<timestamp>\\S+ \\S+) (?<level>[A-Z]+) (?<body>.*)$" }, "fields": [ { "id": "timestamp", "group": "timestamp", "type": "timestamp", "role": "timestamp" }, { "id": "level", "group": "level", "role": "severity" }, { "id": "body", "group": "body", "role": "message" } ] } } }A
delimiteddraft has the log’s delimiter, quote and header and one field per column (columnslists them, 1-based): give the time column"role": "timestamp"and"type": "timestamp", the others"role": "severity","role": "message", and rename ids freely.tktail_preview_formattakes the samedefinitionwith thesourceIdand shows each record as the profile parses it. -
With the user’s consent and Allow AI to save custom formats:
tktail_save_formatwith thedefinitionandapplyToSourceId; to have the file use it after a restart, put its file name indefinition.fileMatch.namesbefore saving (["export-*.csv"]). Without the permission, give the profile to the user to import in the Custom Format Studio (Your own log formats).
Performance: what did the machine do?
“What did CPU, memory and disk do in the minute around this error?”
Metrics are included with Trial and Pro, and TKTail reports only what it collects: a Metric Set or a Metrics View must be open (View > Metrics…) - the agent never starts collection.
-
The metrics TKTail collects or still keeps:
{ "name": "tktail_list_metrics", "arguments": {} } -
Minimum, average and maximum around the error’s time, the peak with its time, and every gap:
{ "name": "tktail_get_metric_summary", "arguments": { "around": { "time": "2026-10-08T10:00:01", "seconds": 60 } } } -
The samples of one metric over the same interval, if the summary shows a peak worth a closer look:
{ "name": "tktail_get_metric_history", "arguments": { "metricId": "<metricId>", "around": { "time": "2026-10-08T10:00:01", "seconds": 60 } } } -
Report the values with the metric’s unit and say where samples were missing - a reading TKTail could not take is missing, never zero.
Evidence: keep it before the log rotates
“Save these results with 20 records of context before the log rotates.”
“Pin this search and preserve its evidence - include orders.jsonl for the same seconds.”
A busy log may keep only minutes of history. Preserve what explains the problem as soon as it is found - never copy a
whole log with a shell command. Saving and pinning need Allow AI to save evidence and pin searches (off until the user turns it on - a refusal
not_allowed says so: ask the user); TKTail redacts
secrets before anything is written, and everything read back is the redacted package.
-
The search whose results are the evidence (or a
searchIdthe investigation already has):{ "name": "tktail_search", "arguments": { "definition": { "sources": [{ "kind": "open" }], "predicate": { "all": [{ "text": "Payment failed" }] } }, "maxResults": 20 } } -
Pin it while the investigation goes on - kept across restarts and outside the limit of five AI searches (a pin keeps references; only a package keeps the bytes):
{ "name": "tktail_pin_search", "arguments": { "searchId": 19 } } -
Preserve: the hits’ records with 20 records on each side (a stack trace is one record), and the other log for the same seconds. The answer names the package, its SHA-256, the time range and how many secrets were redacted; a source that rotated before it could be read is reported, never guessed:
{ "name": "tktail_save_evidence", "arguments": { "searchId": 19, "contextRecordsBefore": 20, "contextRecordsAfter": 20, "contextTimeBeforeMs": 15000, "contextTimeAfterMs": 15000, "correlatedSourceIds": ["<orders sourceId>"], "note": "payment timeouts before the outage" } } -
Check what was kept - the manifest summary, then a page of the parsed records of the first source (
fieldsreturns only the fields named):{ "name": "tktail_get_evidence", "arguments": { "packageId": "<packageId>", "maxHits": 10 } }{ "name": "tktail_get_evidence", "arguments": { "packageId": "<packageId>", "artifact": "sources/source-001/records.jsonl", "maxBytes": 4096 } } -
Verify before it is shared - VALID, MODIFIED, INCOMPLETE or UNSUPPORTED, also after the original log is gone:
{ "name": "tktail_verify_evidence", "arguments": { "packageId": "<packageId>" } } -
Report the package id, its SHA-256, the time range and the redactions; the user makes a shareable copy or links it to an incident in the Evidence Library (Saving evidence). Deleting a package is a request (
tktail_delete_evidence) the user confirms - ask first.