Skip to main content

crewship logs

Print recent log lines for an agent, or follow them live over WebSocket. The agent must be assigned to a crew — logs are sourced from the crew container, so a crew-less agent fails with agent has no crew (logs require a crew).
Tab-completes <agent-slug> against the workspace’s agents. Both the slug and the agent ID are accepted. crewship agent logs is an alias for this command — same implementation, with --tail in place of --lines and no --follow. Requires an authenticated session (requireAuth) and a selected workspace (requireWorkspace).

Flags

Examples

Last 100 lines

Each line is <timestamp> [<event>] <content>. Events are colour-coded: output (white), error (red), everything else (gray).

Smaller window

Live tail

Follow mode prints the historical batch first, then opens a WebSocket against the agent:<id> channel using a short-lived token from GET /api/v1/ws-token. Lines streamed after the prompt are formatted identically to the initial batch.

Combined with jq via JSON

The default output is line-formatted; --format json emits the journal rows as they arrive from the API — as one JSON array, so a filter has to iterate it with .[] (jq 'select(…)' on its own fails with Cannot index array with string "event"):
For filtering server-side across agents and runs, use the journal instead. Journal rows are a different shape — they carry entry_type and severity, never event — and the filtering is a flag rather than a jq stage. --agent takes an agent ID, not a slug:

Terminal hardening

Both the event tag and content are passed through a terminal sanitiser before printing, so a rogue log entry can’t smuggle ANSI escapes or OSC links into the operator’s scrollback. The content is also truncated at 200 characters per line — log payloads larger than that show as <first 200 chars>….

Common errors

  • agent not found: <slug> — no agent matches the slug or ID in the active workspace. Run crewship agent list to see what’s available.
  • agent has no crew (logs require a crew) — the agent record exists but isn’t attached to a crew. Logs come from the crew container, and an agent’s crew is set when it is hired — recreate the agent inside a crew with crewship hire <role> --crew <slug>.
  • get WS token for follow: … — --follow needs the WebSocket endpoint; this surfaces when /api/v1/ws-token is unreachable. Usually a server restart or revoked CLI token.

See also

  • crewship journal — structured event view of the same data, with filtering and jq support.
  • crewship inspect — one-shot, run-scoped timeline; for an entire run, not a tailing process.
  • crewship agent — agent list / agent get for slugs and IDs.
  • crewship chat — interactive REPL against an agent.