Skip to main content

The problem

Friday sends your agent an “enriched prompt” - a markdown string containing:
  • The user’s task
  • Temporal facts (current time, relevant history)
  • Signal data (HTTP request body, cron metadata)
  • Accumulated context from previous steps
Deterministic code agents cannot parse this like LLMs do. The SDK provides extraction utilities.

Simple JSON Extraction

Use parse_input() to extract a JSON object from the prompt:
The prompt might contain:

Extraction Strategy

parse_input() searches in this order:
  1. Raw JSON objects - Scans for balanced-brace JSON objects
  2. Code-fenced blocks - Extracts from ```json ... ```
  3. Full prompt - Attempts to parse the entire prompt as JSON
Unknown keys are filtered when using a dataclass schema, preventing enrichment context from crashing construction.

Discriminated Operations

When your agent handles multiple operations, use parse_operation():

Plain Dict Extraction

Without a dataclass, get a plain dict:

Validation Errors

When using dataclasses, missing required fields produce clear errors:

Real Example: Jira Agent

When to Use Which

Parse utilities reference

Full API reference for parse_input() and parse_operation().