← Playbooks

Role playbook

#Dev Agent: planowane wydatki infrastrukturalne i rezerwacja budżetu (THARAN)

Cel: zaplanować koszt infrastruktury (planned, nie actual), zarezerwować budżet na eksperyment w granicach limitu i sprawdzić zdrowie projektu. Planned / reserved / actual to trzy osobne byty.

Passport: szablon dev: planned_expenses:execute@business ≤ 500 PLN/akcja, budget_reserve:execute@business ≤ 500 PLN/akcja, decisions:execute@business, finances:observe@business.

#System prompt (skopiuj)

You are the Dev Agent for THARAN in Operlance. Check get_available_capital before planning spend. Record expected infrastructure costs with create_planned_expense (they enter the forecast and committed costs and are never overwritten by actuals). Block capital for experiments with reserve_budget; amounts above your per-action limit become approvals. Record the rationale with create_decision before a significant step. Read get_project_health for statuses with reasons; there is no score. Do not record actual expenses: invoices come from integrations or the owner.

#Sekwencja

  1. Wolny kapitał na 30 dni.
{
 "data": {
  "free_capital_minor": 3498329,
  "currency": "USD",
  "components": {
   "cash_known_minor": 3800000,
   "committed_costs_minor": 0,
   "reserved_budgets_minor": 277280,
   "upcoming_subscriptions_minor": 24391
  },
  "horizon_days": 30,
  "as_of": "2026-09-18",
  "cash_as_of": "2026-09-18T…Z",
  "cash_scope": "business",
  "fx_used": [
   {
    "base": "EUR",
    "quote": "USD",
    "rate": "1.08000000",
    "as_of": "2026-09-18",
    "source": "mock"
   },
   {
    "base": "PLN",
    "quote": "USD",
    "rate": "0.25116279",
    "as_of": "2026-09-18",
    "source": "mock"
   }
  ]
 },
 "coverage": {
  "coverage_pct": 0.74,
  "domains": {
   "revenue": {
    "status": "accurate",
    "sources": [
     "STRIPE_API"
    ],
    "last_sync_at": "2026-09-18T…Z"
…
  1. Planowany koszt w limicie (execute → 201).
{
 "status": "executed",
 "data": {
  "id": "<id-20>",
  "owner_id": "<id-21>",
  "type": "planned_expense",
  "state": "planned",
  "status": "confirmed",
  "amount_minor": 30000,
  "currency": "PLN",
  "direction": "out",
  "business_id": "<business:tharan>",
  "personal": false,
  "project_id": null,
  "occurred_on": "2026-10-05",
  "category": "infrastructure",
  "description": "Hetzner CX32 staging",
  "subscription_id": null,
  "reservation_id": null,
  "integration_id": null,
  "external_id": null,
  "supersedes_event_id": null,
  "provenance": {
   "reason": "Staging server for the checkout rewrite",
   "source": {
    "type": "AI_AGENT",
    "agent_id": "<id-22>",
    "approval_id": null,
    "external_id": null,
    "integration_id": null
   },
   "confidence": 0.9,
   "data_class": "planned",
   "recorded_at": "2026-09-18T…Z"
  },
  "payload": {},
  "created_at": "2026-09-18T…Z",
  "agent_id": null,
  "base_amount_minor": 7535,
  "base_currency": "USD",
…
  1. Rezerwacja powyżej limitu per action (500 PLN) → 202.
{
 "status": "pending_approval",
 "approval_id": "<id-24>",
 "coverage": {
  "coverage_pct": 0.74,
  "domains": {
   "revenue": {
    "status": "accurate",
    "sources": [
     "STRIPE_API"
    ],
    "last_sync_at": "2026-09-18T…Z"
   },
   "ad_spend": {
    "status": "accurate",
    "sources": [
     "GOOGLE_ADS_API",
     "META_API"
    ],
    "last_sync_at": "2026-09-18T…Z"
   },
   "subscriptions": {
    "status": "incomplete",
    "sources": [
     "HUMAN",
     "SYSTEM"
    ],
    "last_sync_at": null
   },
   "operating_costs": {
    "status": "mostly_covered",
    "sources": [
     "AI_AGENT",
     "ANTHROPIC_API",
     "HUMAN",
     "OPENAI_API",
     "STRIPE_API"
    ],
    "last_sync_at": "2026-09-18T…Z"
   },
…
  1. Owner odrzuca rezerwację.
{
 "status": 200,
 "data": {
  "id": "<id-24>",
  "owner_id": "<id-21>",
  "agent_id": "<id-22>",
  "action": "reserve_budget",
  "params": {
   "reason": "Load test budget for October",
   "purpose": "Load testing",
   "category": "infrastructure",
   "currency": "PLN",
   "period_end": "2026-10-31",
   "business_id": "<business:tharan>",
   "amount_minor": 120000,
   "period_start": "2026-10-01"
  },
  "reason": "Load test budget for October",
  "amount_minor": 120000,
  "currency": "PLN",
  "business_id": "<business:tharan>",
  "personal": false,
  "status": "rejected",
  "decided_by": "<id-21>",
  "decided_at": "2026-09-18T…Z",
  "decision_note": "playbook",
  "expires_at": "2026-09-25T…Z",
  "result_ref": null,
  "idempotency_key": "pb-dev-2",
  "created_at": "2026-09-18T…Z",
  "kind": "write"
 },
 "request_id": "req_<id-26>"
}
  1. Zdrowie projektu (statusy z powodami, parametry z data_class).
{
 "data": {
  "business_id": "<business:tharan>",
  "project_id": null,
  "statuses": [
   {
    "status": "budget_exceeded",
    "reasons": [
     {
      "code": "actual_over_budget",
      "message": "infrastructure: actual exceeds planned amount",
      "amount_minor": 193,
      "ref": {
       "type": "financial_event",
       "id": "<id-27>"
      }
     }
    ]
   },
   {
    "status": "budget_exceeded",
    "reasons": [
     {
      "code": "limit_breached.max_cac",
      "message": "max_cac breached (3000)",
      "ref": {
       "type": "business",
       "id": "<business:tharan>"
      }
     }
    ]
   },
   {
    "status": "incomplete_data",
    "reasons": [
     {
      "code": "coverage_below_80",
      "message": "Data coverage is 74%"
     }
    ]
…

#Gdzie jest 202

Krok 3: 1 200 PLN przekracza max_amount_minor_per_action = 500 PLN grantu budget_reserve. Owner widzi cel, okres, kwotę i powód. Krok 2 przeszedł od razu (300 PLN w limicie): wynik executed z provenance.source.type = AI_AGENT.

#Czego agent NIE może

create_expense (brak grantu expenses), zmiany Ads, czytania innych biznesów i personal.