Julep

0

Open-source backend for building stateful AI apps

Infrastructure

ai-memory
ai-agents-framework
ai-agents
agents

English | 中文翻译

julep

Build powerful AI applications with stateful agents, complex workflows, and integrated tools.


Explore the docs »

Report Bug · Request Feature · Join Our Discord · X · LinkedIn

NPM Version   PyPI - Version   Docker Image Version   GitHub License


🚀 Upcoming Release: v0.4 Alpha

Announcing v0.4 Alpha

We're excited to announce that v0.4 is currently in alpha! This release brings significant improvements and new features. Stay tuned for the official release.

For a comprehensive overview of Julep's core concepts and upcoming features, check out our detailed concepts guide.

Looking for the previous version? You can find the v0.3 README here.


Why Julep?

We've built a lot of AI apps and understand the challenges in creating complex, stateful applications with multiple agents and workflows.

The Problems

  1. Building AI applications with memory, knowledge, and tools is complex and time-consuming.
  2. Managing long-running tasks and complex workflows in AI applications is challenging.
  3. Integrating multiple tools and services into AI applications requires significant development effort.

Features

  • Stateful Agents: Create and manage agents with built-in conversation history and memory.
  • Complex Workflows: Define and execute multi-step tasks with branching, parallel execution, and error handling.
  • Integrated Tools: Easily incorporate a wide range of tools and external services into your AI applications.
  • Flexible Session Management: Support for various interaction patterns like one-to-many and many-to-one between agents and users.
  • Built-in RAG: Add, delete & update documents to provide context to your agents.
  • Asynchronous Task Execution: Run long-running tasks in the background with state management and resumability.
  • Multi-Model Support: Switch between different language models (OpenAI, Anthropic, Ollama) while preserving state.
  • Task System: Define and execute complex, multi-step workflows with parallel processing and error handling.

Quickstart

Option 1: Use the Julep Cloud

Our hosted platform is in Beta!

To get access:

Option 2: Install and run Julep locally

Head over to docs on self-hosting to see how to run Julep locally!

Installation

pip install julep

Setting up the client

from julep import Client
import os

base_url = os.environ.get("JULEP_API_URL")
api_key = os.environ.get("JULEP_API_KEY")

client = Client(api_key=api_key, base_url=base_url)

Create an agent

Agent is the object to which LLM settings like model, temperature along with tools are scoped to.

agent = client.agents.create(
    name="Jessica",
    model="gpt-4",
    tools=[],    # Tools defined here
    about="A helpful AI assistant",
    instructions=["Be polite", "Be concise"]
)

Create a user

User is the object which represents the user of the application.

Memories are formed and saved for each user and many users can talk to one agent.

user = client.users.create(
    name="Anon",
    about="Average nerdy techbro/girl spending 8 hours a day on a laptop",
)

Create a session

A "user" and an "agent" communicate in a "session". System prompt goes here.

situation_prompt = """You are Jessica, a helpful AI assistant. 
You're here to assist the user with any questions or tasks they might have."""
session = client.sessions.create(
    user_id=user.id,
    agent_id=agent.id,
    situation=situation_prompt
)

Start a stateful conversation

session.chat controls the communication between the "agent" and the "user".

It has two important arguments;

  • recall: Retrieves the previous conversations and memories.
  • remember: Saves the current conversation turn into the memory store.

To keep the session stateful, both need to be True

user_msg = "Hey Jessica, can you help me with a task?"
response = client.sessions.chat(
    session_id=session.id,
    messages=[
        {
            "role": "user",
            "content": user_msg,
            "name": "Anon",
        }
    ],
    recall=True,
    remember=True,
)

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

Core Concepts

Agent

An Agent in Julep is the main orchestrator of your application. It's backed by foundation models like GPT-4 or Claude and can use tools, documents, and execute complex tasks.

User

Users in Julep represent the end-users of your application. They can be associated with sessions and have their own documents and metadata.

Session

Sessions manage the interaction between users and agents. They maintain conversation history and context.

Tool

Tools are functions that agents can use to perform specific actions or retrieve information.

Doc

Docs are collections of text snippets that can be associated with agents or users and are used for context retrieval.

Task

Tasks are complex, multi-step workflows that can be defined and executed by agents.

Execution

An Execution is an instance of a Task that has been started with some input. It goes through various states as it progresses.


API and SDKs

To use the API directly or to take a look at request & response formats, authentication, available endpoints and more, please refer to the API Documentation

Python SDK

To install the Python SDK, run:

pip install julep

For more information on using the Python SDK, please refer to the Python SDK documentation.

TypeScript SDK

To install the TypeScript SDK using npm, run:

npm install @julep/sdk

For more information on using the TypeScript SDK, please refer to the TypeScript SDK documentation.


Deployment

Check out the self-hosting guide to host the platform yourself.

If you want to deploy Julep to production, let's hop on a call!

We'll help you customise the platform and help you get set up with:

  • Multi-tenancy
  • Reverse proxy along with authentication and authorisation
  • Self-hosted LLMs
  • & more

Contributing

We welcome contributions from the community to help improve and expand the Julep AI platform. Please see our Contributing Guidelines for more information on how to get started.


License

Julep AI is released under the Apache 2.0 License. See the LICENSE file for more details.


Contact and Support

If you have any questions, need assistance, or want to get in touch with the Julep AI team, please use the following channels:

  • Discord: Join our community forum to discuss ideas, ask questions, and get help from other Julep AI users and the development team.
  • GitHub Issues: For technical issues, bug reports, and feature requests, please open an issue on the Julep AI GitHub repository.
  • Email Support: If you need direct assistance from our support team, send an email to hey@julep.ai, and we'll get back to you as soon as possible.
  • Follow for updates on X & LinkedIn
  • Hop on a call: We wanna know what you're building and how we can tweak and tune Julep to help you build your next AI app.