OpenSesame Agent Endpoint Documentation

The OpenSesame agent endpoint allows users to execute AI-driven workflows involving multiple components, such as LLMs (Large Language Models) and integrated tools (e.g., Gmail). This documentation covers how to use the endpoint via cURL and Python.

  1. Click on Generate Endpoint to generate the endpoint for your agent

  2. Copy the endpoint

Endpoint Overview

Base URL:

https://opensesame--%7Bname%7D-modal-endpoint.modal.run/

HTTP Method: POST

Headers:

  • accept: application/json

  • Content-Type: application/json

Request Body Parameters:

  1. agent_config: Defines the agents and tools used in the workflow.

    • Key Parameters:

      • id: Unique identifier for each agent/tool.

      • type: Specifies if the component is an LLM or a tool.

      • name: Name of the agent or tool.

      • provider_name: For LLMs, it specifies the AI provider (e.g., OpenAI).

      • model_name: Specifies the AI model to use (e.g., gpt-4o-mini).

      • tool_name and url: For tools, provides integration information and authentication URLs.

      • children: Defines the execution order by specifying downstream agents/tools.

  2. user_query: A natural-language instruction for what the workflow should accomplish.

  3. user_id: Identifier for the user making the request.

  4. conversation_id: Unique conversation or workflow identifier.

Example cURL Request

curl -X 'POST' \
  'https://opensesame--f2e13c9bagent-modal-endpoint.modal.run/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "agent_config": {
      "1": {
        "id": "1",
        "type": "LLM",
        "name": "Email Content Generation",
        "provider_name": "OpenAI",
        "model_name": "gpt-4o-mini",
        "system_prompt": "",
        "prompt_template": "{input}",
        "parameters": {},
        "api_key_name": "OPENAI_API_KEY",
        "api_key_value": "NONE",
        "children": ["2"]
      },
      "2": {
        "id": "2",
        "type": "Tool",
        "name": "gmail",
        "tool_name": "gmail",
        "tool_description": "Connect to Gmail to send and manage emails.",
        "tool_type": "composio",
        "logo": "https://raw.githubusercontent.com/SamparkAI/open-logos/d9b539471e551d6c14ffd442d172e476edd44b33/gmail.svg",
        "code": null,
        "composio_connection": false,
        "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=967786027051-8p515bt7ijf94c2bf4a5lev5jr6r7oc1.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fbackend.composio.dev%2Fapi%2Fv1%2Fauth-apps%2Fadd&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify&response_type=code&access_type=offline&prompt=consent&state=production_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb25uZWN0aW9uSWQiOiI1ODFkMWVlMC1kYjExLTQ1N2EtOGJjMC1kNmRkOTAzZTg3ZjIiLCJpbnRlZ3JhdGlvbklkIjoiYzA0MmQ1MTYtZjAwYS00ZTU3LThkZDgtZDk2YzdiZTUxY2UxIiwiYXBwTmFtZSI6ImdtYWlsIiwiY2xpZW50SW5mbyI6eyJjbGllbnRJZCI6IjI1MzYxZjU0LWQzMjctNDNjYy05NzIzLWRjNjkxZjQ2MDRlMCIsIm1lbWJlcklkIjoiZWRlY2Q2ZDktYTg5ZS00NTdlLThiOGMtZGUwZDZhMWNkYjgyIn0sImlhdCI6MTczMjEyODI3MX0.NmDEA8W55c81fcv2RgXKMnp-xDeJho41c9Cn7OPLiMs&code_challenge=Sk_zBi38HiiTO6mnos4VbuxE4qvBkL21qmPYIizkmds&code_challenge_method=S256",
        "request_id": "581d1ee0-db11-457a-8bc0-d6dd903e87f2",
        "auth_params": "NONE",
        "input_schema": "NONE",
        "children": []
      }
    },
    "user_query": "Send an email to rajath@opensesame.dev stating he's got to get it together with his spending habits",
    "user_id": "anthony@opensesame.dev",
    "conversation_id": "f2e13c9b-a8ea-4258-a13d-8d22d6c1f"
  }'

Using the Endpoint in Python

import requests

# Endpoint URL
url = "https://opensesame--f2e13c9bagent-modal-endpoint.modal.run/"

# Headers
headers = {
    "accept": "application/json",
    "Content-Type": "application/json"
}

# Request Payload
payload = {
    "agent_config": {
        "1": {
            "id": "1",
            "type": "LLM",
            "name": "Email Content Generation",
            "provider_name": "OpenAI",
            "model_name": "gpt-4o-mini",
            "system_prompt": "",
            "prompt_template": "{input}",
            "parameters": {},
            "api_key_name": "OPENAI_API_KEY",
            "api_key_value": "NONE",
            "children": ["2"]
        },
        "2": {
            "id": "2",
            "type": "Tool",
            "name": "gmail",
            "tool_name": "gmail",
            "tool_description": "Connect to Gmail to send and manage emails.",
            "tool_type": "composio",
            "logo": "https://raw.githubusercontent.com/SamparkAI/open-logos/d9b539471e551d6c14ffd442d172e476edd44b33/gmail.svg",
            "code": None,
            "composio_connection": False,
            "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=967786027051-8p515bt7ijf94c2bf4a5lev5jr6r7oc1.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fbackend.composio.dev%2Fapi%2Fv1%2Fauth-apps%2Fadd&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify&response_type=code&access_type=offline&prompt=consent&state=production_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb25uZWN0aW9uSWQiOiI1ODFkMWVlMC1kYjExLTQ1N2EtOGJjMC1kNmRkOTAzZTg3ZjIiLCJpbnRlZ3JhdGlvbklkIjoiYzA0MmQ1MTYtZjAwYS00ZTU3LThkZDgtZDk2YzdiZTUxY2UxIiwiYXBwTmFtZSI6ImdtYWlsIiwiY2xpZW50SW5mbyI6eyJjbGllbnRJZCI6IjI1MzYxZjU0LWQzMjctNDNjYy05NzIzLWRjNjkxZjQ2MDRlMCIsIm1lbWJlcklkIjoiZWRlY2Q2ZDktYTg5ZS00NTdlLThiOGMtZGUwZDZhMWNkYjgyIn0sImlhdCI6MTczMjEyODI3MX0.NmDEA8W55c81fcv2RgXKMnp-xDeJho41c9Cn7OPLiMs&code_challenge=Sk_zBi38HiiTO6mnos4VbuxE4qvBkL21qmPYIizkmds&code_challenge_method=S256",
            "request_id": "581d1ee0-db11-457a-8bc0-d6dd903e87f2",
            "auth_params": "NONE",
            "input_schema": "NONE",
            "children": []
        }
    },
    "user_query": "Send an email to rajath@opensesame.dev stating he's got to get it together with his spending habits",
    "user_id": "anthony@opensesame.dev",
    "conversation_id": "f2e13c9b-a8ea-4258-a13d-8d22d6c1f"
}

# Send Request
response = requests.post(url, headers=headers, json=payload)

# Check Response
if response.status_code == 200:
    print("Response JSON:", response.json())
else:
    print("Error:", response.status_code, response.text)

Response

A successful response will return a JSON object containing the results of the workflow execution, including any outputs from the AI agents and tools used. Check the response.json() for specifics.