From e768728b8cbf7041cc9970f99a43906837b254a4 Mon Sep 17 00:00:00 2001
From: Diwank Singh Tomer
Date: Sun, 29 Sep 2024 20:41:35 -0400
Subject: [PATCH] doc: v0 of README
Signed-off-by: Diwank Singh Tomer
---
README.md | 723 ++++++++++++++++++++++++++++++++++++++-----------
example.py | 107 ++++++++
example.ts | 117 ++++++++
image.png | Bin 426141 -> 0 bytes
v0.3_README.md | 19 +-
5 files changed, 791 insertions(+), 175 deletions(-)
create mode 100644 example.py
create mode 100644 example.ts
delete mode 100644 image.png
diff --git a/README.md b/README.md
index 0f49831ff..2f658f61e 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,134 @@
-
English | [中文翻译](/README-CN.md)
-
+
-
-Build powerful AI applications with stateful agents, complex workflows, and integrated tools.
-
-
-
-
- Explore the docs »
-
-
- Report Bug
- ·
- Request Feature
- ·
- Join Our Discord
- ·
- X
- ·
- LinkedIn
-
+
+
+ Explore Docs
+ ·
+ Discord
+ ·
+ 𝕏
+ ·
+ LinkedIn
@@ -41,231 +142,527 @@ Build powerful AI applications with stateful agents, complex workflows, and inte
----
+*****
+
+## 🎉🚀 **Exciting News: Julep 1.0 Alpha Release!** 🚀🎉
+
+We're thrilled to announce the alpha release of Julep 1.0! 🥳
+
+🌟 **What's New:**
+- Enhanced workflow capabilities
+- Improved agent persistence
+- Expanded tool integrations
+- Streamlined API
+
+🧪 Try it out and help shape the future of AI workflows!
+
+> [!NOTE]
+> While we are in beta, you can reach out on [Discord](https://discord.com/invite/JTSBGRZrzj) to get your API key.
-## 🚀 Upcoming Release: v0.4 Alpha
+> [!TIP]
+> 🐛 Found a bug? Have a suggestion? We'd love to hear from you!
+> Join our [Discord](https://discord.com/invite/JTSBGRZrzj) or open an [issue](https://github.com/julep-ai/julep/issues).
-**Release Date**: October 7 (Hacktoberfest Launch)
+Stay tuned for more updates as we approach our stable release! 📢
-We are thrilled to announce the upcoming release of **Julep v0.4 Alpha** on **October 7**, just in time for **Hacktoberfest**!
-### **Key Highlights**
+## Introduction
-#### **New Feature: Tasks**
+Julep is an open-source platform for creating persistent AI agents with customizable workflows. It provides tools to develop, manage, and deploy AI-driven applications, focusing on flexibility and ease of use.
-- **Autonomous Workflows**: Unlock the ability for agents to perform long-term, multi-step tasks autonomously. Define complex workflows that enable your agents to operate with minimal intervention.
+With Julep, you can:
+- Quickly develop AI agents that retain context and state across interactions
+- Design and execute sophisticated workflows tailored to your AI agents
+- Seamlessly integrate various tools and APIs into your AI workflows
+- Effortlessly manage persistent sessions and user interactions
-- **Harness OpenAI's o1 Models**: Leverage the advanced reasoning and planning capabilities of OpenAI's o1 models. Perfect for orchestrating intricate and prolonged tasks that require sophisticated understanding and execution.
+Whether you're developing a chatbot, automating tasks, or building a complex AI assistant, Julep provides the flexibility and features you need to turn your ideas into reality swiftly and efficiently.
-- **100+ Integrations**: Seamlessly integrate with popular tools and APIs, including **GitHub**, **Salesforce**, **File Manager**, **Code Execution**, and more. Expand your agents' capabilities to perform a wide range of actions.
-#### **Rewritten from Scratch Based on Developer Feedback**
+
+Here's a quick python example:
-- **Enhanced Doc Search**: Experience a significant improvement in document retrieval. Agents can now access the most relevant information faster, ensuring more accurate and contextually appropriate interactions.
+
+from julep import Julep, AsyncJulep
-- **Easier to Use**: We've streamlined the user experience with simplified APIs and more intuitive interfaces. Building powerful AI applications is now more straightforward than ever.
+# 🔑 Initialize the Julep client
+# Or alternatively, use AsyncJulep for async operations
+client = Julep(api_key="your_api_key")
-- **Multi-Agent Sessions**: Support for sessions with multiple agents and users. Enable complex interaction patterns, collaborative problem-solving, and more dynamic conversations within your applications.
+##################
+## 🤖 Agent 🤖 ##
+##################
-- **Extensive Integrations**: Incorporate a multitude of popular tools and services directly into your AI applications, enhancing functionality and providing richer experiences for your users.
+# Create a research agent
+agent = client.agents.create(
+ name="Research Agent",
+ model="claude-3.5-sonnet",
+ about="You are a research agent designed to handle research inquiries.",
+)
-### **Call to Action**
+# 🔍 Add a web search tool to the agent
+client.agents.tools.create(
+ agent_id=agent.id,
+ name="web_search", # Should be python valid variable name
+ description="Use this tool to research inquiries.",
+ integration={
+ "provider": "brave",
+ "method": "search",
+ "setup": {
+ "api_key": "your_brave_api_key",
+ },
+ },
+)
-- **Join Our Discord Community**: Be among the first to access Julep v0.4 Alpha! [Join our Discord](https://discord.com/invite/JTSBGRZrzj) to get early access and API keys. Engage with other developers, share your projects, and provide feedback.
+#################
+## 💬 Chat 💬 ##
+#################
+
+# Start an interactive chat session with the agent
+session = client.sessions.create(
+ agent_id=agent.id,
+ context_overflow="adaptive", # 🧠 Julep will dynamically compute the context window if needed
+)
+
+# 🔄 Chat loop
+while (user_input := input("You: ")) != "exit":
+ response = client.sessions.chat(
+ session_id=session.id,
+ message=user_input,
+ )
+
+ print("Agent: ", response.choices[0].message.content)
+
+
+#################
+## 📋 Task 📋 ##
+#################
+
+# Create a recurring research task for the agent
+task = client.tasks.create(
+ agent_id=agent.id,
+ name="Research Task",
+ description="Research the given topic every 24 hours.",
+ #
+ # 🛠️ Task specific tools
+ tools=[
+ {
+ "name": "send_email",
+ "description": "Send an email to the user with the results.",
+ "api_call": {
+ "method": "post",
+ "url": "https://api.sendgrid.com/v3/mail/send",
+ "headers": {"Authorization": "Bearer YOUR_SENDGRID_API_KEY"},
+ },
+ }
+ ],
+ #
+ # 🔢 Task main steps
+ main=[
+ #
+ # Step 1: Research the topic
+ {
+ # `_` (underscore) variable refers to the previous step's output
+ # Here, it points to the topic input from the user
+ "prompt": "Look up topic '{{_.topic}}' and summarize the results.",
+ "tools": [{"ref": {"name": "web_search"}}], # 🔍 Use the web search tool from the agent
+ "unwrap": True,
+ },
+ #
+ # Step 2: Send email with research results
+ {
+ "tool": "send_email",
+ "arguments": {
+ "subject": "Research Results",
+ "body": "'Here are the research results for today: ' + _.content",
+ "to": "inputs[0].email", # Reference the email from the user's input
+ },
+ },
+ #
+ # Step 3: Wait for 24 hours before repeating
+ {"sleep": "24 * 60 * 60"},
+ ],
+)
----
+# 🚀 Start the recurring task
+client.executions.create(task_id=task.id, input={"topic": "Python"})
-## Why Julep?
-We've built a lot of AI apps and understand the challenges in creating complex, stateful applications with multiple agents and workflows.
+# 🔁 This will run the task every 24 hours,
+# research for the topic "Python", and
+# send the results to the user's email
+
+
-**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!
+Julep simplifies the process of building persistent AI agents with customizable workflows. Key features include:
-To get access:
-- Head over to https://platform.julep.ai
-- Generate and add your `JULEP_API_KEY` in `.env`
+- **Persistent AI Agents**: Create and manage AI agents that maintain context across interactions.
+- **Customizable Workflows**: Design complex, multi-step AI workflows using Tasks.
+- **Tool Integration**: Seamlessly integrate various tools and APIs into your AI workflows.
+- **Document Management**: Efficiently manage and search through documents for your agents.
+- **Session Management**: Handle persistent sessions for continuous interactions.
+- **Flexible Execution**: Support for parallel processing, conditional logic, and error handling in workflows.
-### Option 2: Install and run Julep locally
-Head over to docs on [self-hosting](https://docs.julep.ai/guides/self-hosting) to see how to run Julep locally!
+## Installation
-### Installation
+To get started with Julep, install it using [npm](https://www.npmjs.com/package/@julep/sdk) or [pip](https://pypi.org/project/julep/):
+
+```bash
+npm install @julep/sdk
+```
+
+or
```bash
pip install julep
```
-### Setting up the `client`
+> [!TIP]
+> ~~Get your API key [here](https://app.julep.ai/api-keys).~~
+>
+> While we are in beta, you can reach out on [Discord](https://discord.com/invite/JTSBGRZrzj) to get your API key.
-```python
-from julep import Client
-import os
+## Quick Start Guide
-base_url = os.environ.get("JULEP_API_URL")
-api_key = os.environ.get("JULEP_API_KEY")
+### Step 1: Import Julep
-client = Client(api_key=api_key, base_url=base_url)
+First, import the Julep SDK into your project:
+
+```javascript
+const Julep = require('@julep/sdk');
```
-### Create an agent
-Agent is the object to which LLM settings like model, temperature along with tools are scoped to.
+or
```python
-agent = client.agents.create(
- name="Jessica",
- model="gpt-4",
- tools=[], # Tools defined here
- about="A helpful AI assistant",
- instructions=["Be polite", "Be concise"]
-)
+from julep import AsyncJulep
```
-### Create a user
-User is the object which represents the user of the application.
+### Step 2: Initialize the Agent
-Memories are formed and saved for each user and many users can talk to one agent.
+Create a new agent with basic settings:
-```python
-user = client.users.create(
- name="Anon",
- about="Average nerdy techbro/girl spending 8 hours a day on a laptop",
-)
+```javascript
+const julep = new Julep({ apiKey: 'your-api-key' });
+
+const agent = await julep.agents.create({
+ name: 'ResearchAssistant',
+ model: 'gpt-4-turbo',
+ about: "You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.",
+});
```
-### Create a session
-A "user" and an "agent" communicate in a "session". System prompt goes here.
+or
```python
-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
+client = AsyncJulep(api_key="your_api_key")
+
+agent = await client.agents.create(
+ name="Storytelling Agent",
+ model="gpt-4-turbo",
+ about="You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.",
)
```
-### Start a stateful conversation
-`session.chat` controls the communication between the "agent" and the "user".
+### Step 3: Chat with the Agent
-It has two important arguments;
-- `recall`: Retrieves the previous conversations and memories.
-- `remember`: Saves the current conversation turn into the memory store.
+Start an interactive chat session with the agent:
-To keep the session stateful, both need to be `True`
+```javascript
+const session = await julep.sessions.create({
+ agentId: agent.id,
+});
+
+// Send messages to the agent
+const response = await julep.sessions.chat({
+ sessionId: session.id,
+ message: 'Hello, can you tell me a story?',
+});
+
+console.log(response);
+```
+
+or
```python
-user_msg = "Hey Jessica, can you help me with a task?"
-response = client.sessions.chat(
+session = await client.sessions.create(agent_id=agent.id)
+
+# Send messages to the agent
+response = await client.sessions.chat(
session_id=session.id,
- messages=[
+ message="Hello, can you tell me a story?",
+)
+
+print(response)
+```
+
+
+### Step 4: Create a multi-step Task
+
+Let's define a multi-step task to create a story and generate a paneled comic strip based on an input idea:
+
+```python
+# 🛠️ Add an image generation tool (DALL·E) to the agent
+await client.agents.tools.create(
+ agent_id=agent.id,
+ name="image_generator",
+ description="Use this tool to generate images based on descriptions.",
+ integration={
+ "provider": "dalle",
+ "method": "generate_image",
+ "setup": {
+ "api_key": "your_dalle_api_key",
+ },
+ },
+)
+
+# 📋 Task
+# Create a task that takes an idea and creates a story and a 4-panel comic strip
+task = await client.tasks.create(
+ agent_id=agent.id,
+ name="Story and Comic Creator",
+ description="Create a story based on an idea and generate a 4-panel comic strip illustrating the story.",
+ main=[
+ # Step 1: Generate a story and outline into 4 panels
{
- "role": "user",
- "content": user_msg,
- "name": "Anon",
- }
+ "prompt": [
+ {
+ "role": "system",
+ "content": "You are {{agent.name}}. {{agent.about}}"
+ },
+ {
+ "role": "user",
+ "content": (
+ "Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip. "
+ "Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story."
+ ),
+ },
+ ],
+ "unwrap": True,
+ },
+ # Step 2: Extract the panel descriptions and story
+ {
+ "evaluate": {
+ "story": "_.split('1. ')[0].strip()",
+ "panels": "re.findall(r'\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)', _)",
+ }
+ },
+ # Step 3: Generate images for each panel using the image generator tool
+ {
+ "foreach": {
+ "in": "_.panels",
+ "do": {
+ "tool": "image_generator",
+ "arguments": {
+ "description": "_",
+ },
+ },
+ },
+ },
+ # Step 4: Generate a catchy title for the story
+ {
+ "prompt": [
+ {
+ "role": "system",
+ "content": "You are {{agent.name}}. {{agent.about}}"
+ },
+ {
+ "role": "user",
+ "content": "Based on the story below, generate a catchy title.\n\nStory: {{outputs[1].story}}",
+ },
+ ],
+ "unwrap": True,
+ },
+ # Step 5: Return the story, the generated images, and the title
+ {
+ "return": {
+ "title": "outputs[3]",
+ "story": "outputs[1].story",
+ "comic_panels": "[output.image.url for output in outputs[2]]",
+ }
+ },
],
- recall=True,
- remember=True,
)
+```
+
+> [!TIP]
+> node.js version of this is similar.
+
+### Step 5: Execute the Task
-print(response.response[0][0].content)
+```python
+# 🚀 Execute the task with an input idea
+execution = await client.executions.create(
+ task_id=task.id,
+ input={"idea": "A cat who learns to fly"}
+)
+
+# 🎉 Watch as the story and comic panels are generated
+await client.executions.stream(execution_id=execution.id)
```
----
+This example demonstrates how to create an agent with a custom tool, define a complex task with multiple steps, and execute it to generate a creative output.
-## 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.
+> [!TIP]
+> You can find another node.js example [here](example.ts) or python example [here](example.py).
-### User
-Users in Julep represent the end-users of your application. They can be associated with sessions and have their own documents and metadata.
+## Understanding Tasks
-### Session
-Sessions manage the interaction between users and agents. They maintain conversation history and context.
+Tasks are the core of Julep's workflow system. They allow you to define complex, multi-step AI workflows that your agents can execute. Here's a brief overview of task components:
-### Tool
-Tools are functions that agents can use to perform specific actions or retrieve information.
+- **Name and Description**: Each task has a unique name and description for easy identification.
+- **Main Steps**: The core of a task, defining the sequence of actions to be performed.
+- **Tools**: Optional integrations that extend the capabilities of your agent during task execution.
-### Doc
-Docs are collections of text snippets that can be associated with agents or users and are used for context retrieval.
+### Types of Workflow Steps
-### Task
-Tasks are complex, multi-step workflows that can be defined and executed by agents.
+Tasks in Julep can include various types of steps:
-### Execution
-An Execution is an instance of a Task that has been started with some input. It goes through various states as it progresses.
+1. **Prompt**: Send a message to the AI model and receive a response.
+ ```python
+ {"prompt": "Analyze the following data: {{data}}"}
+ ```
----
+2. **Tool Call**: Execute an integrated tool or API.
+ ```python
+ {"tool": "web_search", "arguments": {"query": "Latest AI developments"}}
+ ```
-## API and SDKs
+3. **Evaluate**: Perform calculations or manipulate data.
+ ```python
+ {"evaluate": {"average_score": "sum(scores) / len(scores)"}}
+ ```
-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](https://docs.julep.ai/api-reference/agents-api/agents-api)
+4. **Conditional Logic**: Execute steps based on conditions.
+ ```python
+ {"if": "score > 0.8", "then": [...], "else": [...]}
+ ```
-### Python SDK
+5. **Loops**: Iterate over data or repeat steps.
+ ```python
+ {"foreach": {"in": "data_list", "do": [...]}}
+ ```
-To install the Python SDK, run:
+| Step Name | Description | Input |
+|--------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------|
+| **Prompt** | Send a message to the AI model and receive a response. | Prompt text or template |
+| **Tool Call** | Execute an integrated tool or API. | Tool name and arguments |
+| **Evaluate** | Perform calculations or manipulate data. | Expressions or variables to evaluate |
+| **Wait for Input** | Pause workflow until input is received. | Any required user or system input |
+| **Log** | Log a specified value or message. | Message or value to log |
+| **Embed** | Embed text into a specific format or system. | Text or content to embed |
+| **Search** | Perform a document search based on a query. | Search query |
+| **Get** | Retrieve a value from a key-value store. | Key identifier |
+| **Set** | Assign a value to a key in a key-value store. | Key and value to assign |
+| **Parallel** | Run multiple steps in parallel. | List of steps to execute simultaneously |
+| **Foreach** | Iterate over a collection and perform steps for each item. | Collection or list to iterate over |
+| **MapReduce** | Map over a collection and reduce the results based on an expression. | Collection to map and reduce expressions |
+| **If Else** | Conditional execution of steps based on a condition. | Condition to evaluate |
+| **Switch** | Execute steps based on multiple conditions, similar to a switch-case statement. | Multiple conditions and corresponding steps |
+| **Yield** | Run a subworkflow and await its completion. | Subworkflow identifier and input data |
+| **Error** | Handle errors by specifying an error message. | Error message or handling instructions |
+| **Sleep** | Pause the workflow for a specified duration. | Duration (seconds, minutes, etc.) |
+| **Return** | Return a value from the workflow. | Value to return |
-```bash
-pip install julep
+For detailed information on each step type and advanced usage, please refer to our [Task Documentation](https://docs.julep.ai/tasks).
+
+## Advanced Features
+
+Julep offers a range of advanced features to enhance your AI workflows:
+
+### Adding Tools to Agents
+
+Extend your agent's capabilities by integrating external tools and APIs:
+
+```python
+client.agents.tools.create(
+ agent_id=agent.id,
+ name="web_search",
+ description="Search the web for information.",
+ integration={
+ "provider": "google",
+ "method": "search",
+ "setup": {"api_key": "your_google_api_key"},
+ },
+)
```
-For more information on using the Python SDK, please refer to the [Python SDK documentation](https://docs.julep.ai/api-reference/python-sdk-docs).
+### Managing Sessions and Users
-### TypeScript SDK
-To install the TypeScript SDK using `npm`, run:
+Julep provides robust session management for persistent interactions:
-```bash
-npm install @julep/sdk
+```python
+session = client.sessions.create(
+ agent_id=agent.id,
+ user_id="user123",
+ context_overflow="adaptive"
+)
+
+# Continue conversation in the same session
+response = client.sessions.chat(
+ session_id=session.id,
+ message="Follow up on our previous conversation."
+)
+```
+
+### Document Integration and Search
+
+Easily manage and search through documents for your agents:
+
+```python
+# Upload a document
+document = client.documents.create(
+ file="path/to/document.pdf",
+ metadata={"category": "research_paper"}
+)
+
+# Search documents
+results = client.documents.search(
+ query="AI advancements",
+ filter={"category": "research_paper"}
+)
```
-For more information on using the TypeScript SDK, please refer to the [TypeScript SDK documentation](https://docs.julep.ai/api-reference/js-sdk-docs).
+For more advanced features and detailed usage, please refer to our [Advanced Features Documentation](https://docs.julep.ai/advanced-features).
+
+## API Reference
+
+Explore our comprehensive API documentation to learn more about agents, tasks, and executions:
----
+- [Agents API](https://docs.julep.ai/api/agents)
+- [Tasks API](https://docs.julep.ai/api/tasks)
+- [Executions API](https://docs.julep.ai/api/executions)
-## Deployment
-Check out the [self-hosting guide](https://docs.julep.ai/agents/self-hosting) to host the platform yourself.
+## Examples and Tutorials
-If you want to deploy Julep to production, [let's hop on a call](https://cal.com/ishitaj/15min)!
+Discover example projects and tutorials to help you get started and build upon provided examples:
-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
+- [Example Projects](https://github.com/julep-ai/julep/tree/main/examples)
+- [Tutorials](https://docs.julep.ai/tutorials)
----
## Contributing
-We welcome contributions from the community to help improve and expand the Julep AI platform. Please see our [Contributing Guidelines](CONTRIBUTING.md) for more information on how to get started.
----
+We welcome contributions to the project! Learn how to contribute and our code of conduct:
+
+- [Contributing Guidelines](https://github.com/julep-ai/julep/blob/main/CONTRIBUTING.md)
+- [Code of Conduct](https://github.com/julep-ai/julep/blob/main/CODE_OF_CONDUCT.md)
+
+## Support and Community
+
+Join our community to get help, ask questions, and share your ideas:
+
+- [Discord](https://discord.com/invite/JTSBGRZrzj)
+- [GitHub Discussions](https://github.com/julep-ai/julep/discussions)
+- [Twitter](https://twitter.com/julep_ai)
+
## License
-Julep AI is released under the Apache 2.0 License. See the [LICENSE](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:
+This project is licensed under the [Apache License 2.0](https://github.com/julep-ai/julep/blob/main/LICENSE).
+
+## Acknowledgements
-- [Discord](https://discord.com/invite/JTSBGRZrzj): 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](https://twitter.com/julep_ai) & [LinkedIn](https://www.linkedin.com/company/julep-ai/)
-- [Hop on a call](https://cal.com/ishitaj/15min): We wanna know what you're building and how we can tweak and tune Julep to help you build your next AI app.
+We would like to express our gratitude to all contributors and the open-source community for their valuable resources and contributions.
\ No newline at end of file
diff --git a/example.py b/example.py
new file mode 100644
index 000000000..ef6d6f427
--- /dev/null
+++ b/example.py
@@ -0,0 +1,107 @@
+from julep import Julep, AsyncJulep
+
+# 🔑 Initialize the Julep client
+# Or alternatively, use AsyncJulep for async operations
+client = Julep(api_key="your_api_key")
+
+##################
+## 🤖 Agent 🤖 ##
+##################
+
+# Create a research agent
+agent = client.agents.create(
+ name="Research Agent",
+ about="You are a research agent designed to handle research inquiries.",
+ model="claude-3.5-sonnet",
+)
+
+# 🔍 Add a web search tool to the agent
+client.agents.tools.create(
+ agent_id=agent.id,
+ name="web_search", # Should be python valid variable name
+ description="Use this tool to research inquiries.",
+ integration={
+ "provider": "brave",
+ "method": "search",
+ "setup": {
+ "api_key": "your_brave_api_key",
+ },
+ },
+)
+
+#################
+## 💬 Chat 💬 ##
+#################
+
+# Start an interactive chat session with the agent
+session = client.sessions.create(
+ agent_id=agent.id,
+ context_overflow="adaptive", # 🧠 Julep will dynamically compute the context window if needed
+)
+
+# 🔄 Chat loop
+while (user_input := input("You: ")) != "exit":
+ response = client.sessions.chat(
+ session_id=session.id,
+ message=user_input,
+ )
+
+ print("Agent: ", response.choices[0].message.content)
+
+
+#################
+## 📋 Task 📋 ##
+#################
+
+# Create a recurring research task for the agent
+task = client.tasks.create(
+ agent_id=agent.id,
+ name="Research Task",
+ description="Research the given topic every 24 hours.",
+ #
+ # 🛠️ Task specific tools
+ tools=[
+ {
+ "name": "send_email",
+ "description": "Send an email to the user with the results.",
+ "api_call": {
+ "method": "post",
+ "url": "https://api.sendgrid.com/v3/mail/send",
+ "headers": {"Authorization": "Bearer YOUR_SENDGRID_API_KEY"},
+ },
+ }
+ ],
+ #
+ # 🔢 Task main steps
+ main=[
+ #
+ # Step 1: Research the topic
+ {
+ # `_` (underscore) variable refers to the previous step's output
+ # Here, it points to the topic input from the user
+ "prompt": "Look up topic '{{_.topic}}' and summarize the results.",
+ "tools": [{"ref": {"name": "web_search"}}], # 🔍 Use the web search tool from the agent
+ "unwrap": True,
+ },
+ #
+ # Step 2: Send email with research results
+ {
+ "tool": "send_email",
+ "arguments": {
+ "subject": "Research Results",
+ "body": "'Here are the research results for today: ' + _.content",
+ "to": "inputs[0].email", # Reference the email from the user's input
+ },
+ },
+ #
+ # Step 3: Wait for 24 hours before repeating
+ {"sleep": "24 * 60 * 60"},
+ ],
+)
+
+# 🚀 Start the recurring task
+client.executions.create(task_id=task.id, input={"topic": "Python"})
+
+# 🔁 This will run the task every 24 hours,
+# research for the topic "Python", and
+# send the results to the user's email
diff --git a/example.ts b/example.ts
new file mode 100644
index 000000000..3ef4e1a91
--- /dev/null
+++ b/example.ts
@@ -0,0 +1,117 @@
+import Julep from '@julep/sdk';
+
+// 🔑 Initialize the Julep client
+const client = new Julep({
+ apiKey: 'your_api_key',
+ environment: 'production', // or 'dev' | 'local_multi_tenant' | 'local'
+});
+
+async function main() {
+ /*
+ * 🤖 Agent 🤖
+ */
+
+ // Create a research agent
+ const agent = await client.agents.createOrUpdate('dad00000-0000-4000-a000-000000000000', {
+ name: 'Research Agent',
+ about: 'You are a research agent designed to handle research inquiries.',
+ model: 'claude-3.5-sonnet',
+ });
+
+ // 🔍 Add a web search tool to the agent
+ await client.agents.tools.create(agent.id, {
+ name: 'web_search',
+ description: 'Use this tool to research inquiries.',
+ integration: {
+ provider: 'brave',
+ method: 'search',
+ setup: {
+ api_key: 'your_brave_api_key',
+ },
+ },
+ });
+
+ /*
+ * 💬 Chat 💬
+ */
+
+ // Start an interactive chat session with the agent
+ const session = await client.sessions.create({
+ agentId: agent.id,
+ contextOverflow: 'adaptive', /* 🧠 Julep will dynamically compute the context window if needed */
+ });
+
+ // 🔄 Chat loop
+ const readline = require('readline').createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ });
+
+ const askQuestion = (query: string) => new Promise((resolve) => readline.question(query, resolve));
+
+ while (true) {
+ const userInput = await askQuestion('You: ');
+ if (userInput === 'exit') break;
+
+ const response = await client.sessions.chat(session.id, {
+ message: userInput,
+ });
+
+ console.log('Agent: ', response.choices[0].message.content);
+ }
+
+ readline.close();
+
+ /*
+ * 📋 Task 📋
+ */
+
+ // Create a recurring research task for the agent
+ const task = await client.tasks.create(agent.id, {
+ name: 'Research Task',
+ description: 'Research the given topic every 24 hours.',
+ /* 🛠️ Task specific tools */
+ tools: [
+ {
+ name: 'send_email',
+ description: 'Send an email to the user with the results.',
+ apiCall: {
+ method: 'post',
+ url: 'https://api.sendgrid.com/v3/mail/send',
+ headers: { Authorization: 'Bearer YOUR_SENDGRID_API_KEY' },
+ },
+ },
+ ],
+ /* 🔢 Task main steps */
+ main: [
+ // Step 1: Research the topic
+ {
+ prompt: "Look up topic '{{_.topic}}' and summarize the results.",
+ tools: [{ ref: { name: 'web_search' } }], /* 🔍 Use the web search tool from the agent */
+ unwrap: true,
+ },
+ // Step 2: Send email with research results
+ {
+ tool: 'send_email',
+ arguments: {
+ subject: 'Research Results',
+ body: "'Here are the research results for today: ' + _.content",
+ to: 'inputs[0].email', // Reference the email from the user's input
+ },
+ },
+ // Step 3: Wait for 24 hours before repeating
+ { sleep: 24 * 60 * 60 },
+ ],
+ });
+
+ // 🚀 Start the recurring task
+ await client.executions.create(task.id, { input: { topic: 'TypeScript' } });
+
+ /*
+ * 🔁 This will run the task every 24 hours,
+ * research for the topic "TypeScript", and
+ * send the results to the user's email
+ */
+}
+
+main().catch(console.error);
\ No newline at end of file
diff --git a/image.png b/image.png
deleted file mode 100644
index ccb8756cb1901d931b9fd98af0af4419b2b0dfc7..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 426141
zcmaHT2RxR2`+kX%mPAry6v-@#O0rTJWfK_