Yroun Guide

Agent Recipes

Hub pages are machine-writable documents. An AI agent holding your hub API key can read the same pages your team reads, edit the widgets on them, and keep a dashboard alive while you only supervise. These recipes cover the read → modify → write loop, appending content, and the supervision pattern that keeps humans in the loop. Everything here also works from an MCP tool or any HTTP-capable agent runtime.

Machine-readable references for your agent's context: https://www.yroun.com/llms.txt (compact API + widget guide) and https://www.yroun.com/openapi.json (full OpenAPI spec).

export YROUN_KEY="yroun_key_xxxxxxxxxxxx"
export YROUN_BASE="https://oapi.yroun.com/hubs/<hubUid>"

1. Read a page and find its widgets

The list endpoint returns page metadata only. Content comes from the single-page GET. Page content is a Tiptap document serialized as a JSON string, so parse it twice: once as the response, once as the content field.

# Find the page by title
PAGE_UID=$(curl -s "$YROUN_BASE/pages" -H "X-API-Key: $YROUN_KEY" \
  | jq -r '.[] | select(.title == "Ops Dashboard") | .uid')

# GET the single page. Only this includes content
curl -s "$YROUN_BASE/pages/$PAGE_UID" -H "X-API-Key: $YROUN_KEY" \
  | jq -r .content | jq '.content[] | select(.type == "apiTableBlock") | .attrs'

Widget nodes (apiTableBlock, chartBlock, apiRequestBlock, apiQueueBlock, faqBlock, statGridBlock) carry their full configuration in attrs: endpoint, mapping, columns. Reading attrs tells the agent exactly what the dashboard currently shows.

2. Update a widget's config (read → modify → write)

There is no per-node PATCH. The page content is the unit of write. The safe loop: GET the page, modify the parsed document, PUT the whole content back.

# GET → swap one widget attr with jq → PUT back
DOC=$(curl -s "$YROUN_BASE/pages/$PAGE_UID" -H "X-API-Key: $YROUN_KEY" | jq -r .content)

NEW_DOC=$(echo "$DOC" | jq '
  (.content[] | select(.type == "apiTableBlock") | .attrs.apiUrl)
  |= "https://api.example.com/v2/users"')

curl -X PUT "$YROUN_BASE/pages/$PAGE_UID" \
  -H "X-API-Key: $YROUN_KEY" -H "Content-Type: application/json" \
  -d "$(jq -n --arg c "$NEW_DOC" '{content: $c}')"
  • Send only the fields you are changing. Omitting a field preserves it; sending an empty string overwrites. An agent that round-trips list-endpoint data (which has no content) and PUTs it back will silently wipe the page.
  • Compare before writing: parse both documents as JSON and deep-compare. Skip the PUT when nothing changed. A redundant PUT costs a credit and bumps updatedAt.
  • Never change a page's visibility toward more-public as a side effect. Exposing PRIVATE content is an interactive-session decision, not an agent call.
  • 3. Append a status block

    An agent posting a morning summary appends nodes to the document instead of replacing it:

    NEW_DOC=$(echo "$DOC" | jq --arg date "$(date -u +%Y-%m-%d)" '
      .content += [
        { "type": "heading", "attrs": { "level": 3 },
          "content": [{ "type": "text", "text": ("Agent summary - " + $date) }] },
        { "type": "paragraph",
          "content": [{ "type": "text", "text": "All 4 endpoints healthy. 2 new signups overnight." }] }
      ]')

    The same pattern inserts a whole widget node. See Content & Widgets for each widget's attrs shape.

    4. Supervision: snapshot before, announce after

    Two habits make an autonomous page-editing agent safe to leave running:

  • Snapshot before bulk edits. POST /oapi/hubs/{hubUid}/snapshots captures every page; POST /oapi/hubs/{hubUid}/snapshots/{snapshotUid}/restore rolls the hub back atomically if a run goes wrong.
  • Announce every write to the team room via a webhook (see the Webhooks page). Humans supervise from chat, not from diffing pages.
  • # Before a bulk edit run
    curl -X POST "$YROUN_BASE/snapshots" -H "X-API-Key: $YROUN_KEY" \
      -H "Content-Type: application/json" -d '{"label": "pre-agent-run"}'
    
    # After each write
    curl -X POST "https://api.yroun.com/api/v1/webhooks/$HOOK_UID" \
      -H "X-Webhook-Secret: $HOOK_SECRET" -H "Content-Type: application/json" \
      -d '{"text": "🤖 updated Ops Dashboard: repointed users table to /v2/users"}'

    Guardrails checklist for agent runbooks

  • Budget credits: read the X-Credits-* response headers and stop before exhaustion (429 mid-run leaves a half-edited page).
  • One deterministic externalId per real-world thing when creating schedules/posts, so crash-and-retry never duplicates.
  • Respect 429/5xx backoff rules from Errors, Limits & Conventions.
  • Scope the API key to the one hub the agent operates, never a sudo or multi-hub key.
  • Stuck, or something here is wrong? Send us a message