Skip to main content

A flow language for botrun

Project description

botrun_flow_lang v1.0

開發環境安裝

  • 使用 Python 3.11.9
  • 安裝 uv 來管理 python 套件
    • 安裝 uv 可以參考: 官方文件
    • 第一次使用在 /project_folder/ 下執行
    uv sync
    
    • 之後如果需要新增/刪除套件,需要執行 uv add xxx , uv remove xxx

要進行本地端 fastapi 的開發

uvicorn botrun_flow_lang.main:app --reload --host 0.0.0.0 --port 8080
  • 可以執行的 curl,可以參考 botrun_flow_lang/tests/api_functional_tests.py

開發規範

  • 修改 CHANGELOG.md
  • release 修改 pyproject.toml

(備份用)如果要進行 agent 的開發

  • 安裝 langgraph cli
  • uncomment botrun_flow_lang/langgraph_agents/agents/langgraph_react_agent.py 的最後面幾行
  • 在 project 目錄下執行 langgraph dev

以下是部署參考用,先保留

部署時會輸出可用的 requirements.txt

uv export --format requirements-txt --output-file requirements.txt --no-hashes

建立 firestore 的 index (以下以 dev 為例),實際部署的程式寫在 botrun_chat_deploy

gcloud firestore indexes composite create \
  --collection-group=botrun-hatch-dev-hatch \
  --field-config=field-path=user_id,order=ascending \
  --field-config=field-path=name,order=ascending \
  --field-config=field-path=__name__,order=ascending \
  --project=scoop-386004

# 為AsyncFirestoreCheckpointer建立索引
gcloud firestore indexes composite create \
  --collection-group=botrun-flow-lang-dev-checkpointer \
  --field-config=field-path=checkpoint_ns,order=ascending \
  --field-config=field-path=thread_id,order=ascending \
  --field-config=field-path=timestamp,order=descending \
  --field-config=field-path=__name__,order=descending \
  --project=scoop-386004

打包 dev

gcloud builds submit --config cloudbuild_fastapi_dev.yaml --project=scoop-386004

deploy cloud run, dev 的版本

gcloud run deploy botrun-flow-lang-fastapi-dev \
  --image asia-east1-docker.pkg.dev/scoop-386004/botrun-flow-lang/botrun-flow-lang-fastapi-dev \
  --port 8080 \
  --platform managed \
  --allow-unauthenticated \
  --project=scoop-386004 \
  --region=asia-east1 \
  --cpu 2 \
  --memory 8Gi \
  --min-instances 0 \
  --max-instances 5 \
  --timeout 3600s \
  --concurrency 300 \
  --cpu-boost \

建立 staging 的 index

gcloud firestore indexes composite create \
  --collection-group=botrun-hatch-hatch \
  --field-config=field-path=user_id,order=ascending \
  --field-config=field-path=name,order=ascending \
  --field-config=field-path=__name__,order=ascending \
  --project=scoop-386004

打包 Cloud Run, staging 的版本

gcloud builds submit --config cloudbuild_fastapi.yaml --project=scoop-386004

佈署 cloud run, staging 的版本

gcloud run deploy botrun-flow-lang-fastapi \
  --image asia-east1-docker.pkg.dev/scoop-386004/botrun-flow-lang/botrun-flow-lang-fastapi \
  --port 8080 \
  --platform managed \
  --allow-unauthenticated \
  --project=scoop-386004 \
  --region=asia-east1 \
  --cpu 2 \
  --memory 8Gi \
  --min-instances 0 \
  --max-instances 5 \
  --timeout 3600s \
  --concurrency 300 \
  --cpu-boost \

為了要減少冷啟動的時間,每十分鐘呼叫一次 heartbeat (為了省錢已移除,目前留著備份)

gcloud scheduler jobs create http botrun-flow-lang-heartbeat-job-$ENV \
  --schedule "*/10 * * * *" \
  --time-zone "Asia/Taipei" \
  --uri "https://botrun-flow-lang-fastapi-$ENV-36186877499.asia-east1.run.app/heartbeat" \
  --http-method GET \
  --location "asia-east1" \
  --project "scoop-386004"

測試 scheduler

gcloud scheduler jobs run botrun-flow-lang-heartbeat-job-$ENV --location "asia-east1" --project "scoop-386004"

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

botrun_flow_lang-6.2.61.tar.gz (34.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

botrun_flow_lang-6.2.61-py3-none-any.whl (253.8 kB view details)

Uploaded Python 3

File details

Details for the file botrun_flow_lang-6.2.61.tar.gz.

File metadata

  • Download URL: botrun_flow_lang-6.2.61.tar.gz
  • Upload date:
  • Size: 34.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.1

File hashes

Hashes for botrun_flow_lang-6.2.61.tar.gz
Algorithm Hash digest
SHA256 fbbe1f1f90d5d5503da2fbe604d6ef62b22b7a113d157d7be540d1e3c27e2221
MD5 f6583dbefdc570bcdb8ea2ceddf95b86
BLAKE2b-256 572bb7f6ef617b96d93dc1e2b8b20bf867093cc6ed9bca421d443bbafb195050

See more details on using hashes here.

File details

Details for the file botrun_flow_lang-6.2.61-py3-none-any.whl.

File metadata

File hashes

Hashes for botrun_flow_lang-6.2.61-py3-none-any.whl
Algorithm Hash digest
SHA256 9f4910296e9e88d772243eabfda542a8c9d34956c0a16a96958ace97c0f83a55
MD5 46a1076b8db0359866d74f0b3cea3bb9
BLAKE2b-256 2635e9f9c09f5f4b4becfdf41f31918da7741db3b60d1211472096d097fa5c1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page