Skip to main content

Overview

Actions extend your Guru’s capabilities by executing custom Python code or making external API calls. When users ask questions that require real-time data or custom processing, your Guru can automatically trigger these actions to fetch information and provide up-to-date responses.
Actions
Actions support two types:
  • Python Code: Execute custom Python scripts in isolated containers for data processing, API integrations, and custom logic.
  • API Call: Make HTTP requests to external APIs and services.
Actions transform your Guru into a dynamic assistant that can
  • fetch real-time data
  • process data with custom scripts
  • retrieve current information
  • integrate with third-party tools
Each Guru has a limit on the number of actions (e.g., “5 of 10 actions used”).

How Actions Work

Actions use an intelligent trigger system:
  1. When to Trigger This Action: The Guru checks if the user’s question matches your defined conditions
  2. Parameter Extraction: Parameters are extracted from the user’s question based on your descriptions
  3. Execution Decision: The action runs only if all required parameters can be extracted (or have default values)
  4. Execution: Python code runs in an isolated container, or an API call is made to the configured endpoint
  5. Response Handling: The Usage Instructions guide the AI on how to interpret and present the results

Creating an Action

Empty Actions
The action creation process consists of three main steps:
  1. Basic Information and Parameters
  2. Action Type Configuration (Python Code or API Call)
  3. Usage Instructions and Testing

Basic Information and Parameters

Action Basic Configuration
  • Action Name: Provide a descriptive name that appears in your actions list
  • When to Trigger This Action: Be specific about keywords, patterns, or user intents to ensure it only runs when appropriate (e.g., “When the user wants to guess the secret number”)
Action Parameters Configuration
Define what information to extract from user questions. Parameters can be used like below:
  • API Call: Use them in your API endpoint, headers, body using {parameter_name} syntax
  • Python Code: Use them as environment variables via os.environ.get()
Each parameter includes:
  • Name: Use only letters and underscores (e.g., username, user_id). Cannot conflict with secret names.
  • Type: Choose from String (text), Number (numeric), or Boolean (true/false)
  • What to Extract: Clear description for parameter extraction from user questions
  • Required: Check if essential for the action to work
  • Default Value: Optional fallback when parameter can’t be extracted

Usage Instructions and Testing

Usage Instructions Configuration
  • Usage Instructions: Provide instructions for how the AI should interpret and use the response data (API response or Python stdout)
    • Example: “Use stdout to decide if the guess was correct”
    • Example: “Extract the user’s name and bio from the JSON response and present this information in a clear summary”
  • Testing: Use the “Test Action” button to verify your configuration
    • If required parameters exist, you’ll be prompted to provide test values
    • Test results show success status, response data, and execution details

Action Types

When creating an action, choose between:
  • Python Code: Execute custom Python scripts in isolated containers
  • API Call: Make HTTP requests to external APIs and services

Python Code Actions

Python Code Configuration
Execute custom Python code in isolated Docker containers. Secrets and parameters are injected as environment variables accessible via os.environ.get(). Key Features:
  • Isolated execution: Each execution runs in a fresh container that is destroyed after use
  • Pre-installed libraries: Popular data science and HTTP libraries ready to use
  • Results via stdout: Your code’s print() output is captured and returned to the Guru
  • Secrets protection: All secrets are masked in output (supports plain text, base64, hex, and URL-encoded detection)

Sandbox Environment

Python code runs inside an isolated sandbox container with the following specifications: Base Image: python:3.13-slim with git and curl installed

Pre-installed Python Packages:

anthropic==0.76.0
beautifulsoup4==4.14.3
httpx==0.28.1
instructor==1.14.3
lxml==6.0.2
matplotlib==3.10.8
numpy==2.2.3
openai==2.15.0
opencv-python==4.12.0.88
pandas==2.3.3
pillow==12.1.0
pydantic==2.12.5
requests==2.32.5
scikit-learn==1.8.0
scipy==1.17.0
seaborn==0.13.2
urllib3==2.6.3
You cannot install additional packages at runtime. The container filesystem is read-only. If you need a package that isn’t listed, contact us.

Execution Limits

ResourceLimit
Memory512MB
CPU1 core
Max Processes128
Timeout30 seconds
Temp Storage (/tmp)100MB

Security Restrictions:

  • Read-only filesystem (only /tmp is writable)
  • /tmp mounted with noexec flag (cannot execute binaries)
  • All Linux capabilities dropped
  • Network access allowed (for API calls)
Accessing Parameters and Secrets Parameters and secrets are injected as environment variables. Access them using os.environ.get():
import os

# Access a parameter extracted from user's question
username = os.environ.get('USERNAME')

# Access a secret configured in Guru Settings
api_key = os.environ.get('MY_API_KEY')

print(f"Fetching data for {username}...")
The os module is restricted. Only os.environ, os.environ.get(), and os.getenv() are allowed. Other os functions (like os.system(), os.popen(), file operations) are blocked.

Examples

Example 1: Simple calculation with parameters
Add the following Parameters: GUESS, SECRET_NUMBER
import os

guess = int(os.environ.get('GUESS'))
secret_n = int(os.environ.get('SECRET_NUMBER'))

if guess == secret_n:
    print("Correct! You guessed the secret number!")
elif guess < secret_n:
    print("Too low! Try a higher number.")
else:
    print("Too high! Try a lower number.")
Example 2: Fetch data from an external API
Add the following Secrets: WEATHER_API_KEY (get your free API key from weatherapi.com)Optionally add Parameters: CITY (defaults to “London” if not provided)
import os
import requests

api_key = os.environ.get('WEATHER_API_KEY')
city = os.environ.get('CITY', 'London')

response = requests.get(
    "https://api.weatherapi.com/v1/current.json",
    params={"key": api_key, "q": city}
)

data = response.json()
print(f"Weather in {city}: {data['current']['condition']['text']}")
print(f"Temperature: {data['current']['temp_c']}°C")
Example 3: Data processing with pandas
import pandas as pd
import requests

# Fetch users data from JSONPlaceholder API
response = requests.get("https://jsonplaceholder.typicode.com/users")
df = pd.DataFrame(response.json())

# Process and summarize
print(f"Total users: {len(df)}")
print(f"Columns: {', '.join(df.columns)}")
print("\nUser list:")
print(df[['id', 'name', 'email', 'phone']].to_string(index=False))
Example 4: Using AI libraries
Add the following Secrets: OPENAI_API_KEY (get your API key from OpenAI)
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
user_text = "Hello, how are you?"

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": f"{user_text}"}]
)

print(response.choices[0].message.content)

API Call Actions

API Call Configuration
API Call Request Body
  • HTTP Method: Select from GET, POST, PUT, PATCH, DELETE
  • Endpoint URL: Enter the API endpoint. Use {parameter_name} or {SECRET_NAME} to insert parameter/secret values
    • Example: https://api.github.com/users/{username}
  • Headers: Configure authentication or content type using {parameter_name} or {SECRET_NAME} syntax
    • Example: Authorization: Bearer {API_KEY}
  • Request Body: For POST, PUT, and PATCH methods, include JSON payload supporting {parameter_name} or {SECRET_NAME} syntax:
{
  "test": "{TEST}",
  "new_address": "{new_address}"
}

Managing Actions

Actions Management Dashboard
  • View all configured actions with their name, type (“Python Code” or “API Call”), and status (Enabled/Disabled)
  • Use the top action bar:
    • History: View execution history of all actions
    • Import: Import an action from a JSON configuration file (exported from another action)
    • Create an Action: Create a new action from scratch
  • Click the menu icon (⋮) next to any action to:
    • Edit: Modify the action’s configuration
    • Export: Download the action configuration as a JSON file
    • Trigger Action: Manually run the action immediately
    • Disable: Temporarily disable without deleting
    • Delete: Permanently remove the action
  • Enable or disable actions at any time
  • Disabled actions won’t be triggered by user questions
  • Note: If a secret used by an action is deleted, that action will be automatically disabled

Usage in the Answer

Actions used in the answer are shown with the action name:
Action Reference

Secrets Management

Secrets are encrypted credentials (API keys, tokens, passwords) configured in Guru Settings → Secrets. They can be used in both Python Code and API Call actions.
Secrets
Key Points:
  • Secrets are encrypted at rest (AES-256) and masked in all output
  • Access secrets in Python via os.environ.get('SECRET_NAME')
  • Use secrets in API calls with {SECRET_NAME} syntax
  • Secret names cannot conflict with parameter names
  • Deleting a secret automatically disables all actions using it
Example Usage:
  • Python: api_key = os.environ.get('STRIPE_API_KEY')
  • API Call: Authorization: Bearer {STRIPE_API_KEY}

Common Mistakes to Avoid

Mistake❌ Avoid✅ Do Instead
Vague Condition Prompts”When asking about data""When asking about current weather conditions for a specific location”
Inadequate Parameter DescriptionsParameter: id, Description: “The ID”Parameter: user_id, Description: “The unique identifier for the GitHub user whose profile information is being requested”
Incomplete Usage Instructions”Use the response data""Extract the user’s name, bio, and public repository count from the JSON response and present this information in a clear, formatted summary”
Not Testing ActionsEnabling actions without testing them firstAlways test actions with various parameter combinations before enabling
Overly Complex ActionsCreating actions that try to do too many things at onceKeep actions focused on a single, specific task

Next Steps