Agent Forge

Logging and Cost Calculation

Understanding workflow logs and how execution costs are calculated in Agent Forge

Agent Forge provides comprehensive logging for workflow executions and automatic cost calculation for AI model usage.

Logging System

Agent Forge offers two complementary logging interfaces:

Real-Time Console (Manual Executions)

During manual workflow execution, logs appear in real-time in the Console panel on the right side of the workflow editor:

The console shows:

  • Block execution progress with active block highlighting
  • Real-time outputs as blocks complete
  • Execution timing for each block
  • Success/error status indicators

Logs Page (All Executions)

All workflow executions—whether triggered manually, via API, Chat, Schedule, or Webhook—are logged to the dedicated Logs page:

Screenshot

The Logs page provides:

  • Comprehensive filtering by time range, status, trigger type, folder, and workflow
  • Search functionality across all logs
  • Live mode for real-time updates
  • 7-day log retention (upgradeable for longer retention)

Log Details Sidebar

Clicking on any log entry opens a detailed sidebar view:

Screenshot

Block Input/Output

View the complete data flow for each block with tabs to switch between:

Output Tab shows the block's execution result:

  • Structured data with JSON formatting
  • Markdown rendering for AI-generated content
  • Copy button for easy data extraction

Input Tab displays what was passed to the block:

  • Resolved variable values
  • Referenced outputs from other blocks
  • Environment variables used
  • API keys are automatically redacted for security

Execution Timeline

For workflow-level logs, view detailed execution metrics:

  • Start and end timestamps
  • Total workflow duration
  • Individual block execution times
  • Performance bottleneck identification

Model Breakdown

For workflows using AI blocks, expand the Model Breakdown section to see:

Screenshot

  • Token Usage: Input and output token counts for each model
  • Cost Breakdown: Individual costs per model and operation
  • Model Distribution: Which models were used and how many times
  • Total Cost: Aggregate cost for the entire workflow execution

Workflow Snapshot

For any logged execution, click "View Snapshot" to see the exact workflow state at execution time:

Screenshot

The snapshot provides:

  • Frozen canvas showing the workflow structure
  • Block states and connections as they were during execution
  • Click any block to see its inputs and outputs
  • Useful for debugging workflows that have since been modified

Workflow snapshots are only available for executions after the enhanced logging system was introduced. Older migrated logs show a "Logged State Not Found" message.

Programmatic Log Access

List and fetch execution logs over HTTP using a personal API key from Settings → API Keys. Pass the key in the X-API-Key header. Session cookies from the web UI continue to work for the Logs page.

List logs — GET /api/logs

Returns paginated logs from every workspace you can access. Optionally narrow the scope:

Query paramDescription
workspaceIdFilter to one workspace (omit for account-wide within your permissions)
workflowIdsComma-separated workflow UUIDs
executionIdExact execution UUID — useful after a webhook trigger
triggersComma-separated types, e.g. webhook,api,manual
detailsbasic (default) or full (includes traceSpans and cost breakdown)
limit / offsetPagination (API key calls are capped at 100 per request)
startDate / endDateISO date filters
searchPartial executionId match
# All accessible logs
curl "https://your-host/api/logs?details=full&limit=10" \
  -H "X-API-Key: sk-forge-..."

# Logs for one workspace
curl "https://your-host/api/logs?workspaceId=WS_ID&triggers=webhook" \
  -H "X-API-Key: sk-forge-..."

# Poll a specific execution (e.g. after webhook)
curl "https://your-host/api/logs?executionId=EXEC_UUID&details=full" \
  -H "X-API-Key: sk-forge-..."

Response shape: { data: [...], total, page, pageSize, totalPages }.

Fetch log details — GET /api/logs/by-id/{id}

Returns full execution output for a single log row, including data.executionData.finalOutput and data.executionData.traceSpans. Use the log id from the list response (not the executionId).

curl "https://your-host/api/logs/by-id/LOG_UUID" \
  -H "X-API-Key: sk-forge-..."

Webhook polling flow

  1. Trigger the webhook (returns immediately with { "message": "Webhook processed" }).
  2. Poll GET /api/logs?executionId=...&details=full or filter by workflowIds until the run appears.
  3. Call GET /api/logs/by-id/{id} for the complete finalOutput.
Logging and Cost Calculation