Skip to main content

License PRs Welcome Downloads PyPI version Twitter

TaskflowAI: Task-Centric Framework for LLM-Driven Pipelines and Multi-Agent Teams

TaskflowAI is a lightweight, intuitive, and flexible framework for creating AI-driven task pipelines and multi-agent teams. Centered around the concept of Tasks, rather than conversation patterns, it enables the design and orchestration of autonomous workflows while balancing flexibility and reliability.

Key Features

🧠 Task-centric design aligning closely with real-world operational processes

🧩 Modular architecture for easy building, extension, and integration

🌐 Flexible workflows allow you to design everything from deterministic pipelines to autonomous multi-agent teams

📈 The frameworks complexity floor starts low from simple deterministic pipelines and scales to complex multi-agent teams

💬 Support for hundreds of language models (OpenAI, Anthropic, OpenRouter, Groq, and local models with Ollama.)

🛠️ Comprehensive and extendable toolset for web interaction, file operations, embeddings generation, and more

🔍 Transparency through detailed logging and state exposure

⚡️ Lightweight core with minimal dependencies

Installation

Install TaskflowAI using pip:

pip install taskflowai

Quick Start

Here's a simple example to get you started:

from taskflowai import Agent, Task, OpenaiModels, WebTools, set_verbosity

set_verbosity(1)

research_agent = Agent(
    role="research assistant",
    goal="answer user queries",
    llm=OpenaiModels.gpt_4o,
    tools={WebTools.exa_search}
)

def research_task(topic):
    return Task.create(
        agent=research_agent,
        instruction=f"Use your exa search tool to research {topic} and explain it in a way that is easy to understand.",
    )

result = research_task("quantum computing")
print(result)

Core Components

Tasks: Discrete units of work

Agents: Personas that perform tasks and can be assigned tools

Tools: Wrappers around external services or specific functionalities

Language Model Interfaces: Consistent interface for various LLM providers

Supported Language Models and Providers

TaskflowAI supports a wide range of language models from a number of providers:

OpenAI

GPT-4 Turbo, GPT-3.5 Turbo, GPT-4, GPT-4o, GPT-4o Mini, & more

Anthropic

Claude 3 Haiku, Claude 3 Sonnet, Claude 3 Opus, Claude 3.5 Sonnet, & more

Openrouter

GPT-4 Turbo, Claude 3 Opus, Mixtral 8x7B, Llama 3.1 405B, & more

Ollama

Mistral, Mixtral, Llama 3.1, Qwen, Gemma, & more

Groq

Mixtral 8x7B, Llama 3, Llama 3.1, Gemma, & more

Each provider is accessible through a dedicated class (e.g., OpenaiModels, AnthropicModels, etc.) with methods corresponding to specific models. This structure allows for painless switching between models and providers, enabling users to leverage the most suitable LLM for their tasks.

Tools

TaskflowAI comes with a set of built-in tools that provide a wide range of functionalities, skills, actions, and knowledge for your agents to use in their task completion.

  • WebTools: For web scraping, searches, and data retrieval with Serper, Exa, WeatherAPI, etc.
  • FileTools: Handling various file operations like reading CSV, JSON, and XML files.
  • GitHubTools: Interacting with GitHub repositories, including listing contributors and fetching repository contents.
  • CalculatorTools: Performing date and time calculations.
  • EmbeddingsTools: Generating embeddings for text.
  • WikipediaTools: Searching and retrieving information from Wikipedia.
  • AmadeusTools: Searching for flight information.
  • LangchainTools: A wrapper for integrating Langchain tools to allow agents to use tools in the Langchain catalog.
  • Custom Tools: You can also create your own custom tools to add any functionality you need.

Multi-Agent Teams

TaskflowAI allows you to create multi-agent teams that can use tools to complete a series of tasks. Here's an example of a travel planning agent that uses multiple agents to research and plan a trip:

from taskflowai import Agent, Task, WebTools, WikipediaTools, AmadeusTools, OpenaiModels, OpenrouterModels, set_verbosity

set_verbosity(1)

web_research_agent = Agent(
    role="web research agent",
    goal="search the web thoroughly for travel information",
    attributes="hardworking, diligent, thorough, comphrehensive.",
    llm=OpenrouterModels.haiku,
    tools={WebTools.serper_search, WikipediaTools.search_articles, WikipediaTools.search_images}
)

travel_agent = Agent(
    role="travel agent",
    goal="assist the traveller with their request",
    attributes="friendly, hardworking, and comprehensive and extensive in reporting back to users",
    llm=OpenrouterModels.haiku,
    tools={AmadeusTools.search_flights}
)

def research_destination(destination, interests):
    destination_report = Task.create(
        agent=web_research_agent,
        context=f"User Destination: {destination}\nUser Interests: {interests}",
        instruction=f"Use your tools to search relevant information about the given destination: {destination}. Use your serper web search tool to research information about the destination to write a comprehensive report. Use wikipedia tools to search the destination's wikipedia page, as well as images of the destination. In your final answer you should write a comprehensive report about the destination with images embedded in markdown."
    )
    return destination_report

def research_events(destination, dates, interests):
    events_report = Task.create(
        agent=web_research_agent,
        context=f"User's intended destination: {destination}\n\nUser's intended dates of travel: {dates}\nUser Interests: {interests}",
        instruction="Use your tools to research events in the given location for the given date span. Ensure your report is a comprehensive report on events in the area for that time period."
    )
    return events_report

def search_flights(current_location, destination, dates):
    flight_report = Task.create(
        agent=travel_agent,
        context=f"Current Location: {current_location}\n\nDestination: {destination}\nDate Range: {dates}",
        instruction=f"Search for a lot of flights in the given date range to collect a bunch of options and return a report on the best options in your opinion, based on convenience and lowest price."
    )
    return flight_report

def write_travel_report(destination_report, events_report, flight_report):
    travel_report = Task.create(
        agent=travel_agent,
        context=f"Destination Report: {destination_report}\n--------\n\nEvents Report: {events_report}\n--------\n\nFlight Report: {flight_report}",
        instruction=f"Write a comprehensive travel plan and report given the information above. Ensure your report conveys all the detail in the given information, from flight options, to events, and image urls, etc. Preserve detail and write your report in extensive length."
    )
    return travel_report

def main():
    current_location = input("Where are you traveling from?\n")
    destination = input("Where are you travelling to?\n")
    dates = input("What are the dates for your trip?\n")
    interests= input("Do you have any particular interests?\n")

    destination_report = research_destination(web_research_agent, destination, interests)
    print(destination_report)

    events_report = research_events(web_research_agent, destination, dates, interests)
    print(events_report)

    flight_report = search_flights(travel_agent, current_location, destination, dates)
    print(flight_report)

    final_report = write_travel_report(travel_agent, destination_report, events_report, flight_report)
    print(final_report)

if __name__ == "__main__":
    main()

By combining agents, tasks, tools, and language models, you can create a wide range of workflows, from simple pipelines to complex multi-agent teams.

Documentation

For more detailed information, tutorials, and advanced usage, visit our documentation.

Contributing

TaskflowAI depends on and welcomes community contributions! Please review contribution guidelines and submit a pull request if you'd like to contribute.

License

TaskflowAI is released under the Apache License 2.0. See the LICENSE file for details.

Support

For issues or questions, please file an issue on our GitHub repository.

⭐️ If you find TaskflowAI helpful, please consider giving it a star!

Happy building!

Metadata

Release files for taskflowai 0.5.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taskflowai 0.5.13
File Size Uploaded
taskflowai-0.5.13.tar.gz 64.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taskflowai 0.5.13
File Interpreter ABI Platform
taskflowai-0.5.13-py3-none-any.whl Python 3 none any Details

Total release size: 137.8 kB

Release files / taskflowai-0.5.13.tar.gz

Download URL taskflowai-0.5.13.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
38cb742c36afae20383e0b83194b332bac3045289a6981d01cc046e2a563f199
BLAKE2b-256 checksum
How to use checksums
abc887d2f919a972be84262c72dbb674a73485abe67ec5a08533c0a4f2545f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release files / taskflowai-0.5.13-py3-none-any.whl

Download URL taskflowai-0.5.13-py3-none-any.whl
Size 73.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31777468ed3796c1453bbe625ce6d9d15c46f8da5767e19eaa55291b76eef3a4
BLAKE2b-256 checksum
How to use checksums
a429f1aa81e63180bc5e4fcb591d6a1a4b61f05548c39dd83740600eea255282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.5.13 This release

2 release files

0.5.12

2 release files

0.5.11

2 release files

0.5.10

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page