Generate or create a scenario

Creates a new scenario from a dataset, a script, or a generated/provided graph. The creation is processed in the background.

Generate or create a scenario

Creates a new scenario from a dataset, a script, or a generated/provided graph. The creation is processed in the background.

POST https://api.futureagi.com/simulate/scenarios/create/
Bearer
          Click "Try It" to send a request
        

Authentication

This endpoint requires authentication. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Request Body

  • name (required): string The name of the scenario.

  • description: string An optional description for the scenario.

  • agent_definition_id (required): string The UUID of the agent definition to associate with this scenario. Required when generate_graph is true.

  • kind: string (one of: dataset, script, graph) The kind of scenario to create.

  • dataset_id: string The UUID of the source dataset. Required if kind is ‘dataset’.

  • script_url: string URL to the script. Required if kind is ‘script’.

  • no_of_rows: integer Number of rows to generate for a ‘graph’ kind scenario.

  • add_persona_automatically: boolean If true, automatically adds personas to the scenario.

  • graph: object The graph structure for a ‘graph’ kind scenario. Required if ‘generate_graph’ is false.

  • generate_graph: boolean If true, generates a graph for the scenario. agent_definition_id is required.

  • personas: array of string List of persona IDs to use in the scenario.

Example

{
  "name": "your-name",
  "description": "your-description",
  "agent_definition_id": "your-agent_definition_id",
  "kind": "dataset",
  "dataset_id": "your-dataset_id",
  "script_url": "your-script_url",
  "no_of_rows": 1,
  "add_persona_automatically": true,
  "graph": {},
  "generate_graph": true,
  "personas": []
}

Responses

202

Scenario creation has been accepted and is processing in the background.

  • message: string Example: Graph scenario creation started
  • scenario: any
  • status: string Example: processing

400

Invalid data provided. Check for missing required fields based on the ‘kind’ of scenario.

  • error: string
  • details: object

401

Authentication credentials were not provided.

500

Internal server error occurred during scenario creation.

  • error: string Example: Failed to create scenario: [error details]

Code Examples

cURL

curl -X POST "https://api.futureagi.com/simulate/scenarios/create/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "your-name", "description": "your-description", "agent_definition_id": "your-agent_definition_id", "kind": "dataset", "dataset_id": "your-dataset_id", "script_url": "your-script_url", "no_of_rows": 1, "add_persona_automatically": true, "graph": {}, "generate_graph": true, "personas": []}'

Python

import requests

url = "https://api.futureagi.com/simulate/scenarios/create/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "name": "your-name",
    "description": "your-description",
    "agent_definition_id": "your-agent_definition_id",
    "kind": "dataset",
    "dataset_id": "your-dataset_id",
    "script_url": "your-script_url",
    "no_of_rows": 1,
    "add_persona_automatically": true,
    "graph": {},
    "generate_graph": true,
    "personas": []
}

response = requests.post(url, headers=headers, json=data)
print(response.json())

JavaScript

const response = await fetch("https://api.futureagi.com/simulate/scenarios/create/", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "name": "your-name",
    "description": "your-description",
    "agent_definition_id": "your-agent_definition_id",
    "kind": "dataset",
    "dataset_id": "your-dataset_id",
    "script_url": "your-script_url",
    "no_of_rows": 1,
    "add_persona_automatically": true,
    "graph": {},
    "generate_graph": true,
    "personas": []
})
});

const data = await response.json();
console.log(data);
Was this page helpful?

Questions & Discussion