Last translated: 17 Jun 2025

Translation Not Available Yet

This repository's README hasn't been translated yet. Once translated, it will be easier to read and understand in your native language (中文).

After translating, add the links to README so others can view it directly.

julep

Get API Key   Documentation

NPM Version   PyPI - Version   Docker Image Version   GitHub License

Discord · 𝕏 · LinkedIn

面向数据与机器学习团队的无服务器AI工作流平台

🎉 重磅发布:Julep开放响应API(Alpha版)

我们激动地宣布开放响应API正式发布!该API提供以下特性:

  1. OpenAI兼容接口 - 可直接替换现有代码
  2. 自托管开源实现 - 支持任意LLM后端
  3. 模型供应商无关 - 可连接OpenAI、Anthropic等任何LLM供应商

开放响应API让您轻松集成现有应用,同时获得强大的新功能。

立即体验?查看我们的开放响应API文档开始使用!

Julep是一个无服务器平台,帮助数据和ML团队构建复杂AI工作流。它提供了编排AI操作、管理交互状态以及与现有数据基础设施集成的强大基础。

无论您要构建数据管道还是AI工作流,Julep都能让您轻松组合和扩展基于LLM的工作流,无需管理基础设施。想象构建一个不仅能回答简单问题,还能处理复杂任务、记忆历史交互甚至调用其他工具的AI代理——这正是Julep的用武之地。我们负责底层繁重工作,让您专注于业务智能解决方案。

💡 了解更多请访问**文档中心**。

📖 目录


✨ 核心特性

🧠智能记忆能记忆上下文并从历史交互中学习的智能体
🔄工作流引擎构建带分支和循环的复杂多步骤流程
并行处理同时执行多个操作实现最高效率
🛠️工具集成无缝连接外部API和服务
🔌简易设置通过Python和Node.js SDK快速入门
🔒可靠安全内置错误处理、重试机制和安全特性
📊监控系统实时追踪任务进度和性能

💡 了解更多请访问**文档中心**。


🧠 设计理念

Julep由以下组件构成:

  • Julep平台:运行工作流的云服务,包含工作流描述语言、执行服务器及平台交互SDK
  • Julep SDK:构建工作流的开发库,支持Python和JavaScript
  • Julep CLI:通过终端直接与平台交互的命令行工具
  • Julep API:与平台交互的RESTful API

将Julep视为结合客户端与服务端组件的高级AI代理构建平台:

  1. 应用代码层

    • 使用SDK定义代理、任务和工作流
    • 通过CLI直接管理平台资源
  2. Julep后端服务

    • SDK通过网络与后端通信
    • 后端处理任务执行、会话状态维护和工作流编排
  3. 工具集成层

    • 在工作流中集成外部工具和服务
    • 支持网络搜索、数据库访问和第三方API调用


📦 安装指南

🛠️ Julep SDK

通过npmpip安装:

Node.js

  npm install @julep/sdk

  # or

  bun add @julep/sdk

Python

  pip install julep

[!注意] 🔑 获取API密钥请访问控制台

加入Discord了解更多。

🛠️ Julep命令行工具

Julep CLI是通过终端直接管理AI工作流、任务和代理的命令行工具,无需编写代码即可操作平台资源。

pip install julep-cli

详情参见**CLI文档**。

[!注意] CLI目前处于Beta阶段,仅支持Python,Node.js版本即将推出!


🚀 快速开始

设想一个能实现以下功能的研究型AI代理:

  1. 接收主题
  2. 生成30个相关搜索查询
  3. 并行执行网络搜索
  4. 汇总搜索结果
  5. 摘要发送至Discord

[!注意] 在Julep中,这仅需80行代码即可实现,且能全自动托管运行。所有步骤均在Julep服务器执行,无需人工干预。

完整任务定义示例:

# yaml-language-server: $schema=https://raw.githubusercontent.com/julep-ai/julep/refs/heads/dev/schemas/create_task_request.json
name: Research Agent
description: A research assistant that can search the web and send the summary to Discord
########################################################
####################### INPUT ##########################
########################################################

# Define the input schema for the task
input_schema:
  type: object
  properties:
    topic:
      type: string
      description: The main topic to research
    num_questions:
      type: integer
      description: The number of search queries to generate

########################################################
####################### TOOLS ##########################
########################################################

# Define the tools that the agent can use
tools:
  - name: web_search
    type: integration
    integration:
      provider: brave
      setup:
        api_key: "<your-brave-api-key>"

  - name: discord_webhook
    type: api_call
    api_call:
      url: https://discord.com/api/webhooks/<your-webhook-id>/<your-webhook-token>
      method: POST
      headers:
        Content-Type: application/json

########################################################
####################### MAIN WORKFLOW #################
########################################################

# Special variables:
# - steps[index].input: for accessing the input to the step at that index
# - steps[index].output: for accessing the output of the step at that index
# - _: for accessing the output of the previous step

# Define the main workflow
main:
# Step 0: Generate search queries
- prompt:
    - role: system
      content: >-
        $ f"""
        You are a research assistant.
        Generate {{steps[0].input.num_questions|default(30, true)}} diverse search queries related to the topic:
        {steps[0].input.topic}

        Write one query per line.
        """
  unwrap: true

# Step 1: Evaluate the search queries using a simple python expression
- evaluate:
    search_queries: $ _.split(NEWLINE)

# Step 2: Run the web search in parallel for each query
- over: $ _.search_queries
  map:
    tool: web_search
    arguments:
      query: $ _
  parallelism: 5

# Step 3: Collect the results from the web search
- evaluate:
    search_results: $ _

# Step 4: Summarize the results
- prompt:
    - role: system
      content: >
        $ f"""
        You are a research summarizer. Create a comprehensive summary of the following research results on the topic {steps[0].input.topic}.
        The summary should be well-structured, informative, and highlight key findings and insights. Keep the summary concise and to the point.
        The length of the summary should be less than 150 words.
        Here are the search results:
        {_.search_results}
        """
  unwrap: true
  settings:
    model: gpt-4o-mini

# Step 5: Send the summary to Discord
- evaluate:
    discord_message: |-
      $ f'''
      **Research Summary for {steps[0].input.topic}**
      {_}
      '''

# Step 6: Send the summary to Discord
- tool: discord_webhook
  arguments:
    json_: 
      content: $ _.discord_message[:2000] # Discord has a 2000 character limit

使用Julep SDK执行工作流:

Python (点击展开)
from julep import Client
import yaml
import time

# Initialize the client
client = Client(api_key=JULEP_API_KEY)

# Create the agent
agent = client.agents.create(
  name="Julep Browser Use Agent",
  description="A Julep agent that can use the computer tool to interact with the browser.",
)

# Load the task definition
with open('./research_agent.yaml', 'r') as file:
  task_definition = yaml.safe_load(file)

# Create the task
task = client.tasks.create(
  agent_id=agent.id,
  **task_definition
)

# Create the execution
execution = client.executions.create(
    task_id=task.id,
    input={
        "topic": "artificial intelligence",
        "num_questions": 30
    }
)

# Wait for the execution to complete
while (result := client.executions.get(execution.id)).status not in ['succeeded', 'failed']:
    print(result.status)
    time.sleep(1)

# Print the result
if result.status == "succeeded":
    print(result.output)
else:
    print(f"Error: {result.error}")


Node.js (点击展开)
import { Julep } from '@julep/sdk';
import yaml from 'yaml';
import fs from 'fs';

// Initialize the client
const client = new Julep({
  apiKey: 'your_julep_api_key'
});

// Create the agent
const agent = await client.agents.create({
  name: "Julep Browser Use Agent",
  description: "A Julep agent that can use the computer tool to interact with the browser.",
});

// Parse the task definition
const taskDefinition = yaml.parse(fs.readFileSync('./research_agent.yaml', 'utf8'));

// Create the task
const task = await client.tasks.create(
  agent.id,
  taskDefinition
);

// Create the execution
const execution = await client.executions.create(
  task.id,
  {
    input: { 
      "topic": "artificial intelligence",
      "num_questions": 30
    }
  }
);

// 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));
}

// Print the result
if (result.status === 'succeeded') {
  console.log(result.output);
} else {
  console.error(`Error: ${result.error}`);
}

此示例中,Julep将自动管理并行执行、失败重试、API请求重发,确保任务可靠运行至完成。

执行时间不超过30秒,返回如下结果:

AI研究摘要 (点击展开)

AI研究摘要

人工智能(AI)研究结果综述

引言

近年来人工智能领域取得重大进展,机器感知环境、数据学习和决策制定等技术快速发展。本摘要聚焦AI相关研究的核心发现。

关键发现

  1. AI定义与范畴
    • AI是计算机科学分支,致力于创建具备类人智能的系统(维基百科)
    • 涵盖机器学习、自然语言处理、机器人学等子领域
  2. 影响与应用
    • AI技术正融入多个领域提升效率,包括自动驾驶、医疗诊断和金融服务(OpenAI)
    • Google致力于通过AI改善用户体验(Google AI)
  3. 伦理考量
    • 需建立确保AI安全可靠使用的伦理框架(OpenAI)
  4. 学习机制
    • 监督学习、无监督学习和强化学习等机制(维基百科)
    • 监督学习依赖标注数据,无监督学习自主识别模式(Unsupervised)
  5. 未来方向
    • 提升AI系统可解释性和透明度(OpenAI)
    • 推动AI普及化和易用性(Google AI)

结论

AI正重塑多个行业,但需同步解决伦理和社会影响问题。技术专家、伦理学家和政策制定者的持续合作至关重要。

下一步

[!提示] 💡 查看文档中的教程章节

💡 新手建议从快速入门开始

💡 更多创意请访问仓库的创意集

💡 实践案例请查看示例库


🔍 参考文档

📚 SDK参考

🛠️ API参考

查看代理、任务、工具和CLI的完整API文档:API参考


💻 本地部署

1. 克隆仓库

从以下地址克隆仓库:

git clone <repository_url>

2. 进入项目根目录

切换到项目根目录:

cd <repository_root>

3. 配置环境变量

  • 在根目录创建.env文件
  • 参考.env.example设置必要变量

4. 创建Docker备份卷

创建名为grafana_datamemory_store_datatemporal-db-dataprometheus_dataseaweedfs_data的Docker卷:

docker volume create grafana_data
docker volume create memory_store_data
docker volume create temporal-db-data
docker volume create prometheus_data
docker volume create seaweedfs_data

5. 使用Docker Compose运行项目

支持单租户多租户两种模式:

  1. 单租户模式

执行以下命令:

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

注意:单租户模式下可直接使用SDK,无需API密钥。

  1. 多租户模式

执行以下命令:

docker compose --env-file .env --profile temporal-ui --profile multi-tenant --profile embedding-cpu --profile self-hosted-db --profile blob-store --profile temporal-ui-public up --force-recreate --build --watch

注意:多租户模式下需生成JWT令牌作为API密钥。

生成JWT令牌(仅多租户模式)

安装jwt-cli后执行(替换.env中的JWT_SHARED_KEY):

jwt encode --secret JWT_SHARED_KEY --alg HS512 --exp=$(date -d '+10 days' +%s) --sub '00000000-0000-0000-0000-000000000000' '{}'

此令牌有效期为10天。

6. 交互操作

  • Temporal UI:通过.env指定端口访问
  • Julep SDK:通过Python/Node.js库与API交互
from julep import Client

client = Client(api_key="your_jwt_token")

注意:多租户模式需设置环境为local_multi_tenant并使用JWT令牌,单租户模式设为local且无需密钥。

7. 故障排查

  • 确保所有Docker镜像可用
  • 检查.env变量配置
  • 使用docker compose logs查看详细日志

👥 贡献者

加入社区!🌟

我们诚邀贡献者参与Julep项目!准备了若干"good first issues"供新手入门。

贡献指南:

  1. 📖 阅读贡献指南
  2. 🔍 查看新手任务
  3. 💬 加入Discord讨论

无论贡献大小,我们都深表感谢。让我们携手打造卓越产品!🚀

杰出贡献者:


📄 许可证

Julep 采用 Apache License 2.0 许可证授权。

更多详情请参阅 LICENSE 文件。