What’s new in Conductor Python SDK?

rizafarheen

Riza Farheen

Posted on February 12, 2024

What’s new in Conductor Python SDK?

The Conductor Python SDK has undergone a major update, including new feature additions. 🎉

If you want to try it out quickly, pip install with the following:

python3 -m pip install conductor-python
Enter fullscreen mode Exit fullscreen mode

The SDK needs Python 3.9+ to work with.

Here’s the quick link to Python SDK - https://github.com/conductor-sdk/conductor-python.

If you are curious to explore the new enhancements in the Python SDK, read on!

Key Highlights

Support for AI Orchestration with language models, prompt templates and vector databases

Recently, we introduced support for building Gen AI applications by integrating with popular AI/LLM models and vector databases, & prompt templates to work with Orkes AI Agents. These features are now available in Conductor Python SDK.

Check out the AI SDKs here.

For example, here’s a snippet from an AI example:

@worker_task(task_definition_name='get_friends_name')
def get_friend_name():
    name = os.getlogin()
    if name is None:
        return 'anonymous'
    else:
        return name


def start_workers(api_config):
    task_handler = TaskHandler(
        workers=[],
        configuration=api_config,
        scan_for_annotated_workers=True,
    )
    task_handler.start_processes()
    return task_handler
Enter fullscreen mode Exit fullscreen mode

Get the complete code here.

We currently support integrations with LLM providers such as OpenAI, Azure OpenAI, Vertex AI & Hugging Face, and vector DB’s such as Pinecone & Weaviate.

This is just the beginning. Orkes team is working on adding integrations with more LLM providers & vector DBs. So, keep an eye out for our upcoming announcements.

Improved way to create dynamic workflows in Python

By using the improved ConductorWorkflow class and its associated methods, you can easily create complex workflows for specific use cases, enhancing the scalability of Python-based automation projects.

from conductor.client.worker.worker_task import worker_task


@worker_task(task_definition_name='get_user_email')
def get_user_email(userid: str) -> str:
    return f'{userid}@example.com'


@worker_task(task_definition_name='send_email')
def send_email(email: str, subject: str, body: str):
    print(f'sending email to {email} with subject {subject} and body {body}')
Enter fullscreen mode Exit fullscreen mode

Get the complete code here.

Support to Unit Test Workflows & Replay Workflows

Introduced support for unit testing workflows, ensuring reliability and robustness throughout the development process and enhancing the SDK's quality and stability.

Also, enabled the ability to replay workflows, facilitating debugging, analysis, and optimization, providing you with greater visibility and control over the workflows.

Check out here.

Quality of Life Improvements

We have incorporated numerous quality-of-life improvements, such as dedicated clients for various resource types, worker configuration flexibility, enhanced documentation, performance optimizations, and out-of-box examples, enhancing the overall developer experience.

Out-of-Box Examples

We have made it easier by adding many ready to use examples, which you can test here.👇

Python SDK Examples

Try it out & feel free to contribute more to Conductor OSS.

Get Started with Python SDK

If you want to get started with Python SDK, check out these steps:

  1. Install SDK - Create a virtual environment to build your package:
virtualenv conductor
source conductor/bin/activate
Enter fullscreen mode Exit fullscreen mode
  1. Get Conductor Python SDK - If you want to try it out quickly, pip install with the following:
python3 -m pip install conductor-python
Enter fullscreen mode Exit fullscreen mode

The SDK needs Python 3.9+ to work with.

  1. Setup SDK - Point the SDK to the Conductor Server API endpoint.
export CONDUCTOR_SERVER_URL=http://localhost:8080/api
Enter fullscreen mode Exit fullscreen mode

(Optionally) If you are using a Conductor server that requires authentication. Obtain the key and secret from the conductor server.

export CONDUCTOR_AUTH_KEY=your_key
export CONDUCTOR_AUTH_SECRET=your_key_secret
Enter fullscreen mode Exit fullscreen mode
  1. Start Conductor Server
docker run --init -p 8080:8080 -p 5000:5000 conductoross/conductor-standalone:3.15.0
Enter fullscreen mode Exit fullscreen mode

After starting the server navigate to http://localhost:5000 to ensure the server has started successfully.

Happy Coding! 🎉

Meanwhile, don’t forget to follow the Conductor OSS - the open-source project & support us by giving a ⭐.

Join our community Slack if you have any queries.

💖 💪 🙅 🚩
rizafarheen
Riza Farheen

Posted on February 12, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What’s new in Conductor Python SDK?
microservices What’s new in Conductor Python SDK?

February 12, 2024