{
  "version": "0.2",
  "identity_profiles": [
    {
      "id": "api-credentials",
      "provider": "env-bearer",
      "subject": {
        "kind": "service",
        "principal": "agent://api/http-client",
        "display_name": "HTTP API Agent",
        "delegation_mode": "none"
      },
      "auth": {
        "mode": "service",
        "required": false,
        "provider_config": {
          "token_env": "API_TOKEN"
        }
      },
      "trust": {
        "level": "supervised",
        "constraints": {
          "max_autonomy": "supervised",
          "escalation": "fail"
        }
      },
      "presentation": {
        "bindings": [
          {
            "source": "credentials.access_token.value",
            "target": { "kind": "env", "name": "API_TOKEN" },
            "required": false,
            "redact": true
          }
        ],
        "handoff": "none",
        "cleanup": "always"
      }
    }
  ],
  "evidence_profiles": [
    {
      "id": "api-evidence",
      "provider": "ssh",
      "payload": {
        "bind": ["execution_id", "declared_identity", "command", "result"],
        "format": "canonical-json"
      },
      "verify": { "required": false }
    }
  ],
  "workflows": [
    {
      "id": "curl-api",
      "name": "REST API Operations",
      "contract": {
        "sandbox": "permissive",
        "network": "unrestricted",
        "audit": "always"
      },
      "tasks": [
        {
          "id": "health-check",
          "name": "API Health Check",
          "shell": {
            "program": "curl",
            "args": ["-sf", "https://httpbin.org/status/200"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "api-credentials" },
          "output": { "format": "text" },
          "schedule": { "cron": "*/5 * * * *" }
        },
        {
          "id": "fetch-data",
          "name": "Fetch API Data",
          "shell": {
            "program": "curl",
            "args": ["-sf", "-H", "Authorization: Bearer $API_TOKEN", "https://api.example.com/data"]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "api-credentials" },
          "output": {
            "format": "json",
            "preview_bytes": 4000,
            "offload": "auto"
          },
          "schedule": { "cron": "0 */2 * * *" }
        },
        {
          "id": "post-webhook",
          "name": "Post Deploy Webhook",
          "shell": {
            "program": "curl",
            "args": [
              "-sf",
              "-X", "POST",
              "-H", "Content-Type: application/json",
              "-d", "{\"event\":\"deploy\",\"status\":\"complete\"}",
              "https://hooks.example.com/webhook"
            ]
          },
          "target": { "session_target": "shell" },
          "identity": { "ref": "api-credentials" },
          "evidence": { "ref": "api-evidence" },
          "output": { "format": "text" },
          "schedule": { "cron": "0 12 * * *" }
        }
      ]
    }
  ]
}
