### Julep Project Configuration Example Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Example 'julep.yaml' file defining agents, tasks, and tools for a Julep project. ```yaml 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 ``` -------------------------------- ### CLI Installation: Run the CLI Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Starts the Julep Responses API service in watch mode using the `open-responses` CLI. ```npx npx open-responses start ``` -------------------------------- ### Docker Installation: Download Environment Variables Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Downloads the example environment variables file from a URL and saves it as `.env` using `wget`. ```bash wget https://u.julep.ai/responses-env.example -O .env ``` -------------------------------- ### Julep CLI Configuration Example Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Example configuration file for the Julep CLI, specifying API key and environment. ```yaml api_key: "your_api_key_here" environment: "production" ``` -------------------------------- ### CLI Installation: Setup Environment Variables (uvx) Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Configures the necessary environment variables for the `open-responses` CLI using `uvx`. ```uv uvx open-responses setup ``` -------------------------------- ### CLI Installation: Setup Environment Variables Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Configures the necessary environment variables for the `open-responses` CLI. ```npx npx open-responses setup ``` -------------------------------- ### CLI Installation: Install via uvx Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Installs and runs the `open-responses` CLI tool using `uvx`. ```uv uvx open-responses ``` -------------------------------- ### Install Julep CLI Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Installs the Julep CLI using pip. The installed command is 'julep'. ```bash pip install julep-cli ``` -------------------------------- ### CLI Installation: Run the CLI (uvx) Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Starts the Julep Responses API service in watch mode using the `uvx open-responses` command. ```uv uvx open-responses start ``` -------------------------------- ### Install Julep (Python/Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx Installs the Julep SDK for Python using pip or for Node.js using npm or bun. ```bash pip install julep ``` ```bash npm install @julep/sdk # or bun add @julep/sdk ``` -------------------------------- ### CLI Installation: Install via npx Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Installs and runs the `open-responses` CLI tool directly using `npx`. ```npx npx open-responses ``` -------------------------------- ### Docker Installation: Run Containers Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Starts the Docker containers defined in `docker-compose.yml` in watch mode using `docker compose up --watch`. ```bash docker compose up --watch ``` -------------------------------- ### Julep SDK Environment File Example Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx Example of a .env file used to store Julep API credentials and environment settings. Ensure this file is kept secure and not committed to version control. ```plaintext JULEP_API_KEY=your_api_key_here JULEP_ENVIRONMENT=production ``` -------------------------------- ### CLI Installation: Install Globally via npm Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Installs the `open-responses` CLI tool globally using `npm` for command-line access. ```npm npm install -g open-responses ``` -------------------------------- ### Start Mintlify Development Server Source: https://github.com/julep-ai/julep/blob/dev/documentation/README.md Starts the Mintlify development server from the root of the documentation project. Ensure you are in the directory containing 'mint.json'. ```bash mintlify dev ``` -------------------------------- ### CLI Installation: Install Globally via pip Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Installs the `open-responses` CLI tool globally using `pip` and makes it available as a command. ```pip pip install open-responses open-responses ``` -------------------------------- ### Initialize New Project Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx Creates a new project structure with a guided setup process, including directory creation, documentation file generation, interactive configuration, and Docker Compose setup. ```bash open-responses init ``` -------------------------------- ### Install OpenAI SDK (pip/npm) Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Installs the OpenAI SDK using pip for Python and npm for Node.js. This is the first step to interact with the Responses API. ```bash pip install openai ``` ```bash npm install openai ``` -------------------------------- ### Install Julep Python SDK Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Installs the Julep Python SDK using pip, the standard package installer for Python. ```bash pip install julep ``` -------------------------------- ### Initialize and Use Async Julep Client Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Shows how to initialize and use the asynchronous Julep client (`AsyncJulep`) within an asyncio event loop. It includes creating an agent asynchronously as an example of client usage. ```python 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()) ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Example of setting environment variables for Julep API key and environment in a .env file. ```Bash JULEP_API_KEY=your_api_key_here JULEP_ENVIRONMENT=production # or dev (development) ``` -------------------------------- ### Docker Installation: Create Project Directory Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Creates a new directory for the Julep Responses API project using the `mkdir` command. ```bash mkdir julep-responses-api ``` -------------------------------- ### Docker Installation: Download Docker Compose File Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Downloads the Docker Compose configuration file from a URL and saves it as `docker-compose.yml` using `wget`. ```bash wget https://u.julep.ai/responses-compose.yaml -O docker-compose.yml ``` -------------------------------- ### Initialize Julep Project Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to initialize a new Julep project using a specified template. ```bash julep init --template profiling-recommending ``` -------------------------------- ### Docker Installation: Navigate to Directory Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Changes the current directory to the newly created `julep-responses-api` directory using the `cd` command. ```bash cd julep-responses-api ``` -------------------------------- ### Install Mintlify CLI Source: https://github.com/julep-ai/julep/blob/dev/documentation/README.md Installs the Mintlify CLI globally using npm. This tool is required to preview documentation changes locally. ```bash npm i -g mintlify ``` -------------------------------- ### Full Example: Julep Chat Workflow (Python, Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/guides/getting-started/chat-with-an-agent.mdx A complete example demonstrating the entire process of initializing the Julep client, creating an agent, starting a session, and chatting with the agent. This combines all the previous steps into a single script. ```python 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?" } ] ) ``` ```javascript 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?" } ] ) ``` -------------------------------- ### Docker Installation: Verify Containers Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/quickstart.mdx Lists the currently running Docker containers to verify the API is active using `docker ps`. ```bash docker ps ``` -------------------------------- ### Authenticate with Julep CLI Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to authenticate with the Julep platform using an API key. ```bash julep auth ``` -------------------------------- ### Install Julep Node.js SDK Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx Install the Julep Node.js SDK using your preferred package manager (npm, yarn, or bun). This is the first step to integrating Julep's AI capabilities into your Node.js applications. ```bash # Using npm npm install @julep/sdk # Using yarn yarn add @julep/sdk # Using bun bun add @julep/sdk ``` -------------------------------- ### Julep CLI: Project Wizard Source: https://github.com/julep-ai/julep/blob/dev/src/cli/spec.md Launches the Julep assistant for guided project setup and interaction. ```bash julep assistant ``` -------------------------------- ### OpenAI SDK: Setup Julep Client Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx Demonstrates how to set up an OpenAI client to connect to Julep's Open Responses API. Requires the `openai` library and setting the `base_url` and `api_key`. ```Python 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") ``` -------------------------------- ### Environment Setup and Client Initialization (Python) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Sets up Julep API key and environment using a .env file and initializes the Julep client in Python. Requires the 'dotenv' package. ```Python import os from dotenv import load_dotenv from julep import Julep load_dotenv() client = Julep( api_key=os.getenv('JULEP_API_KEY'), environment=os.getenv('JULEP_ENVIRONMENT', 'production') ) ``` -------------------------------- ### Environment Setup and Client Initialization (Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Sets up Julep API key and environment using a .env file and initializes the Julep client in Node.js. Requires the 'dotenv' package. ```JavaScript import dotenv from 'dotenv'; import { Julep } from '@julep/sdk'; dotenv.config(); const client = new Julep({ apiKey: process.env.JULEP_API_KEY, environment: process.env.JULEP_ENVIRONMENT || 'production' }); ``` -------------------------------- ### Initialize Julep Client using Environment Variables Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Initializes the Julep client without arguments, relying on environment variables (JULEP_API_KEY and JULEP_ENVIRONMENT) for configuration. This simplifies setup when environment variables are managed externally. ```python from julep import Julep client = Julep() # Will use environment variables ``` -------------------------------- ### Sync Julep Project Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to synchronize the local Julep project with the Julep platform, creating a 'julep-lock.json' file. ```bash julep sync ``` -------------------------------- ### Install and Run Open Responses CLI using npm/bunx Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx Provides instructions for installing and running the Open Responses CLI using npm or bunx. It covers both global installation and direct execution via npx or bunx. ```bash npx open-responses ``` ```bash npm install -g open-responses open-responses ``` ```bash bunx open-responses ``` -------------------------------- ### Agents SDK: Setup Async Client Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx Configures an asynchronous OpenAI client for the Agents SDK, pointing to Julep's Open Responses API and setting it as the default client. ```Python from openai import AsyncOpenAI from agents import set_default_openai_client # Create and configure the OpenAI client custom_client = AsyncOpenAI(base_url="http://localhost:8080/", api_key="RESPONSE_API_KEY") set_default_openai_client(custom_client) ``` -------------------------------- ### Install Open Responses CLI using Go Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx Installs the Open Responses CLI globally using the Go package manager. After installation, the command `open-responses` becomes available for use. ```bash go install github.com/julep-ai/open-responses@latest open-responses ``` -------------------------------- ### Initialize Julep Client with API Key Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Initializes the Julep client by directly providing the API key during instantiation. This is a straightforward way to authenticate your application with the Julep API. ```python from julep import Julep # Initialize the client client = Julep(api_key="your_julep_api_key") ``` -------------------------------- ### Initialize Julep Client Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/05-video-processing-with-natural-language.ipynb Initializes the Julep client with an API key and environment. The API key is retrieved from environment variables. ```python from julep import Client import os JULEP_API_KEY = os.environ.get("JULEP_API_KEY") # Create a Julep client client = Client(api_key=JULEP_API_KEY, environment="production") ``` -------------------------------- ### LiteLLM Configuration Example Source: https://github.com/julep-ai/julep/blob/dev/documentation/FAQ.mdx Provides an example snippet of a `litellm-config.yaml` file, showing how to configure LiteLLM for various LLM providers. This is used by the Worker system. ```YAML model_list: - modelName: gpt-3.5-turbo litellm_params: model: "openai/gpt-3.5-turbo" - modelName: claude-3-opus litellm_params: model: "anthropic/claude-3-opus-20240229" api_key: "YOUR_ANTHROPIC_API_KEY" ``` -------------------------------- ### Verify Julep SDK Connection Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx A simple test function to verify your Julep SDK installation and configuration by attempting to create an AI agent. It logs success or failure to the console. ```javascript 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(); ``` -------------------------------- ### Python Integration Provider Registration Example Source: https://github.com/julep-ai/julep/blob/dev/src/integrations-service/CLAUDE.md Illustrates the pattern for registering integration providers within the integrations-service. Providers are defined with setup, methods, and arguments, and then registered in the 'available_providers' dictionary. ```Python # Provider Registration # - Define in providers.py with setup, methods, arguments # - Register in available_providers dictionary ``` -------------------------------- ### Initialize Open Responses CLI Setup Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx Executes the initial setup command for the Open Responses CLI. This command configures the API settings, generates a .env file, and creates a docker-compose.yml file. ```bash open-responses setup ``` -------------------------------- ### Configure Julep Client with Options Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Demonstrates advanced configuration of the Julep client, including setting the API key, environment, an optional custom base URL for the API endpoint, and a custom request timeout in seconds. ```python 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 ) ``` -------------------------------- ### Agents SDK: Create Simple Agent Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx Provides an example of creating a basic agent with a name, instructions, and a specified model. It then runs the agent with a user query and prints the output. ```Python 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()) # Output: Great to hear! Let me know how I can help you today—whether it's answering questions, solving problems, or just chatting. 😊 ``` -------------------------------- ### TypeScript Usage with Julep SDK Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx Demonstrates how to use the Julep SDK with TypeScript, including importing necessary types and creating an AI agent. The SDK includes type definitions, so no extra installation is needed for TypeScript support. ```typescript 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' }); } ``` -------------------------------- ### Initialize Julep Client (Python/Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx Initializes the Julep client with an API key for Python and Node.js environments. ```python from julep import Julep client = Julep(api_key="your_julep_api_key") ``` ```javascript import { Julep } from '@julep/sdk'; const client = new Julep({ apiKey: 'your_julep_api_key' }); ``` -------------------------------- ### Gateway Service Setup and Health Check Source: https://github.com/julep-ai/julep/blob/dev/src/gateway/AGENTS.md Instructions for setting up and interacting with the gateway service. This includes navigating to the gateway directory, starting the service using Docker Compose, and performing a health check. ```Bash cd gateway docker-compose up gateway ``` ```HTTP curl http://localhost:80/api/healthz ``` -------------------------------- ### View Julep Execution Logs Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to view the logs of a Julep project execution, with an option to follow logs in real-time. ```bash julep logs --execution-id --tail ``` -------------------------------- ### Create Julep Task Execution Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/00-Devfest-Email-Assistant.ipynb Initiates a single run (execution) of a defined Julep task with specific input parameters. This starts the workflow defined in the task. ```python execution = client.executions.create( task_id=task.id, input={"from": "diwank@julep.ai", "to": "help@agents.new", "subject": "what's up", "body": "sup"}, ) ``` -------------------------------- ### Configure Julep Client via Environment Variables Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/python/installation.mdx Sets up the Julep API key and environment using shell environment variables. The Julep client can then be initialized without explicit parameters, automatically picking up these configurations. ```bash export JULEP_API_KEY=your_julep_api_key export JULEP_ENVIRONMENT=production # or development ``` -------------------------------- ### Gateway Service Setup and Health Check Source: https://github.com/julep-ai/julep/blob/dev/src/gateway/CLAUDE.md Instructions for setting up and interacting with the gateway service. This includes navigating to the gateway directory, starting the service using Docker Compose, and performing a health check. ```Bash cd gateway docker-compose up gateway ``` ```HTTP curl http://localhost:80/api/healthz ``` -------------------------------- ### Run Julep Project Task Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to run a specific task within a Julep project, providing input data. ```bash julep run --task --input '{"key": "value"}' ``` -------------------------------- ### Install Julep SDK for Python Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/index.mdx Installs the Julep SDK for Python using pip or poetry. ```Bash # Install using pip pip install julep-sdk # Or using poetry poetry add julep-sdk ``` -------------------------------- ### Create Julep Task Execution Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb Initiates an execution of a created Julep task with specified input parameters. This example provides a list of locations for the trip planning task. ```python execution = client.executions.create( task_id=task.id, input={ "locations": ["New York", "London", "Paris", "Tokyo", "Sydney"] } ) print("Started an execution. Execution ID:", execution.id) ``` -------------------------------- ### Install Julep SDK for Node.js Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/index.mdx Installs the Julep SDK for Node.js using npm, yarn, or bun. ```Bash # Install using npm npm install @julep/sdk # Or using yarn yarn add @julep/sdk # Or using bun bun add @julep/sdk ``` -------------------------------- ### Install Julep Client Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/05-video-processing-with-natural-language.ipynb Installs or upgrades the Julep client package using pip. The `--quiet` flag suppresses output during installation. ```python !pip install --upgrade julep --quiet ``` -------------------------------- ### Execute Task and Get Result (Python/Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/quickstart.mdx Executes a task with a specific input ('a magical garden' as the topic) and monitors its status until completion, then prints the output or error. ```python import time 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}") ``` ```javascript 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}`); } ``` -------------------------------- ### Define Brave Search Tool Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/07-personalized-research-assistant.ipynb Defines the Brave Search tool integration with the necessary API key setup. ```yaml tools: - name: brave_search type: integration integration: provider: brave setup: brave_api_key: {brave_api_key} ``` -------------------------------- ### Julep Custom Tool Integration Example Source: https://github.com/julep-ai/julep/blob/dev/documentation/FAQ.mdx Provides a step-by-step guide for implementing custom tool integrations in Julep, including defining the Tool entity, specifying parameters, using the `@function_tool` decorator, and invoking via ToolCallStep. ```python 1. Define Tool entity with type `integration` 2. Specify provider, method, setup parameters 3. Use `@function_tool` decorator for functions 4. Add to agent's tool list 5. Invoke via ToolCallStep in workflows ``` -------------------------------- ### Install Julep Client Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb Installs the Julep client library using pip. The `-U` flag ensures the latest version is installed, and `--quiet` suppresses verbose output. ```python !pip install julep -U --quiet ``` -------------------------------- ### Get Execution Details Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/01-website-crawler.ipynb Retrieves the details of an execution from the Julep platform. This includes the output of the last transition that took place during the execution. ```python # Get execution details execution = client.executions.get(execution.id) ``` -------------------------------- ### Run Julep in Single-Tenant Mode Source: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx Starts the Julep project in single-tenant mode using Docker Compose. This mode allows direct interaction with the SDK without an API key. ```bash docker compose --env-file .env --profile temporal-ui --profile single-tenant --profile self-hosted-db --profile blob-store --profile temporal-ui-public up --build --force-recreate --watch ``` -------------------------------- ### Configure Julep SDK Client Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx Initialize the Julep client with your API key and environment settings. You can use either CommonJS or ES module syntax for importing. Optional parameters like timeout, retries, and baseUrl can also be configured. ```javascript 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 }); ``` -------------------------------- ### Execute Main Function Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/examples.mdx This snippet demonstrates the execution of a main function, likely the entry point for a program or script. It's a common pattern in many programming languages to start the application's logic. ```javascript await main() ``` -------------------------------- ### Clone Julep Repository Source: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx Clones the Julep AI repository from a specified URL. This is the first step in setting up Julep locally. ```bash git clone ``` -------------------------------- ### Access Transition Output by Index Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/01-website-crawler.ipynb This example shows how to access the output of a specific transition from the list of transitions. It retrieves the transitions list and then accesses the output of the transition at index 1. ```python transitions = client.executions.transitions.list(execution_id=execution.id).items transitions[1].output ``` -------------------------------- ### Function Tool Call Example for Responses API (Get Weather) Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/concepts.mdx Demonstrates how to define and call a function tool, such as 'get_weather', within the Responses API, including parameters for location and units. ```json { "input": "What's the weather in San Francisco?", "tools": [ { "type": "function", "name": "get_weather", "description": "Get the current weather in a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "description": "The unit of temperature to use" } }, "required": ["location"] } } ], } ``` -------------------------------- ### Install Open Responses CLI using Python (pipx/pip) Source: https://github.com/julep-ai/julep/blob/dev/documentation/responses/cli.mdx Details the installation of the Open Responses CLI using Python package managers pipx and pip. It includes commands for both local and global installations. ```bash pipx install open-responses pipx open-responses ``` ```bash pip install open-responses open-responses ``` ```bash uvx open-responses ``` -------------------------------- ### Create Julep Client with API Key Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb Initializes the Julep client using an API key retrieved from environment variables. The client is configured for the 'production' environment. ```python 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") ``` -------------------------------- ### Run Julep in Multi-Tenant Mode Source: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx Starts the Julep project in multi-tenant mode using Docker Compose. This mode requires a JWT token for API interactions. ```bash 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 ``` -------------------------------- ### API Route Definition Example Source: https://github.com/julep-ai/julep/blob/dev/AGENTS.md An example of a FastAPI route definition for creating a new entry in a session, including request model validation, dependency injection for user authentication, and response model specification. ```Python # Route definition @router.post("/sessions/{session_id}/entries", response_model=EntryResponse) async def create_entry( session_id: str, entry_create: EntryCreate, current_user: User = Depends(get_current_user), ) -> EntryResponse: """Create a new entry in a session.""" # Implementation... ``` -------------------------------- ### Deploy SeaweedFS with Docker Compose Source: https://github.com/julep-ai/julep/blob/dev/src/blob-store/CLAUDE.md Commands to start the SeaweedFS service using Docker Compose for single-instance or high-availability deployments. Requires Docker and Docker Compose to be installed. ```bash cd blob-store docker-compose up seaweedfs # For high availability mode: docker-compose -f docker-compose-ha.yml up ``` -------------------------------- ### LiteLLM Configuration Example Source: https://github.com/julep-ai/julep/blob/dev/src/llm-proxy/CLAUDE.md An example of a LiteLLM configuration file, typically in YAML format. This file defines model lists, router settings, cache configurations, and general authentication/database settings for the LLM proxy. ```yaml # Example litellm-config.yaml structure # model_list: # - model_name: "gpt-3.5-turbo" # litellm_params: # model: "gpt-3.5-turbo" # api_key: "sk-1234567890" # router_settings: # strategy: "simple-shuffle" # cache_settings: # type: "redis" # redis_url: "redis://localhost:6379" # general_settings: # master_key: "my-master-key" # database_url: "postgresql://user:password@host:port/database" ``` -------------------------------- ### Python Cookbook: Designing Multi-Step Tasks Source: https://github.com/julep-ai/julep/blob/dev/documentation/concepts/sessions.mdx A Python cookbook that guides on designing and implementing multi-step tasks within the Julep AI framework. It provides practical examples for orchestrating complex processes. ```Python # Cookbook for Designing Multi-Step Tasks # This is a placeholder for the actual code content. # The full code can be found at: https://github.com/julep-ai/julep/blob/dev/cookbooks/06-Designing_Multi-Step_Tasks.py ``` -------------------------------- ### API Route Definition Example Source: https://github.com/julep-ai/julep/blob/dev/CLAUDE.md An example of a FastAPI route definition for creating a new entry in a session, including request model validation, dependency injection for user authentication, and response model specification. ```Python # Route definition @router.post("/sessions/{session_id}/entries", response_model=EntryResponse) async def create_entry( session_id: str, entry_create: EntryCreate, current_user: User = Depends(get_current_user), ) -> EntryResponse: """Create a new entry in a session.""" # Implementation... ``` -------------------------------- ### Force Sync Julep Project Source: https://github.com/julep-ai/julep/blob/dev/documentation/julepcli/introduction.mdx Command to force synchronization of the local Julep project with the Julep platform, updating 'julep-lock.json'. Supports a --watch flag for automatic re-sync. ```bash julep sync --force-local ``` -------------------------------- ### Get Last Execution Transition Output Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/07-personalized-research-assistant.ipynb Retrieves and pretty-prints the output of the most recent transition within an execution. This is useful for getting the final result of a completed task. ```Python import pprint # Retrieves the output of the last transition that took place output = client.executions.transitions.list(execution_id=execution.id).items[0].output # Pretty printing the output pprint.pprint(output) ``` -------------------------------- ### Initiate Chat Session with Julep Agent Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/basics/01-Hello-Agent.ipynb This code example shows how to create a new chat session for a previously created agent and send a user message. It then prints the agent's response to the console. ```Python session = client.sessions.create(agent_id=agent.id) response = client.sessions.chat(session_id=session.id, messages=[{"role": "user", "content": 'hello'}]) print(response.choices[0].message.content) ``` -------------------------------- ### Install Julep Client Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/00-Devfest-Email-Assistant.ipynb Installs the Julep client library using pip. This is the first step to using Julep in your Python environment. ```python !pip install julep ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/julep-ai/julep/blob/dev/documentation/advanced/localsetup.mdx Changes the current directory to the root of the cloned Julep project repository. ```bash cd ``` -------------------------------- ### Install Julep SDK (Python) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Installs the Julep SDK for Python using pip, poetry, or pipenv. Ensure Python 3.8+ is installed. ```Bash pip install julep ``` ```Bash poetry add julep ``` ```Bash pipenv install julep ``` -------------------------------- ### Execute Task with Different URL Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/01-website-crawler.ipynb This example demonstrates how to run the same task with a different input URL. It creates a new execution using client.executions.create, specifying the task ID and a new URL in the input. ```python execution = client.executions.create( task_id=TASK_UUID, input={ "url": "https://www.producthunt.com/" } ) ``` -------------------------------- ### Scheduler Setup with Docker Compose Source: https://github.com/julep-ai/julep/blob/dev/src/scheduler/AGENTS.md Commands to set up the Temporal scheduler service using Docker Compose. This includes starting the database, Temporal UI, and managing profiles for different environments. ```Bash cd scheduler docker-compose --profile self-hosted-db up docker-compose --profile managed-db up docker-compose --profile temporal-ui up docker-compose --profile temporal-ui-public up ``` -------------------------------- ### Install Julep SDK (Node.js) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Installs the Julep SDK for Node.js using npm, yarn, or bun. Requires Node.js 16+. ```Bash npm install @julep/sdk ``` ```Bash yarn add @julep/sdk ``` ```Bash bun add @julep/sdk ``` -------------------------------- ### Configure Julep SDK with Environment Variables Source: https://github.com/julep-ai/julep/blob/dev/documentation/sdks/nodejs/installation.mdx Securely configure the Julep SDK by loading API keys and environment settings from environment variables using a .env file. This is the recommended approach for managing sensitive credentials. ```javascript // Load environment variables require('dotenv').config(); const client = new Julep({ apiKey: process.env.JULEP_API_KEY, environment: process.env.JULEP_ENVIRONMENT || 'production' }); ``` -------------------------------- ### Scheduler Setup with Docker Compose Source: https://github.com/julep-ai/julep/blob/dev/src/scheduler/CLAUDE.md Commands to set up the Temporal scheduler service using Docker Compose. This includes starting the database, Temporal UI, and managing profiles for different environments. ```Bash cd scheduler docker-compose --profile self-hosted-db up docker-compose --profile managed-db up docker-compose --profile temporal-ui up docker-compose --profile temporal-ui-public up ``` -------------------------------- ### Julep Integration Tool Example (YAML) Source: https://github.com/julep-ai/julep/blob/dev/documentation/concepts/tools.mdx Demonstrates how to configure a Julep integration tool using YAML. This example sets up a 'wikipedia_search' tool that utilizes the 'wikipedia' integration provider, specifying its name, description, and how to call it with arguments. ```YAML name: Example integration tool task description: Search wikipedia for a query tools: - name: wikipedia_search description: Search wikipedia for a query type: integration integration: provider: wikipedia main: - tool: wikipedia_search arguments: query: "Julep" ``` -------------------------------- ### Install Julep Assistant Dependencies Source: https://github.com/julep-ai/julep/blob/dev/documentation/tutorials/julep-assistant.mdx Installs the necessary Python dependencies for the Julep assistant's chainlit UI by referencing the requirements.txt file. This is a prerequisite for running the assistant. ```bash cd julep-assistant pip install -r chainlit-ui/requirements.txt ``` -------------------------------- ### Install Julep Client Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/06-browser-use.ipynb Installs or upgrades the Julep client library using pip. The `--quiet` flag suppresses output during installation. ```python !pip install julep -U --quiet ``` -------------------------------- ### Define Julep Task with Tools and Workflow Source: https://github.com/julep-ai/julep/blob/dev/cookbooks/advanced/03-trip-planning-assistant.ipynb Defines a Julep task, which is a workflow for multi-step actions. This example includes integrating with Wikipedia, weather (OpenWeatherMap), and internet search (Brave). It outlines a process to plan a trip using location, weather, and attraction data. ```python import yaml openweathermap_api_key = "YOUR_API_KEY" brave_api_key = "YOUR_API_KEY" # Defining the task task_def = yaml.safe_load(f""" # yaml-language-server: $schema=https://raw.githubusercontent.com/julep-ai/julep/refs/heads/dev/src/schemas/create_task_request.json name: Julep Tourist Plan With Weather And Attractions description: A task that plans a trip with weather and attractions. ######################################################## ####################### INPUT SCHEMA ################## ######################################################## input_schema: type: object properties: locations: type: array items: type: string description: The locations to search for. ######################################################## ####################### TOOLS ########################## ######################################################## # Define the tools that the task will use in this workflow tools: - name: wikipedia type: integration integration: provider: wikipedia - name: weather type: integration integration: provider: weather setup: openweathermap_api_key: {openweathermap_api_key} - name: internet_search type: integration integration: provider: brave setup: brave_api_key: {brave_api_key} ######################################################## ####################### MAIN WORKFLOW ########################## ######################################################## main: # Step 0: Fetch weather data for each location - over: $ steps[0].input.locations map: tool: weather arguments: location: $ _ # Step 1: Search Wikipedia for tourist attractions for each location - over: $ steps[0].input.locations map: tool: internet_search arguments: query: $ 'tourist attractions in ' + _ # Step 2: Zip locations, weather, and attractions into a list of tuples [(location, weather, attractions)] - evaluate: zipped: |- $ list( zip( steps[0].input.locations, [output['result'] for output in steps[0].output], steps[1].output ) ) # Step 3: Create an itinerary for each location - over: $ _['zipped'] parallelism: 3 # Inside the map step, each `_` represents the current element in the list # which is a tuple of (location, weather, attractions) map: prompt: - role: system content: >- $ f'''You are {{agent.name}}. Your task is to create a detailed itinerary for visiting tourist attractions in some locations. The user will give you the following information for each location: - The location - The current weather condition - The top tourist attractions''' - role: user content: >- $ f'''Location: "{{_[0]}}" Weather: "{{_[1]}}" Attractions: "{{_[2]}}"''' unwrap: true # Step 4: Create a final plan by joining the activities for each location - evaluate: final_plan: |- $ '\n---------------\n'.join(activity for activity in _) ") ``` -------------------------------- ### Installation Verification (Python) Source: https://github.com/julep-ai/julep/blob/dev/documentation/introduction/install.mdx Verifies the Julep installation by creating a test agent using the initialized client in Python. Requires 'dotenv' package. ```Python from julep import Julep import os from dotenv import load_dotenv load_dotenv() client = Julep( api_key=os.getenv('JULEP_API_KEY'), environment=os.getenv('JULEP_ENVIRONMENT', 'production') ) # Test connection agent = client.agents.create( name="Test Agent", model="claude-3.5-haiku", about="A test agent" ) print(f"Successfully created agent: {agent.id}") ```