Skip to main content

Cloudbase Agent Python SDK - Dify framework integration

Project description

cloudbase-agent-dify

Cloudbase Agent Python SDK - Dify framework integration

This package provides Dify-specific agent implementations for Cloudbase Agent, enabling seamless integration with Dify platform's chat API.

Installation

pip install -e .

Usage

See examples in python-sdk/examples/dify/ for usage examples.

Configuration

Set the following environment variables:

  • DIFY_API_KEY: Dify API key (required)
  • DIFY_API_BASE: Dify API base URL (optional, defaults to https://api.dify.ai/v1)

Implementation Details

This adapter uses direct HTTP requests via httpx instead of relying on third-party SDKs:

  • Why direct HTTP? The official dify-client package on PyPI hasn't been updated since 2023 and may be outdated
  • Benefits: Full control over API calls, easier to maintain, no dependency on potentially outdated SDKs
  • API Reference: Implementation follows the official Dify API documentation: https://docs.dify.ai/api-reference/chat/send-chat-message

Features

  • Strict mode: Only user role messages are accepted in a single request (prevents semantic inconsistencies)
  • Automatic conversation management: Uses conversation_id from Dify responses as thread_id
  • Intelligent retry: Automatically retries once without conversation_id if format error occurs
  • Streaming & Blocking: Support for both streaming (SSE) and blocking response modes
  • Tool call mapping: Complete support for Dify Agent mode tool calls via agent_thought events

Project details


Download files

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

Source Distribution

cloudbase_agent_dify-0.1.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

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

cloudbase_agent_dify-0.1.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file cloudbase_agent_dify-0.1.1.tar.gz.

File metadata

  • Download URL: cloudbase_agent_dify-0.1.1.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for cloudbase_agent_dify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 328370e489483a9a2c241f7d57c2b3849f5ea696d6fc61dab0dc54608a08c928
MD5 d1aeb33b2f2d5b10350c7f0a4e5bf36e
BLAKE2b-256 3001603a2f59f151958401004ca6a3d5a106b6b0c7a87b939eacc0b0c3803aa5

See more details on using hashes here.

File details

Details for the file cloudbase_agent_dify-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cloudbase_agent_dify-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07251dfa99a81269a6e4c8c0d9344a0727f0bcfdb31c4456ce61d2956dc4e30a
MD5 19b4195f78020c140b843cab53a2af58
BLAKE2b-256 9d6262f5de3d2c575113cfc36315d9d557ae8655ce81e9aa36ef3b5641926fc1

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