> ## Documentation Index
> Fetch the complete documentation index at: https://docs.julep.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Reference

> Commands for managing Julep projects and resources

## Overview

<Warning>
  It is still in experimental phase and is not yet complete. In case of any issues, please reach out to us on [Discord](https://discord.com/invite/JTSBGRZrzj) or [email](mailto:hey@julep.ai).
</Warning>

The `julep` CLI is a comprehensive command-line interface for interacting with the Julep platform.
Following are the available commands.

## Authentication

<Tabs>
  <Tab title="Basic">
    ```bash theme={"dark"}
    julep auth
    ```

    The `julep auth` command is used to authenticate your Julep CLI. This will prompt you to enter your API key and save it to the configuration file.

    **Example:**

    ```bash theme={"dark"}
    # Basic authentication with interactive prompt
    julep auth

    # Output:
    # Enter your Julep API key: **********************
    # Authentication successful!
    ```
  </Tab>

  <Tab title="With API Key">
    ```bash theme={"dark"}
    julep auth --api-key your_julep_api_key
    ```

    The `julep auth --api-key your_julep_api_key` command is used to authenticate your Julep CLI with a specific API key.

    <ParamField path="--api-key" type="string" required>
      Your Julep API key
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Authenticate with API key directly
    julep auth --api-key "julep_1234567890abcdef"

    # Using environment variable
    export JULEP_API_KEY="julep_1234567890abcdef"
    julep auth --api-key $JULEP_API_KEY
    ```
  </Tab>

  <Tab title="With Environment">
    ```bash theme={"dark"}
    julep auth --api-key your_key --environment staging
    ```

    The `julep auth --api-key your_key --environment staging` command is used to authenticate your Julep CLI with a specific API key and environment.

    <ParamField path="--api-key" type="string" required>
      Your Julep API key
    </ParamField>

    <ParamField path="--environment" type="string" required>
      Environment to use (production/staging)
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Authenticate with staging environment
    julep auth --api-key "julep_1234567890abcdef" --environment staging

    # Authenticate with production environment
    julep auth --api-key "julep_1234567890abcdef" --environment production

    # Using environment variables
    export JULEP_API_KEY="julep_1234567890abcdef"
    export JULEP_ENV="staging"
    julep auth --api-key $JULEP_API_KEY --environment $JULEP_ENV
    ```
  </Tab>
</Tabs>

<Info>
  You can get your API key from the [Julep Dashboard](https://dashboard.julep.ai/).
</Info>

## Project Management

<Tabs>
  <Tab title="Initialize">
    ```bash theme={"dark"}
    julep init --template "Template Name" --path "Destination Path" --yes
    ```

    The `julep init` command is used to initialize a new Julep project using a predefined template. You can check the list of available templates in our [library](https://github.com/julep-ai/library).

    <ParamField path="--template" type="string" required>
      Name of the template to use from the library repository (default: "hello-world")
    </ParamField>

    <ParamField path="--path" type="string">
      Destination directory for where you want to initialize the project (default: current directory)
    </ParamField>

    <ParamField path="--yes" type="boolean">
      Skip confirmation prompt
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Initialize a project with the default template (hello-world template)
    julep init

    # Initialize a project with a specific template
    julep init --template "profiling-recommending" --path "./my-project" # Will be initialized in ./my-project/profiling-recommending

    # Initialize a project and skip confirmation
    julep init --yes
    ```
  </Tab>

  <Tab title="Sync">
    ```bash theme={"dark"}
    julep sync [--force-local] [--force-remote] [--source "Source Path"]
    ```

    The `julep sync` command is used to synchronize the local project with the Julep platform.

    <ParamField path="--force-local" type="boolean">
      Force local files to take precedence
    </ParamField>

    <ParamField path="--force-remote" type="boolean">
      Force remote state to take precedence
    </ParamField>

    <ParamField path="--watch" type="boolean">
      Watch for changes and synchronize automatically.

      > **Note:** when watch mode is enabled, only local-to-remote sync `force-local` is supported. Use `--force-remote` only with watch mode turned off.
    </ParamField>

    <ParamField path="--source" type="string">
      Source directory to sync from (default: current directory)
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Basic sync
    julep sync

    # Force local changes to override remote
    julep sync --force-local

    # Force remote state to override local
    julep sync --force-remote

    # Sync with specific source directory
    julep sync --source ./my-project

    # Watch for changes and synchronize automatically
    julep sync --watch
    ```
  </Tab>

  <Tab title="Import">
    ```bash theme={"dark"}
    julep import --agent --id agent_id --output path
    ```

    The `julep import` command is used to import an `agent`, `task`, or `tool` from the Julep platform.

    > **Note:** Importing tasks and tools is not yet supported; only agents are supported.

    <ParamField path="--agent" type="boolean" required>
      Specify that you want to import an agent
    </ParamField>

    <ParamField path="--id" type="string" required>
      ID of the agent to import
    </ParamField>

    <ParamField path="--source" type="string">
      Path to the source directory. Defaults to current working directory
    </ParamField>

    <ParamField path="--output" type="string">
      Path to save the imported agent (default: `<source_dir>/src/agents/<agent-name>.yaml`)
    </ParamField>

    <ParamField path="--yes" type="boolean">
      Skip confirmation prompt
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Import agent to default directory
    julep import --agent --id "00000000-0000-0000-0000-000000000000"

    # Import agent with specific filename
    julep import --agent --id "00000000-0000-0000-0000-000000000000" --output ./agents/my-agent.yaml

    # Import agent and skip confirmation
    julep import --agent --id "00000000-0000-0000-0000-000000000000" --yes
    ```
  </Tab>
</Tabs>

## Task Execution

<Tabs>
  <Tab title="Run">
    ```bash theme={"dark"}
    julep run --task <task_id> --input '{"key": "value"}'
    ```

    The `julep run` command is used to execute a task.

    <ParamField path="--task" type="string" required>
      ID of the task to execute
    </ParamField>

    <ParamField path="--input" type="json">
      Input data for the task
    </ParamField>

    <ParamField path="--input-file" type="string">
      Path to a json file containing the input to execute the task with
    </ParamField>

    <ParamField path="--wait" type="boolean">
      Wait for the task to complete before exiting, stream logs to stdout
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Run task with inline JSON input
    julep run --task "00000000-0000-0000-0000-000000000000" --input '{"prompt": "Write a story about a magical forest"}'

    # Run task with input from file
    julep run --task "00000000-0000-0000-0000-000000000000" --input-file ./inputs/story-params.json

    # Run task and wait for completion
    julep run --task "00000000-0000-0000-0000-000000000000" --input '{"style": "watercolor"}' --wait

    # Run task that doesn't require input (empty object)
    julep run --task "00000000-0000-0000-0000-000000000000" --input '{}'

    # Invalid task ID
    julep run --task bad-id --input '{}'
    # -> Error creating execution: Task not found
    ```
  </Tab>

  <Tab title="Logs">
    ```bash theme={"dark"}
    julep logs --execution-id exec_id [--tail]
    ```

    The `julep logs` command is used to view execution logs.

    <ParamField path="--execution-id" type="string" required>
      ID of the execution to view logs for
    </ParamField>

    <ParamField path="--tail" type="boolean">
      Continuously stream logs as they are generated
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # View logs for a specific execution
    julep logs --execution-id "00000000-0000-0000-0000-000000000000"

    # Stream logs in real-time
    julep logs --execution-id "00000000-0000-0000-0000-000000000000" --tail

    # Get logs in JSON format
    julep logs --execution-id "00000000-0000-0000-0000-000000000000" --json
    ```
  </Tab>
</Tabs>

## Agent Management

The commands in `julep agents` are used to manage your agents.

<Tabs>
  <Tab title="Create">
    ```bash theme={"dark"}
    julep agents create --name "Agent Name" \
                       --model "Model Name" \
                       --about "Agent Description" \
                       --metadata '{"key": "value"}' \
                       --instructions "Instruction"
    ```

    The `julep agents create` command is used to create a new agent.

    <ParamField path="--name" type="string" required>
      Name of the agent
    </ParamField>

    <ParamField path="--model" type="string">
      Model to be used (e.g., gpt-4). You can find the list of models [here](/integrations/supported-models#available-models)
    </ParamField>

    <ParamField path="--about" type="string">
      Description of the agent
    </ParamField>

    <ParamField path="--metadata" type="json">
      Additional metadata (JSON format)
    </ParamField>

    <ParamField path="--instructions" type="string">
      Instructions for the agent (can be repeated)
    </ParamField>

    <ParamField path="--definition" type="string">
      Path to agent definition file
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Create a basic agent
    julep agents create --name "Story Writer" --model "gpt-4"

    # Create agent with full configuration
    julep agents create \
      --name "Content Assistant" \
      --model "gpt-4" \
      --about "AI assistant for content creation" \
      --metadata '{"type": "content", "version": "1.0"}' \
      --instructions "Focus on creative writing" \
      --instructions "Maintain professional tone"

    # Create agent from definition file
    julep agents create --definition ./agents/content-assistant.yaml
    ```

    > **Note:** When creating an agent, the agent doesn't get automatically imported to the project. You can run `julep import --agent --id <agent-id>` to import the agent to the project.
  </Tab>

  <Tab title="Update">
    ```bash theme={"dark"}
    julep agents update --id agent_id \
                       --name "New Name" \
                       --model "New Model"
    ```

    The `julep agents update` command is used to update an existing agent.

    <ParamField path="--id" type="string" required>
      ID of the agent to update
    </ParamField>

    <ParamField path="--name" type="string">
      New name for the agent
    </ParamField>

    <ParamField path="--model" type="string">
      New model for the agent
    </ParamField>

    <ParamField path="--about" type="string">
      New description for the agent
    </ParamField>

    <ParamField path="--metadata" type="json">
      Additional metadata (JSON format)
    </ParamField>

    <ParamField path="--instructions" type="array">
      New instructions for the agent (can be repeated)
    </ParamField>

    **Examples:**

    ```bash [expandable] theme={"dark"}
    # Update agent name
    julep agents update --id "agent_abc123" --name "Enhanced Writer"

    # Update multiple properties
    julep agents update \
      --id "agent_abc123" \
      --name "Content Pro" \
      --model "gpt-4" \
      --about "Professional content creation assistant"

    # Update metadata
    julep agents update \
      --id "agent_abc123" \
      --metadata '{"type": "content", "version": "2.0"}'

    # Update instructions
    julep agents update \
      --id "agent_abc123" \
      --instructions "New instruction 1" \
      --instructions "New instruction 2"

    # Update from definition file
    julep agents update --id "agent_abc123" --definition ./agents/updated-agent.yaml
    ```
  </Tab>

  <Tab title="Delete">
    ```bash theme={"dark"}
    julep agents delete --id agent_id [--force]
    ```

    The `julep agents delete` command is used to delete an existing agent.

    <ParamField path="--id" type="string" required>
      ID of the agent to delete
    </ParamField>

    <ParamField path="--force" type="boolean">
      Skip confirmation prompt
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Delete with confirmation prompt
    julep agents delete --id "00000000-0000-0000-0000-000000000000"

    # Force delete without confirmation
    julep agents delete --id "00000000-0000-0000-0000-000000000000" --force

    # Delete multiple agents using a bash for loop
    for id in agent_id1 agent_id2 agent_id3; do
      julep agents delete --id "$id" --force
    done
    ```
  </Tab>

  <Tab title="List">
    ```bash theme={"dark"}
    julep agents list [--metadata-filter '{"key": "value"}'] [--json]
    ```

    The `julep agents list` command is used to list all agents.

    <ParamField path="--metadata-filter" type="json">
      Filter agents by metadata
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output in JSON format
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # List all agents
    julep agents list

    # List agents with JSON output
    julep agents list --json

    # Filter agents by metadata
    julep agents list --metadata-filter '{"type": "content"}'

    # List agents and process with jq
    julep agents list --json | jq '.[] | select(.model=="gpt-4")'

    # Save agent list to file
    julep agents list --json > agents.json
    ```
  </Tab>

  <Tab title="Get">
    ```bash theme={"dark"}
    julep agents get --id agent_id [--json]
    ```

    The `julep agents get` command is used to get details of a specific agent.

    <ParamField path="--id" type="string" required>
      ID of the agent to retrieve
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output in JSON format
    </ParamField>

    **Examples:**

    ```bash theme={"dark"}
    # Get agent details
    julep agents get --id "agent_abc123"

    # Get agent details in JSON format
    julep agents get --id "agent_abc123" --json

    # Save agent details to file
    julep agents get --id "agent_abc123" --json > agent.json

    # Get and process with jq
    julep agents get --id "agent_abc123" --json | jq '.instructions'
    ```
  </Tab>
</Tabs>

## Task Management

<Tabs>
  <Tab title="Create">
    ```bash theme={"dark"}
    julep tasks create --name "Task Name" \
                      --agent-id agent_id \
                      --definition path/to/task.yaml \
                      --metadata '{"status": "beta"}' \
                      --inherit-tools
    ```

    The `julep tasks create` command is used to create a new task.

    <ParamField path="--agent-id" type="string" required>
      ID of the associated agent
    </ParamField>

    <ParamField path="--name" type="string">
      Name of the task
    </ParamField>

    <ParamField path="--definition" type="string">
      Path to task definition file
    </ParamField>

    <ParamField path="--metadata" type="json">
      Additional metadata (JSON format)
    </ParamField>

    <ParamField path="--inherit-tools" type="boolean">
      Inherit tools from agent
    </ParamField>

    <ParamField path="--import-to" type="string">
      Import to project after creating
    </ParamField>
  </Tab>

  <Tab title="Update">
    ```bash theme={"dark"}
    julep tasks update --id task_id \
                      --name "New Name" \
                      --agent-id new_agent_id \
                      --definition new/path/to/task.yaml
    ```

    The `julep tasks update` command is used to update an existing task.

    <ParamField path="--id" type="string" required>
      ID of the task to update
    </ParamField>

    <ParamField path="--name" type="string">
      New name for the task
    </ParamField>

    <ParamField path="--agent-id" type="string">
      New agent ID for the task
    </ParamField>

    <ParamField path="--definition" type="string">
      Path to new task definition file
    </ParamField>

    <ParamField path="--description" type="string">
      New description for the task
    </ParamField>

    <ParamField path="--metadata" type="json">
      New metadata for the task
    </ParamField>

    <ParamField path="--inherit-tools" type="boolean">
      Whether to inherit tools from the agent
    </ParamField>
  </Tab>

  <Tab title="Delete">
    ```bash theme={"dark"}
    julep tasks delete --id task_id [--force]
    ```

    The `julep tasks delete` command is used to delete an existing task.

    <ParamField path="--id" type="string" required>
      ID of the task to delete
    </ParamField>

    <ParamField path="--force" type="boolean">
      Skip confirmation prompt
    </ParamField>
  </Tab>

  <Tab title="List">
    ```bash theme={"dark"}
    julep tasks list [--agent-id agent_id] [--json]
    ```

    The `julep tasks list` command is used to list all tasks.

    <ParamField path="--agent-id" type="string">
      Filter by associated agent ID
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output in JSON format
    </ParamField>
  </Tab>

  <Tab title="Get">
    ```bash theme={"dark"}
    julep tasks get --id task_id [--json]
    ```

    The `julep tasks get` command is used to get details of a specific task.

    <ParamField path="--id" type="string" required>
      ID of the task to retrieve
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output in JSON format
    </ParamField>
  </Tab>
</Tabs>

## Tool Management

<Tabs>
  <Tab title="Create">
    ```bash theme={"dark"}
    julep tools create --name "Tool Name" \
                      --type tool_type \
                      --agent-id agent_id \
                      --definition path/to/config.yaml
    ```

    The `julep tools create` command is used to create a new tool.

    <ParamField path="--agent-id" type="string" required>
      ID of the associated agent
    </ParamField>

    <ParamField path="--name" type="string" required>
      Name of the tool
    </ParamField>

    <ParamField path="--type" type="string" required>
      Type of the tool
    </ParamField>

    <ParamField path="--definition" type="string">
      Path to tool definition file
    </ParamField>

    <ParamField path="--description" type="string">
      Description of the tool
    </ParamField>

    <ParamField path="--metadata" type="json">
      Additional metadata (JSON format)
    </ParamField>

    <ParamField path="--import-to" type="string">
      Import to project after creating
    </ParamField>
  </Tab>

  <Tab title="Update">
    ```bash theme={"dark"}
    julep tools update --id tool_id \
                      --name "New Name" \
                      --agent-id new_agent_id \
                      --definition new/path/to/config.yaml
    ```

    The `julep tools update` command is used to update an existing tool.

    <ParamField path="--id" type="string" required>
      ID of the tool to update
    </ParamField>

    <ParamField path="--name" type="string">
      New name for the tool
    </ParamField>

    <ParamField path="--agent-id" type="string">
      New agent ID for the tool
    </ParamField>

    <ParamField path="--definition" type="string">
      Path to new tool definition file
    </ParamField>

    <ParamField path="--description" type="string">
      New description for the tool
    </ParamField>

    <ParamField path="--metadata" type="json">
      New metadata for the tool
    </ParamField>
  </Tab>

  <Tab title="Delete">
    ```bash theme={"dark"}
    julep tools delete --agent-id agent_id --id tool_id [--force]
    ```

    The `julep tools delete` command is used to delete an existing tool.

    <ParamField path="--agent-id" type="string" required>
      ID of the agent the tool is associated with
    </ParamField>

    <ParamField path="--id" type="string" required>
      ID of the tool to delete
    </ParamField>

    <ParamField path="--force" type="boolean">
      Skip confirmation prompt
    </ParamField>
  </Tab>

  <Tab title="List">
    ```bash theme={"dark"}
    julep tools list --agent-id agent_id [--json]
    ```

    The `julep tools list` command is used to list all tools for a given agent.

    <ParamField path="--agent-id" type="string">
      Filter by associated agent ID
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output in JSON format
    </ParamField>
  </Tab>

  <Info>
    A future release will add a `julep tools get` command for retrieving a tool by ID.
  </Info>
</Tabs>

## Execution Management

<Tabs>
  <Tab title="Create">
    ```bash theme={"dark"}
    julep executions create --task task_id --input '{"key": "value"}'
    ```

    The `julep executions create` command is used to create a new execution for a task.

    <ParamField path="--task" type="string" required>
      ID or name of the task to execute
    </ParamField>

    <ParamField path="--input" type="json">
      JSON string representing the input for the task (defaults to {})
    </ParamField>

    <ParamField path="--input-file" type="string">
      Path to a file containing the input for the task
    </ParamField>
  </Tab>

  <Tab title="List">
    ```bash theme={"dark"}
    julep executions list [--task-id task_id] [--json]
    ```

    The `julep executions list` command is used to list all executions or filter based on criteria.

    <ParamField path="--task-id" type="string">
      Filter executions by associated task ID
    </ParamField>

    <ParamField path="--json" type="boolean">
      Output the list in JSON format
    </ParamField>
  </Tab>

  <Tab title="Cancel">
    ```bash theme={"dark"}
    julep executions cancel --id execution_id
    ```

    The `julep executions cancel` command is used to cancel an existing execution.

    <ParamField path="--id" type="string" required>
      ID of the execution to cancel
    </ParamField>
  </Tab>
</Tabs>

<Info>
  The CLI will soon include a `julep assistant` command that launches an interactive prompt for generating commands from plain language. This feature is still under development.
</Info>

## Miscellaneous

<Tabs>
  <Tab title="Version">
    ```bash theme={"dark"}
    julep --version
    ```

    The `julep --version` or `julep -v` command displays the current version of the Julep CLI.
  </Tab>

  <Tab title="Help">
    ```bash theme={"dark"}
    julep --help
    ```

    The `julep --help` or `julep -h` command displays help information for the Julep CLI.
  </Tab>
</Tabs>

## Best Practices

<CardGroup cols={3}>
  <Card title="Project Organization" icon="folder-tree">
    <ul>
      <li>Keep agent, task, and tool definitions in separate directories under `src/`</li>
      <li>Use meaningful file names that reflect their purpose</li>
      <li>Follow the standard project structure</li>
    </ul>
  </Card>

  <Card title="Version Control" icon="code-branch">
    <ul>
      <li>**DO** commit `julep.yaml` to version control</li>
      <li>**DO** commit `julep-lock.json` to version control</li>
      <li>Document project dependencies and requirements</li>
    </ul>
  </Card>

  <Card title="Command Line Usage" icon="terminal">
    <ul>
      <li>Use `--json` flag for machine-readable output</li>
      <li>Use `--quiet` for scripting and automation</li>
      <li>Always provide required parameters</li>
    </ul>
  </Card>
</CardGroup>

### File Management

* **Project Configuration**: Keep your `julep.yaml` clean and well-organized
* **Lock File**: Use `julep-lock.json` to track remote state and relationships
* **Source Files**: Organize definitions in appropriate directories under `src/`

### Workflow Tips

* Use `julep sync` regularly to keep local and remote states in sync
* Review changes with `--json` output before applying updates
* Use the assistant mode for complex workflows: `julep assistant`

### Security Best Practices

* Store API keys securely
* Use environment-specific configurations
* Review permissions before executing destructive commands
* Use `--force` flags cautiously

<Warning>
  Always review the changes before using force flags (`--force-local`, `--force-remote`) as they can override remote or local state.
</Warning>

## Support

If you need help with further questions in Julep:

* Join our [Discord community](https://discord.com/invite/JTSBGRZrzj)
* Check the [GitHub repository](https://github.com/julep-ai/julep)
* Contact support at [hey@julep.ai](mailto:hey@julep.ai)
