======================== CODE SNIPPETS ======================== TITLE: Installing Julep Open Responses CLI (Bash) DESCRIPTION: These commands demonstrate installing the Julep Open Responses CLI using `npx` for direct execution or `npm`/`uvx`/`pip` for global installation, providing flexible setup options. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_6 LANGUAGE: bash CODE: ``` # Using npx directly npx open-responses # Or install globally npm install -g open-responses ``` LANGUAGE: bash CODE: ``` # Install using uv uvx open-responses # Install using pip globally pip install open-responses open-responses ``` ---------------------------------------- TITLE: Installing OpenAI SDK DESCRIPTION: This snippet demonstrates how to install the OpenAI SDK using pip for Python or npm for Node.js, which is a prerequisite for interacting with the OpenAI API. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_9 LANGUAGE: bash CODE: ``` pip install openai ``` LANGUAGE: bash CODE: ``` npm install openai ``` ---------------------------------------- TITLE: Initializing Julep Project from Template DESCRIPTION: This command initializes a new Julep project using a specified template, such as 'profiling-recommending'. It sets up the basic project structure and configuration files, providing a quick starting point for development. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_5 LANGUAGE: bash CODE: ``` julep init --template profiling-recommending ``` ---------------------------------------- TITLE: Installing Julep SDK DESCRIPTION: These commands install the Julep SDK for Python and Node.js using their respective package managers (pip, npm, or Bun). This is a necessary prerequisite for interacting with the Julep API in your chosen language. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx#_snippet_2 LANGUAGE: Bash CODE: ``` pip install julep ``` LANGUAGE: Bash CODE: ``` npm install @julep/sdk # or bun add @julep/sdk ``` ---------------------------------------- TITLE: Configuring Julep Client with Multiple Options in Python DESCRIPTION: This code snippet provides a comprehensive example of initializing the Julep client with various configuration options, including API key, environment, base URL, and timeout. This allows for fine-grained control over the client's behavior and connectivity. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_4 LANGUAGE: python CODE: ``` client = Julep( api_key="your_julep_api_key", environment="production", # or "development" base_url="https://api.julep.ai", # Optional: custom API endpoint timeout=30 # Optional: custom timeout in seconds ) ``` ---------------------------------------- TITLE: Initializing Julep Client with API Key in Python DESCRIPTION: This code shows how to quickly initialize the Julep client by directly providing your API key. This method is suitable for immediate setup and testing purposes. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_1 LANGUAGE: python CODE: ``` from julep import Julep # Initialize the client client = Julep(api_key="your_julep_api_key") ``` ---------------------------------------- TITLE: Initializing Julep Client from Environment Variables in Python DESCRIPTION: This example demonstrates initializing the Julep client without explicit parameters, allowing it to automatically retrieve configuration from environment variables. This is a best practice for managing credentials and environment-specific settings. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_3 LANGUAGE: python CODE: ``` from julep import Julep client = Julep() # Will use environment variables ``` ---------------------------------------- TITLE: Example .env File for Julep SDK Configuration DESCRIPTION: This plaintext snippet provides an example of a `.env` file, demonstrating how to define the `JULEP_API_KEY` and `JULEP_ENVIRONMENT` variables. This file is typically used with libraries like `dotenv` to load configuration values into the application's environment. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_3 LANGUAGE: plaintext CODE: ``` JULEP_API_KEY=your_api_key_here JULEP_ENVIRONMENT=production ``` ---------------------------------------- TITLE: Setting Up CLI Environment Variables (Bash) DESCRIPTION: These commands execute the `open-responses setup` command via `npx` or `uvx`, configuring necessary environment variables as a prerequisite for API operation. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_7 LANGUAGE: bash CODE: ``` npx open-responses setup ``` LANGUAGE: bash CODE: ``` uvx open-responses setup ``` ---------------------------------------- TITLE: Installing Julep CLI with Pip DESCRIPTION: This command installs the Julep command-line interface tool using Python's pip package manager. It is the primary method for setting up the CLI on your system, enabling interaction with the Julep platform. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_0 LANGUAGE: bash CODE: ``` pip install julep-cli ``` ---------------------------------------- TITLE: Downloading Environment Variables (Bash) DESCRIPTION: This command downloads the example environment variables file from Julep's server and saves it as `.env`. Users must edit this file with their specific configuration. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_2 LANGUAGE: bash CODE: ``` wget https://u.julep.ai/responses-env.example -O .env ``` ---------------------------------------- TITLE: Navigating to Project Directory (Bash) DESCRIPTION: This command changes the current working directory to `julep-responses-api`, preparing for subsequent installation steps within the project. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_1 LANGUAGE: bash CODE: ``` cd julep-responses-api ``` ---------------------------------------- TITLE: Installing Julep Python SDK with pip DESCRIPTION: This snippet demonstrates the standard method for installing the Julep Python SDK using the pip package manager. It is the essential first step to begin developing with the SDK. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_0 LANGUAGE: bash CODE: ``` pip install julep ``` ---------------------------------------- TITLE: Creating an AI Agent DESCRIPTION: These code examples demonstrate how to create a new AI agent using the Julep client. They specify the agent's name, the AI model to use (claude-3.5-sonnet), and a brief description of its role. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx#_snippet_4 LANGUAGE: Python CODE: ``` agent = client.agents.create( name="Writing Assistant", model="claude-3.5-sonnet", about="A helpful AI assistant that specializes in writing and editing." ) ``` LANGUAGE: JavaScript CODE: ``` const agent = await client.agents.create({ name: "Writing Assistant", model: "claude-3.5-sonnet", about: "A helpful AI assistant that specializes in writing and editing." }); ``` ---------------------------------------- TITLE: Installing Julep Node.js SDK with npm, yarn, or bun DESCRIPTION: This snippet demonstrates how to install the Julep Node.js SDK using popular package managers: npm, yarn, and bun. It provides the command-line instructions for each method, allowing developers to choose their preferred tool for adding the SDK to their project. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_0 LANGUAGE: bash CODE: ``` # Using npm npm install @julep/sdk # Using yarn yarn add @julep/sdk # Using bun bun add @julep/sdk ``` ---------------------------------------- TITLE: Starting Julep Open Responses API via CLI (Bash) DESCRIPTION: These commands initiate the Julep Open Responses API using `npx` or `uvx`, launching the service in watch mode for continuous operation and responsiveness. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_8 LANGUAGE: bash CODE: ``` npx open-responses start ``` LANGUAGE: bash CODE: ``` uvx open-responses start ``` ---------------------------------------- TITLE: Verifying Julep SDK Installation and Connection (JavaScript) DESCRIPTION: This JavaScript snippet provides a simple test function to verify the Julep SDK installation and API connection. It attempts to create a 'Test Agent' and logs success or failure, demonstrating basic error handling and confirming the SDK's operational status. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_5 LANGUAGE: javascript CODE: ``` async function testConnection() { try { const agent = await client.agents.create({ name: 'Test Agent', model: 'claude-3.5-sonnet', about: 'Testing the SDK setup' }); console.log('Successfully connected to Julep!', agent); } catch (error) { console.error('Connection test failed:', error); } } testConnection(); ``` ---------------------------------------- TITLE: Julep CLI Configuration File Example DESCRIPTION: This YAML snippet illustrates the structure of the `config.yml` file, located at `~/.config/julep/config.yml`. It stores essential configuration data like the API key for authentication and the target environment, which is automatically generated after initial authentication. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_1 LANGUAGE: yaml CODE: ``` api_key: "your_api_key_here" environment: "production" ``` ---------------------------------------- TITLE: Creating and Starting a Julep Task Execution - Python DESCRIPTION: This snippet initiates a new execution of the defined Julep task. It specifies the `task.id` and provides an input dictionary containing a list of locations. The execution represents a single run of the task with these specific inputs, and its ID is printed to the console for tracking the process. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb#_snippet_6 LANGUAGE: python CODE: ``` execution = client.executions.create( task_id=task.id, input={ "locations": ["New York", "London", "Paris", "Tokyo", "Sydney"] } ) print("Started an execution. Execution ID:", execution.id) ``` ---------------------------------------- TITLE: Executing a Task and Polling for Result DESCRIPTION: These code examples execute the previously defined task with a specific input topic. They then enter a loop to poll the Julep API for the execution status, printing the output upon success or an error message if it fails. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx#_snippet_6 LANGUAGE: Python CODE: ``` execution = client.executions.create( task_id=task.id, input={"topic": "a magical garden"} ) # Wait for the execution to complete while (result := client.executions.get(execution.id)).status not in ['succeeded', 'failed']: print(result.status) time.sleep(1) if result.status == "succeeded": print(result.output) else: print(f"Error: {result.error}") ``` LANGUAGE: JavaScript CODE: ``` const execution = await client.executions.create( task.id, { input: { topic: "a magical garden" } } ); // Wait for the execution to complete let result; while (true) { result = await client.executions.get(execution.id); if (result.status === 'succeeded' || result.status === 'failed') break; console.log(result.status); await new Promise(resolve => setTimeout(resolve, 1000)); } if (result.status === 'succeeded') { console.log(result.output); } else { console.error(`Error: ${result.error}`); } ``` ---------------------------------------- TITLE: Install Julep Python Client DESCRIPTION: Installs or upgrades the Julep Python client library using pip. This is the essential first step to set up the development environment and ensure access to the Julep SDK. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/07-personalized-research-assistant.ipynb#_snippet_0 LANGUAGE: python CODE: ``` !pip install julep -U --quiet ``` ---------------------------------------- TITLE: Verifying Running Docker Containers (Bash) DESCRIPTION: This command lists all currently running Docker containers, allowing verification that the Julep Open Responses API services have started successfully. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_5 LANGUAGE: bash CODE: ``` docker ps ``` ---------------------------------------- TITLE: Setting Up Database and Applying Migrations for Julep AI DESCRIPTION: This snippet provides the sequence of commands to initialize the database environment for the Julep AI project. It covers starting the necessary Docker services, applying database schema migrations using `golang-migrate`, and installing a PostgreSQL command-line interface tool (`pgcli`) for database interaction. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/memory-store/README.md#_snippet_0 LANGUAGE: Shell CODE: ``` docker compose up db vectorizer-worker cd memory-store migrate -database "postgres://postgres:postgres@0.0.0.0:5432/postgres?sslmode=disable" -path ./migrations up pip install --user -U pgcli pgcli "postgres://postgres:postgres@localhost:5432/postgres" ``` ---------------------------------------- TITLE: Initializing Julep Client with API Key DESCRIPTION: This code initializes the Julep client by importing the `Client` class and retrieving the Julep API key from environment variables. The client is then instantiated with the API key and configured for the 'production' environment, enabling secure interaction with the Julep platform. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/02-sarcastic-news-headline-generator.ipynb#_snippet_2 LANGUAGE: python CODE: ``` from julep import Client import os JULEP_API_KEY = os.environ['JULEP_API_KEY'] # Create a client client = Client(api_key=JULEP_API_KEY, environment="production") ``` ---------------------------------------- TITLE: Installing Julep Python Client DESCRIPTION: This command installs or upgrades the Julep Python client library using pip. The `--quiet` flag suppresses verbose output during installation, and `--upgrade` ensures the latest version of the package is installed, updating any existing installations. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/02-sarcastic-news-headline-generator.ipynb#_snippet_0 LANGUAGE: python CODE: ``` !pip install --upgrade julep --quiet ``` ---------------------------------------- TITLE: Installing Julep Client Library - Python DESCRIPTION: This snippet installs or upgrades the Julep Python client library using pip. The `-U` flag ensures an upgrade if the package is already installed, and `--quiet` suppresses verbose output during the installation process. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb#_snippet_0 LANGUAGE: python CODE: ``` !pip install julep -U --quiet ``` ---------------------------------------- TITLE: Standard Julep Project Directory Structure DESCRIPTION: This plaintext snippet outlines the typical directory structure for a Julep project. It shows the organization of configuration files (`julep.yaml`, `julep-lock.json`), documentation (`README.md`), and source directories for agents, tasks, and tools, providing a clear overview of project organization. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_2 LANGUAGE: plaintext CODE: ``` project-name/ ├── README.md # Documentation and usage instructions ├── julep.yaml # Project configuration and entrypoint ├── julep-lock.json # Lock file tracking server state └── src/ # Source directory ├── agents/ # Agent definitions │ └── agent.yaml ├── tasks/ # Task definitions │ └── task.yaml └── tools/ # Tool definitions └── tool.yaml ``` ---------------------------------------- TITLE: Installing Julep Client with Pip DESCRIPTION: This snippet demonstrates how to install the Julep Python client library using pip, the Python package installer. This is the essential first step to begin interacting with the Julep platform and its functionalities. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/00-Devfest-Email-Assistant.ipynb#_snippet_0 LANGUAGE: python CODE: ``` !pip install julep ``` ---------------------------------------- TITLE: Initializing Julep Client with API Key DESCRIPTION: This code initializes the Julep client by importing the `Client` class and providing an API key for authentication. The `environment` parameter is explicitly set to 'production' to connect to the live Julep environment, enabling secure and functional interaction with Julep services. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/00-Devfest-Email-Assistant.ipynb#_snippet_2 LANGUAGE: python CODE: ``` from julep import Client JULEP_API_KEY = "YOUR_JULEP_API_KEY" # Create a Julep client client = Client(api_key=JULEP_API_KEY, environment="production") ``` ---------------------------------------- TITLE: Initializing OpenAI Client DESCRIPTION: This snippet shows how to initialize the OpenAI client, configuring it to connect to a local server at `http://localhost:8080/` and using a placeholder API key. This client is essential for making API calls. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_10 LANGUAGE: python CODE: ``` from openai import OpenAI openai_client = OpenAI(base_url="http://localhost:8080/", api_key="RESPONSE_API_KEY") ``` LANGUAGE: javascript CODE: ``` import { OpenAI } from 'openai'; const openai_client = new OpenAI({ baseURL: 'http://localhost:8080/', apiKey: 'RESPONSE_API_KEY' }); ``` ---------------------------------------- TITLE: Authenticating Julep CLI with API Key DESCRIPTION: This command initiates the authentication process for the Julep CLI. Users are prompted to provide their API key, which is essential for securely interacting with the Julep platform and accessing its services. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_4 LANGUAGE: bash CODE: ``` julep auth ``` ---------------------------------------- TITLE: Running Docker Containers in Watch Mode (Bash) DESCRIPTION: This command starts the Docker containers defined in `docker-compose.yml` in watch mode, enabling automatic restarts or updates upon file changes. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_4 LANGUAGE: bash CODE: ``` docker compose up --watch ``` ---------------------------------------- TITLE: Configuring Julep Node.js SDK Client DESCRIPTION: This JavaScript snippet shows how to initialize the Julep SDK client. It demonstrates both CommonJS `require` and ES module `import` syntax, and explains how to set the `apiKey`, `environment`, and optional parameters like `timeout`, `retries`, and `baseUrl` for custom API endpoints. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_1 LANGUAGE: javascript CODE: ``` const { Julep } = require('@julep/sdk'); // Or using ES modules import { Julep } from '@julep/sdk'; const client = new Julep({ apiKey: 'your_api_key', environment: 'production', // or 'development' // Optional configuration timeout: 30000, // Request timeout in milliseconds retries: 3, // Number of retries for failed requests baseUrl: 'https://api.julep.ai' // Custom API endpoint if needed }); ``` ---------------------------------------- TITLE: Initializing a New Project (Bash) DESCRIPTION: This command creates a new project structure with a guided setup process. It automatically sets up necessary directories (data, config, logs), generates helpful documentation files, runs interactive configuration, and sets up Docker Compose following best practices. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_15 LANGUAGE: bash CODE: ``` open-responses init ``` ---------------------------------------- TITLE: Creating a Julep Task Execution DESCRIPTION: Initiates a new execution for a defined Julep task, providing the necessary input parameters (e.g., a URL for crawling). This action starts the multi-step workflow defined within the task. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/01-website-crawler.ipynb#_snippet_6 LANGUAGE: Python CODE: ``` # creating an execution object execution = client.executions.create( task_id=TASK_UUID, input={ "url": "https://docs.julep.ai" } ) ``` ---------------------------------------- TITLE: Performing First-time Setup for Open Responses CLI DESCRIPTION: Initiates the initial setup process for the Open Responses CLI, configuring host, port, Docker settings, and creating necessary files like .env and open-responses.json. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_7 LANGUAGE: Bash CODE: ``` open-responses setup ``` ---------------------------------------- TITLE: Initializing Julep Client with API Key in Python DESCRIPTION: This snippet demonstrates how to initialize the Julep client. It imports the Client class from the julep library and retrieves the API key from an environment variable. The client is then instantiated with the API key and set to the 'production' environment. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_2 LANGUAGE: python CODE: ``` from julep import Client import os api_key = os.getenv("JULEP_API_KEY") # Create a Julep client client = Client(api_key=api_key, environment="production") ``` ---------------------------------------- TITLE: Creating an Agent with Julep SDK (TypeScript) DESCRIPTION: This TypeScript snippet demonstrates how to import Julep SDK types and initialize the client, then proceed to create an AI agent. It showcases the asynchronous `createAgent` function, detailing the required parameters like `name`, `model`, and `about` for agent creation. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_4 LANGUAGE: typescript CODE: ``` import { Julep, Agent, Task, Execution } from '@julep/sdk'; const client = new Julep({ apiKey: process.env.JULEP_API_KEY }); async function createAgent(): Promise { return await client.agents.create({ name: 'My Agent', model: 'claude-3.5-sonnet', about: 'A helpful AI assistant' }); } ``` ---------------------------------------- TITLE: Installing Julep Client with pip DESCRIPTION: This snippet installs the Julep Python client library using pip. The -U flag ensures the package is upgraded to the latest version, and --quiet suppresses verbose output during installation. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_0 LANGUAGE: python CODE: ``` !pip install julep -U --quiet ``` ---------------------------------------- TITLE: Initializing Julep Client DESCRIPTION: These snippets initialize the Julep client by importing the `Julep` class and instantiating it with your Julep API key. This client object is essential for all subsequent interactions with the Julep API. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx#_snippet_3 LANGUAGE: Python CODE: ``` from julep import Julep client = Julep(api_key="your_julep_api_key") ``` LANGUAGE: JavaScript CODE: ``` import { Julep } from '@julep/sdk'; const client = new Julep({ apiKey: 'your_julep_api_key' }); ``` ---------------------------------------- TITLE: Docker Compose Commands for Julep Monitoring Stack DESCRIPTION: Provides commands to navigate to the monitoring directory and start different configurations of the monitoring stack using Docker Compose, including a full multi-tenant setup or a Portainer-only deployment. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/monitoring/CLAUDE.md#_snippet_0 LANGUAGE: bash CODE: ``` cd monitoring docker-compose --profile multi-tenant up # Full monitoring stack docker-compose --profile monitor up # Portainer only ``` ---------------------------------------- TITLE: Creating and Running a Simple Agent (Python) DESCRIPTION: This example illustrates how to define a basic Julep Agent with a name, instructions, and a specified model. It then shows how to execute the agent using the 'Runner.run' method to process a user query and print the final output, providing examples for both Jupyter notebooks and standard Python scripts. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx#_snippet_6 LANGUAGE: python CODE: ``` from agents import Agent, Runner # For Jupyter notebooks: agent = Agent( name="Test Agent", instructions="You are a helpful assistant that provides concise responses.", model="openrouter/deepseek/deepseek-r1", ) result = await Runner.run(agent, "Hello! Are you working correctly?") print(result.final_output) # For Python scripts, you'd use: # async def test_installation(): # agent = Agent( # name="Test Agent", # instructions="You are a helpful assistant that provides concise responses." # model="openrouter/deepseek/deepseek-r1", # ) # result = await Runner.run(agent, "Hello! Are you working correctly?") # print(result.final_output) # # if __name__ == "__main__": # asyncio.run(test_installation()) ``` ---------------------------------------- TITLE: Julep Project Configuration in julep.yaml DESCRIPTION: This YAML configuration defines the components of a Julep project, specifying the paths to agent, task, and tool definitions. It links tasks and tools to specific agents using `agent_id` references, establishing the project's operational blueprint and dependencies. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_3 LANGUAGE: yaml CODE: ``` agents: - definition: src/agents/agent.yaml - definition: src/agents/another-agent.yaml tasks: - agent_id: "{agents[0].id}" definition: src/tasks/task.yaml - agent_id: "{agents[1].id}" definition: src/tasks/another-task.yaml tools: - agent_id: "{agents[0].id}" definition: src/tools/tool.yaml - agent_id: "{agents[1].id}" definition: src/tools/another-tool.yaml ``` ---------------------------------------- TITLE: Downloading Docker Compose File (Bash) DESCRIPTION: This command downloads the Docker Compose configuration file and saves it as `docker-compose.yml`. This file defines the services for Docker-based deployment. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_3 LANGUAGE: bash CODE: ``` wget https://u.julep.ai/responses-compose.yaml -O docker-compose.yml ``` ---------------------------------------- TITLE: Creating Project Directory (Bash) DESCRIPTION: This command creates a new directory named `julep-responses-api` to organize project files for the Julep Open Responses API. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_0 LANGUAGE: bash CODE: ``` mkdir julep-responses-api ``` ---------------------------------------- TITLE: Installing Open Responses CLI with Go DESCRIPTION: Installs the Open Responses CLI tool using the Go package manager and then executes it to verify installation. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_0 LANGUAGE: Bash CODE: ``` go install github.com/julep-ai/open-responses@latest open-responses ``` ---------------------------------------- TITLE: Initializing Julep Client with API Key - Python DESCRIPTION: This snippet imports the `Client` class from the Julep library and initializes a Julep client instance. It securely retrieves the API key from an environment variable `JULEP_API_KEY` and sets the environment to 'production' for client authentication and communication with the Julep service. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb#_snippet_2 LANGUAGE: python CODE: ``` from julep import Client import os JULEP_API_KEY = os.environ["JULEP_API_KEY"] # Create a Julep client client = Client(api_key=JULEP_API_KEY, environment="production") ``` ---------------------------------------- TITLE: Creating a Julep AI Task Execution DESCRIPTION: This Python code illustrates how to initiate a single run (execution) for a previously defined Julep AI task. It uses `client.executions.create`, providing the `task_id` and an `input` dictionary that includes the `agent_id` and the specific `goal` for this execution. The execution ID is then printed. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_8 LANGUAGE: Python CODE: ``` execution = client.executions.create( task_id=task.id, input={ "agent_id": str(AGENT_UUID), "goal": "Navigate to JulepAI's Github repository and tell me the number of stars it has. Remember bro, the link for julep's repository is https://github.com/julep-ai/julep", } ) print("Started an execution. Execution ID:", execution.id) ``` ---------------------------------------- TITLE: Installing Julep SDK (Python) DESCRIPTION: This snippet provides the command-line instructions for installing the Julep SDK for Python. Users can choose between `pip` for standard package management or `poetry` for dependency management, ensuring the SDK is added to their Python environment. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/index.mdx#_snippet_0 LANGUAGE: Bash CODE: ``` # Install using pip pip install julep-sdk # Or using poetry poetry add julep-sdk ``` ---------------------------------------- TITLE: Getting Help for Specific Compose Commands (Bash) DESCRIPTION: These examples demonstrate how to use the `--help` flag with specific `open-responses compose` commands to retrieve detailed usage information, available flags, and arguments for operations like `up` and `logs`. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_23 LANGUAGE: bash CODE: ``` open-responses compose up --help open-responses compose logs --help ``` ---------------------------------------- TITLE: Generating AI Response with OpenAI SDK DESCRIPTION: This snippet demonstrates how to use the initialized OpenAI client to generate a text response using the `gpt-4o-mini` model. It sends a specific input query and prints the generated content from the response. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx#_snippet_11 LANGUAGE: python CODE: ``` import os from openai import OpenAI openai_client = OpenAI(base_url="http://localhost:8080/", api_key=os.getenv("RESPONSE_API_KEY")) response = openai_client.responses.create( model="gpt-4o-mini", input="How many people live in the world?" ) print("Generated response:", response.output[0].content[0].text) ``` LANGUAGE: javascript CODE: ``` import { OpenAI } from 'openai'; const openai_client = new OpenAI({ baseURL: 'http://localhost:8080/', apiKey: "RESPONSE_API_KEY" }); const response = await openai_client.responses.create({ model: "gpt-4o-mini", input: "How many people live in the world?" }); console.log("Generated response:", response.output[0].content[0].text); ``` ---------------------------------------- TITLE: Installing Julep SDK (Node.js) DESCRIPTION: This snippet outlines the command-line instructions for installing the Julep SDK for Node.js. It supports common package managers like `npm`, `yarn`, and `bun`, allowing developers to integrate the SDK into their Node.js projects. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/index.mdx#_snippet_1 LANGUAGE: Bash CODE: ``` # Install using npm npm install @julep/sdk # Or using yarn yarn add @julep/sdk # Or using bun bun add @julep/sdk ``` ---------------------------------------- TITLE: Running a Julep Task with Input DESCRIPTION: This command executes a specific task on the Julep platform, identified by its ``. It allows passing custom JSON input to the task, enabling dynamic execution based on provided parameters. The task ID can be found in the `julep-lock.json` file. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_8 LANGUAGE: bash CODE: ``` julep run --task --input '{"key": "value"}' ``` ---------------------------------------- TITLE: Force Re-Synchronization of Julep Project DESCRIPTION: This command re-synchronizes the local project with the Julep platform, forcing local changes to be prioritized. It updates the `julep-lock.json` file to reflect the latest local state, ensuring that the remote platform aligns with the current project configuration. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_7 LANGUAGE: bash CODE: ``` julep sync --force-local ``` ---------------------------------------- TITLE: Initiate a Julep AI Task Execution DESCRIPTION: This Python code creates a new execution for a previously defined Julep AI task. It calls `client.executions.create`, passing the `TASK_UUID` and a dictionary of input parameters, including `topics` and `user_id`. This starts the task's workflow with the specified inputs. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/07-personalized-research-assistant.ipynb#_snippet_11 LANGUAGE: python CODE: ``` execution = client.executions.create( task_id=TASK_UUID, input={ "topics": ["Quantum Computing", "LLMs"], "user_id": str(USER_UUID) } ) ``` ---------------------------------------- TITLE: Listing API Keys (Bash Example) DESCRIPTION: This example demonstrates how to list all existing API keys. For security, the keys are masked in the output. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_17 LANGUAGE: bash CODE: ``` # List all API keys (masked): open-responses key list ``` ---------------------------------------- TITLE: Retrieving and Listing Files (Python) DESCRIPTION: This snippet demonstrates how to retrieve files from Julep using the Python SDK. It shows examples of getting a single file by ID, listing all files, and listing files with a metadata filter. The `client.files.get` and `client.files.list` methods are used for these operations. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/concepts/files.mdx#_snippet_2 LANGUAGE: Python CODE: ``` # Get a specific file by ID file = client.files.get("file_id_here") print(file) # List all files files = client.files.list() for file in files: print(f"{file.name}: {file.description}") # List files with filtering files = client.files.list(metadata_filter={"category": "report"}) ``` ---------------------------------------- TITLE: Running Mintlify development server (Shell) DESCRIPTION: This command starts the local development server for Mintlify documentation. It allows you to preview changes in real-time and requires execution from the root directory containing the `mint.json` configuration file. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/README.md#_snippet_1 LANGUAGE: Shell CODE: ``` mintlify dev ``` ---------------------------------------- TITLE: Using AsyncJulep Client for Asynchronous Operations in Python DESCRIPTION: This snippet demonstrates how to use the AsyncJulep client for asynchronous operations within an asyncio event loop. The async client is designed for non-blocking I/O, making it suitable for high-performance applications that require concurrent execution. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_5 LANGUAGE: python CODE: ``` from julep import AsyncJulep async def main(): client = AsyncJulep(api_key="your_julep_api_key") # Use the client asynchronously agent = await client.agents.create(name="My Agent") # Run with asyncio import asyncio asyncio.run(main()) ``` ---------------------------------------- TITLE: Initializing OpenAI Client for Julep API (Python) DESCRIPTION: This snippet demonstrates how to create an OpenAI client instance, configuring its base URL to point to the locally hosted Julep Open Responses API and setting the necessary API key for authentication. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx#_snippet_0 LANGUAGE: python CODE: ``` from openai import OpenAI # Create an OpenAI client pointing to Julep's Open Responses API client = OpenAI(base_url="http://localhost:8080/", api_key="RESPONSE_API_KEY") ``` ---------------------------------------- TITLE: Synchronizing Local Julep Project State DESCRIPTION: This command synchronizes the local Julep project with the remote platform. It creates or updates the `julep-lock.json` file, which tracks the mapping between local files and their remote counterparts, ensuring consistency across environments. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_6 LANGUAGE: bash CODE: ``` julep sync ``` ---------------------------------------- TITLE: Python Task Expression Examples for Conditional Logic DESCRIPTION: Provides examples of Python expressions evaluated within a sandboxed environment for task conditions. The first example checks a customer's total orders, while the second demonstrates more complex logic using list comprehension and function calls to filter items. SOURCE: https://github.com/julep-ai/julep/blob/dev/CLAUDE.md#_snippet_6 LANGUAGE: Python CODE: ``` "$_['customer']['total_orders'] > 5" ``` LANGUAGE: Python CODE: ``` "$len([x for x in _['items'] if x['category'] == 'electronics']) > 0" ``` ---------------------------------------- TITLE: Create Julep AI Task Execution using Python SDK DESCRIPTION: This Python code initiates a single run of a previously defined Julep AI task. It uses the `client.executions.create` method, providing the task ID and necessary input parameters such as `agent_id` and `user_ppid` to start the task's execution flow. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/09-companion-agent.ipynb#_snippet_9 LANGUAGE: python CODE: ``` # creating the execution execution_1 = client.executions.create( task_id=TASK_UUID_1, input={ "agent_id": AGENT_UUID, "user_ppid": USER_PPID, } ) ``` ---------------------------------------- TITLE: Creating a Task Definition DESCRIPTION: These snippets define a task using a YAML string, which is then parsed and used to create a new task associated with a previously created agent. The task is designed to generate a short story based on a dynamic input topic. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx#_snippet_5 LANGUAGE: Python CODE: ``` import yaml task_definition = yaml.safe_load(""" name: Story Generator description: Generate a short story based on a given topic main: - prompt: - role: system content: You are a creative story writer. - role: user content: $ f'Write a short story about {steps[0].input.topic}' """) task = client.tasks.create( agent_id=agent.id, **task_definition # Unpack the task definition ) ``` LANGUAGE: JavaScript CODE: ``` const yaml = require("yaml"); const task_definition = ` name: Story Generator description: Generate a short story based on a given topic main: - prompt: - role: system content: You are a creative story writer. - role: user content: $ f'Write a short story about {steps[0].input.topic}' `; const task = await client.tasks.create( agent.id, yaml.parse(task_definition) ); ``` ---------------------------------------- TITLE: Retrieving and Listing Files (Node.js) DESCRIPTION: This snippet demonstrates how to retrieve files from Julep using the Node.js SDK. It shows examples of getting a single file by ID, listing all files, and listing files with a metadata filter. The `client.files.get` and `client.files.list` methods are used for these operations. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/concepts/files.mdx#_snippet_3 LANGUAGE: Node.js CODE: ``` // Get a specific file by ID const file = await client.files.get("file_id_here"); console.log(file); // List all files const files = await client.files.list(); files.forEach(file => console.log(`${file.name}: ${file.description}`)); // List files with filtering const files = await client.files.list({ metadata_filter: { category: "report" } }); ``` ---------------------------------------- TITLE: Generating JWT Token for Multi-Tenant Mode on Linux (Bash) DESCRIPTION: This snippet provides instructions for Linux users to install the `jwt` CLI, export their `JWT_SHARED_KEY`, and then generate a JWT token. This token, valid for 10 days, is essential for authenticating interactions with the Julep SDK when running in multi-tenant mode. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx#_snippet_5 LANGUAGE: bash CODE: ``` sudo apt install jwt export JWT_SHARED_KEY="your-shared-key" jwt -alg HS512 -sign + -claim exp=$(date -d '+10 days' +%s) -claim iat=$(date +%s) -claim sub=00000000-0000-0000-0000-000000000000 -key <(printf '%s' "$JWT_SHARED_SECRET") ``` ---------------------------------------- TITLE: Listing and Processing Julep AI Task Transitions in Python DESCRIPTION: This Python snippet demonstrates how to list all executed task steps (transitions) for a given execution ID using the Julep AI client. It iterates through the transitions in reverse chronological order, prints their type, and pretty-prints a reformatted version of their output. The `reformat_output` helper function truncates long `base64_image` or `url` values for display purposes. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_9 LANGUAGE: python CODE: ``` import pprint import time def reformat_output(output): if isinstance(output, dict): for key, value in output.items(): if (key == "base64_image" or key == "url") and value is not None: output[key] = value[:20] + '...' else: output[key] = reformat_output(value) elif isinstance(output, list): for i, item in enumerate(output): output[i] = reformat_output(item) return output # List all the task steps that have been executed transitions = client.executions.transitions.list(execution_id=execution.id).items # Transitions are retrieved in reverse chronological order for index, transition in enumerate(reversed(transitions)): print("Transtion Index: ", index) print("Transition Type: ", transition.type) output = transition.output pprint.pprint(reformat_output(output)) print("----"*100) ``` ---------------------------------------- TITLE: Installing Open Responses CLI globally with npm DESCRIPTION: Installs the Open Responses CLI tool globally using npm, making it available from any directory, and then executes it. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_2 LANGUAGE: Bash CODE: ``` npm install -g open-responses open-responses ``` ---------------------------------------- TITLE: Manage Julep agent tools (list, get, update, delete) DESCRIPTION: Provides examples for common tool management operations within Julep. This includes listing all tools for an agent, retrieving a specific tool, updating its properties, and deleting a tool. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/tools-integration.mdx#_snippet_8 LANGUAGE: javascript CODE: ``` const tools = await client.agents.tools.list(agentId); // Get a specific tool const tool = await client.agents.tools.get(agentId, toolId); // Update a tool const updatedTool = await client.agents.tools.update(agentId, toolId, { description: 'Updated tool description' }); // Delete a tool await client.agents.tools.delete(agentId, toolId); ``` ---------------------------------------- TITLE: PostgreSQL Connection String Example DESCRIPTION: An example connection string for configuring the `DATABASE_URL` environment variable, demonstrating how to connect to the PostgreSQL/TimescaleDB instance for the memory-store service. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/memory-store/CLAUDE.md#_snippet_1 LANGUAGE: SQL CODE: ``` postgres://postgres:PASSWORD@0.0.0.0:5432/postgres?sslmode=disable ``` ---------------------------------------- TITLE: Setting Julep API Key Environment Variables in Bash DESCRIPTION: This snippet illustrates how to configure Julep API key and environment settings using shell environment variables. This approach enhances security by keeping sensitive credentials out of the codebase and allows for easy switching between development and production environments. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx#_snippet_2 LANGUAGE: bash CODE: ``` export JULEP_API_KEY=your_julep_api_key export JULEP_ENVIRONMENT=production # or development ``` ---------------------------------------- TITLE: Configuring Julep SDK with Environment Variables (JavaScript) DESCRIPTION: This JavaScript snippet illustrates how to securely configure the Julep SDK client using environment variables. It shows the use of `dotenv` to load variables and access the API key and environment settings from `process.env`, promoting best practices for sensitive information. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx#_snippet_2 LANGUAGE: javascript CODE: ``` // Load environment variables require('dotenv').config(); const client = new Julep({ apiKey: process.env.JULEP_API_KEY, environment: process.env.JULEP_ENVIRONMENT || 'production' }); ``` ---------------------------------------- TITLE: Deploying LLM Proxy with Docker Compose DESCRIPTION: Commands to navigate into the LLM proxy directory and start the service using Docker Compose, supporting both self-hosted (local database) and managed (external database) configurations. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/llm-proxy/CLAUDE.md#_snippet_0 LANGUAGE: bash CODE: ``` cd llm-proxy docker-compose --profile self-hosted-db up docker-compose --profile managed-db up ``` ---------------------------------------- TITLE: Run Docker Compose Profiles for Monitoring Stack DESCRIPTION: Commands to navigate to the monitoring directory and start different Docker Compose profiles for the Julep monitoring stack. This includes a full multi-tenant setup with Prometheus and Grafana, or a Portainer-only deployment for container management. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/monitoring/AGENTS.md#_snippet_0 LANGUAGE: bash CODE: ``` cd monitoring docker-compose --profile multi-tenant up docker-compose --profile monitor up ``` ---------------------------------------- TITLE: Deploying SeaweedFS Blob Store with Docker Compose DESCRIPTION: Commands to deploy the SeaweedFS blob storage service using Docker Compose. Includes options for single-instance and high-availability modes. This setup requires Docker and Docker Compose to be installed on the host system. SOURCE: https://github.com/julep-ai/julep/blob/dev/src/blob-store/AGENTS.md#_snippet_0 LANGUAGE: Bash CODE: ``` cd blob-store docker-compose up seaweedfs docker-compose -f docker-compose-ha.yml up ``` ---------------------------------------- TITLE: Listing Execution Transitions (Python) DESCRIPTION: This snippet retrieves and iterates through all task steps (transitions) associated with a given execution ID. It prints the type and output of each transition, presenting them in chronological order by reversing the retrieved list, which is initially in reverse chronological order. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb#_snippet_8 LANGUAGE: python CODE: ``` # Lists all the task steps that have been executed up to this point in time transitions = client.executions.transitions.list(execution_id=execution.id).items # Transitions are retrieved in reverse chronological order for transition in reversed(transitions): print("Transition type: ", transition.type) print("Transition output: ", transition.output) print("-" * 50) ``` ---------------------------------------- TITLE: Full Julep Agent Chat Workflow in Python DESCRIPTION: This comprehensive example demonstrates the complete workflow: initializing the Julep client, creating an agent with specific instructions, setting up a session with that agent, and finally sending a user message to initiate a chat and receive a response. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/guides/getting-started/chat-with-an-agent.mdx#_snippet_8 LANGUAGE: Python CODE: ``` from julep import Julep # Initialize the Julep client julep = Julep(api_key="your_api_key") # Create an agent agent = julep.agents.create( name="Chat Buddy", about="A friendly and helpful chatbot", instructions=[ "Be friendly and engaging.", "Be helpful and provide useful information.", "Be concise and to the point.", "Do not format your responses. Keep them as plain text." ], model="gpt-4o-mini", ) # Create a session session = julep.sessions.create( agent=agent.id, situation="User wants to have a casual chat about hobbies.", ) # Chat with the agent response = julep.sessions.chat( session_id=session.id, messages=[ { "role": "user", "content": "Hi there! What are some fun hobbies to try out?" } ] ) ``` ---------------------------------------- TITLE: Viewing Julep Execution Logs in Real-time DESCRIPTION: This command retrieves and displays the logs for a specific Julep execution, identified by its ``. The `--tail` flag allows for real-time streaming of new log entries, which is useful for monitoring ongoing task executions. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx#_snippet_9 LANGUAGE: bash CODE: ``` julep logs --execution-id --tail ``` ---------------------------------------- TITLE: Full Julep Agent Chat Workflow in Node.js DESCRIPTION: This comprehensive example demonstrates the complete workflow: initializing the Julep client, creating an agent with specific instructions, setting up a session with that agent, and finally sending a user message to initiate a chat and receive a response. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/guides/getting-started/chat-with-an-agent.mdx#_snippet_9 LANGUAGE: Node.js CODE: ``` const julep = require('@julep/sdk'); // Initialize the Julep client const julep = new Julep({ apiKey: 'your_api_key' }); // Create an agent const agent = await julep.agents.create({ name: "Chat Buddy", about: "A friendly and helpful chatbot", instructions: [ "Be friendly and engaging.", "Be helpful and provide useful information.", "Be concise and to the point.", "Do not format your responses. Keep them as plain text." ], model: "gpt-4o-mini" }); // Create a session const session = await julep.sessions.create({ agent: agent.id, situation: "User wants to have a casual chat about hobbies." }); // Chat with the agent const response = await julep.sessions.chat( sessionId: session.id, messages: [ { role: "user", content: "Hi there! What are some fun hobbies to try out?" } ] ) ``` ---------------------------------------- TITLE: Get Julep Agent Details DESCRIPTION: Retrieve detailed information for a specific Julep agent using its ID. Examples include getting details in plain text, JSON format, saving to a file, or piping the JSON output to `jq` for further processing. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/commands.mdx#_snippet_13 LANGUAGE: bash CODE: ``` julep agents get --id agent_id [--json] ``` LANGUAGE: bash CODE: ``` # Get agent details julep agents get --id "agent_abc123" ``` LANGUAGE: bash CODE: ``` # Get agent details in JSON format julep agents get --id "agent_abc123" --json ``` LANGUAGE: bash CODE: ``` # Save agent details to file julep agents get --id "agent_abc123" --json > agent.json ``` LANGUAGE: bash CODE: ``` # Get and process with jq julep agents get --id "agent_abc123" --json | jq '.instructions' ``` ---------------------------------------- TITLE: Common Development Commands for Julep AI Project DESCRIPTION: This snippet provides a list of `poe` commands used for various development tasks in the Julep AI project, including formatting, linting, type-checking, testing, and code generation. It emphasizes using `poe` for consistency and correct environment setup, along with an example for running specific tests. SOURCE: https://github.com/julep-ai/julep/blob/dev/AGENTS.md#_snippet_0 LANGUAGE: bash CODE: ``` # Format, lint, type-check, test, codegen poe format # ruff format poe lint # ruff check poe typecheck # pytype --config pytype.toml (for agents-api) / pyright (for cli) poe test # ward test --exclude .venv (pytest for integrations-service) poe test --search "pattern" # Run specific tests by Ward pattern poe check # format + lint + type + SQL validation poe codegen # generate API code (e.g., OpenAPI from TypeSpec) ``` ---------------------------------------- TITLE: Generating JWT Token for Multi-Tenant Mode on macOS (Bash) DESCRIPTION: This snippet outlines the steps for macOS users to install the `mike-engel/jwt-cli/jwt-cli` via Homebrew, export their `JWT_SHARED_KEY`, and generate a JWT token. This token, valid for 10 days, is required for authenticating with the Julep SDK in multi-tenant deployments. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx#_snippet_6 LANGUAGE: bash CODE: ``` brew install mike-engel/jwt-cli/jwt-cli export JWT_SHARED_KEY="your-shared-key" jwt encode --secret "$JWT_SHARED_KEY" --alg HS512 --exp $(date -v +10d +%s) --sub '00000000-0000-0000-0000-000000000000' '{}' ``` ---------------------------------------- TITLE: Initialize Julep Client DESCRIPTION: This snippet demonstrates how to initialize the Julep client using your API key. It shows examples for both Python and Node.js, setting up the necessary client object to interact with the Julep API. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/guides/getting-started/create-and-execute-julep-task.mdx#_snippet_0 LANGUAGE: Python CODE: ``` from julep import Julep # Initialize the Julep client julep = Julep(api_key="your_api_key") ``` LANGUAGE: Node.js CODE: ``` const julep = require('@julep/sdk'); // Initialize the Julep client const julep = new Julep({ apiKey: 'your_api_key' }); ``` ---------------------------------------- TITLE: Creating Julep Client Instance DESCRIPTION: Initializes a Julep client instance using an API key retrieved from environment variables. This client object is essential for interacting with the Julep API to manage agents, tasks, and executions. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/01-website-crawler.ipynb#_snippet_2 LANGUAGE: Python CODE: ``` from julep import Client import os JULEP_API_KEY = os.environ['JULEP_API_KEY'] # Create a Julep client client = Client(api_key=JULEP_API_KEY, environment="production") ``` ---------------------------------------- TITLE: Example Server-Sent Event (SSE) Data Format DESCRIPTION: These examples illustrate the JSON data format of `ExecutionStatusEvent` events received from the SSE endpoint. Each event includes `execution_id`, `status`, `updated_at`, `error`, `transition_count`, and `metadata` fields, showing status transitions from 'starting' to 'succeeded'. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/concepts/execution.mdx#_snippet_8 LANGUAGE: bash CODE: ``` data: {"execution_id":"068306ff-e0f3-7fe9-8000-0013626a759a","status":"starting","updated_at":"2025-05-23T12:54:24.565424Z","error":null,"transition_count":1,"metadata":{}} data: {"execution_id":"068306ff-e0f3-7fe9-8000-0013626a759a","status":"running","updated_at":"2025-05-23T12:54:30.903484Z","error":null,"transition_count":2,"metadata":{}} data: {"execution_id":"068306ff-e0f3-7fe9-8000-0013626a759a","status":"succeeded","updated_at":"2025-05-23T12:56:12.054067Z","error":null,"transition_count":3,"metadata":{}} ``` ---------------------------------------- TITLE: Creating Julep Agent in Python DESCRIPTION: This code defines and creates a Julep agent. It sets the agent's name and description, then uses the client.agents.create_or_update method to register or update the agent with a unique ID and a specified LLM model (claude-3.5-sonnet-20241022). SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_3 LANGUAGE: python CODE: ``` # Defining the agent name = "Browser Use Assistant" about = "an assistant that can interact with a web browser to perform tasks on behalf of users." # Create the agent agent = client.agents.create_or_update( agent_id=AGENT_UUID, name=name, about=about, model="claude-3.5-sonnet-20241022", ) ``` ---------------------------------------- TITLE: Running Julep in Multi-Tenant Mode with Docker Compose (Bash) DESCRIPTION: This command starts the Julep project in multi-tenant mode using Docker Compose, similar to single-tenant but configured for multi-tenancy. In this mode, a locally generated JWT token is required to act as an API key for interacting with the Julep SDK. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx#_snippet_4 LANGUAGE: bash CODE: ``` docker compose --env-file .env --profile temporal-ui --profile multi-tenant --profile self-hosted-db --profile blob-store --profile temporal-ui-public up --build --force-recreate --watch ``` ---------------------------------------- TITLE: Create Julep Client Instance DESCRIPTION: This snippet demonstrates how to instantiate the Julep client. It requires an API key, typically retrieved from an environment variable, and specifies the operating environment (e.g., 'production'). This client instance is essential for all subsequent interactions with the Julep API. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/09-companion-agent.ipynb#_snippet_2 LANGUAGE: python CODE: ``` # Create a Julep client client = Client(api_key=api_key, environment="production") ``` ---------------------------------------- TITLE: Creating a Julep Task Execution DESCRIPTION: This code initiates a single run of the defined Julep task by creating an execution object. It specifies the `TASK_UUID` and provides the necessary input, in this case, a 'topic' for the news headline generation, thereby triggering the task's workflow. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/02-sarcastic-news-headline-generator.ipynb#_snippet_6 LANGUAGE: python CODE: ``` # creating an execution object execution = client.executions.create( task_id=TASK_UUID, input={ "topic": "Elon Musk" } ) ``` ---------------------------------------- TITLE: Viewing All Service Logs (Bash Example) DESCRIPTION: This example demonstrates how to view logs from all services managed by the CLI. It provides a comprehensive stream of activity across the entire system. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx#_snippet_13 LANGUAGE: bash CODE: ``` # View logs from all services: open-responses logs ``` ---------------------------------------- TITLE: Creating or Updating a Julep AI Task DESCRIPTION: This Python snippet demonstrates how to create or update a task object within the Julep AI platform using the `client.tasks.create_or_update` method. It requires a `task_id`, `agent_id`, and additional task definition parameters (`task_def`) to configure the task. SOURCE: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb#_snippet_7 LANGUAGE: Python CODE: ``` # creating the task object task = client.tasks.create_or_update( task_id=TASK_UUID, agent_id=AGENT_UUID, **task_def, ) ``` ---------------------------------------- TITLE: Basic Julep SDK Usage (Python) DESCRIPTION: This Python snippet demonstrates the core workflow of the Julep SDK: initializing the client with an API key and environment, programmatically creating an AI agent with a specified model, defining a task linked to that agent, and finally executing the created task. It showcases how to set up and run a basic AI interaction. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/index.mdx#_snippet_2 LANGUAGE: Python CODE: ``` from julep import Julep # Initialize the client client = Julep( api_key='your_api_key', environment='production' # or 'development' ) # Create an agent agent = client.agents.create( name='My First Agent', model='claude-3.5-sonnet', about='A helpful AI assistant' ) # Create a task task = client.tasks.create( agent_id=agent.id, name='Simple Task', description='A basic task example', main=[ { 'prompt': 'Hello! How can I help you today?' } ] ) # Execute the task execution = client.executions.create(task_id=task.id) ``` ---------------------------------------- TITLE: Cloning Julep Repository (Bash) DESCRIPTION: This snippet demonstrates how to clone the Julep project repository from a specified URL using the Git command-line tool. It is the initial step required to obtain the project's source code locally. SOURCE: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx#_snippet_0 LANGUAGE: bash CODE: ``` git clone ```