{
  "info": {
    "name": "Agnostic Agents — Public agent API",
    "description": "Import this collection and set agentId and a private agentApiKey. Requests invoke a real published agent and consume allowance. Keys are agent-scoped. No secrets are included. Avoid sharing populated secrets. Run the examples in order; replay is only for identical retries.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{agentApiKey}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://app.agnosticagents.com"
    },
    {
      "key": "agentId",
      "value": ""
    },
    {
      "key": "agentApiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "conversationId",
      "value": ""
    },
    {
      "key": "lastBody",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "1. Start a conversation",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "pm.collectionVariables.set('conversationId', pm.variables.replaceIn('{{$guid}}'));",
              "const body = JSON.stringify({conversationId:pm.collectionVariables.get('conversationId'),requestId:pm.variables.replaceIn('{{$guid}}'),message:\"Hello. My name is Ada.\"});",
              "pm.collectionVariables.set('lastBody', body);",
              "pm.variables.set('body', body);"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/v1/agents/{{agentId}}/messages",
        "body": {
          "mode": "raw",
          "raw": "{{body}}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Uses your real published agent and consumes its account allowance."
      }
    },
    {
      "name": "2. Continue the conversation",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('conversationId')) throw new Error('Start a conversation first.');",
              "const body = JSON.stringify({conversationId:pm.collectionVariables.get('conversationId'),requestId:pm.variables.replaceIn('{{$guid}}'),message:\"What is my name?\"});",
              "pm.collectionVariables.set('lastBody', body);",
              "pm.variables.set('body', body);"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/v1/agents/{{agentId}}/messages",
        "body": {
          "mode": "raw",
          "raw": "{{body}}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Uses your real published agent and consumes its account allowance."
      }
    },
    {
      "name": "3. Replay the last request",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (!pm.collectionVariables.get('lastBody')) throw new Error('Send an example message first.');",
              "pm.variables.set('body', pm.collectionVariables.get('lastBody'));"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{baseUrl}}/api/v1/agents/{{agentId}}/messages",
        "body": {
          "mode": "raw",
          "raw": "{{body}}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "description": "Resends the last body exactly. Wait before retrying a running request."
      }
    }
  ]
}
