Skip to main content

Combine multiple function-based agents with dynamic routing - based on atomic-agents.

Project description

gpt-multi-atomic-agents

A simple dynamic multi-agent framework based on atomic-agents and Instructor. Uses the power of Pydantic for data and schema validation and serialization.

  • compose Agents made of Functions
  • a router uses an LLM to process complex 'composite' user prompts, and automatically route them to the best sequence of your agents
    • the router rerites the user prompt, to best suit each agent
  • generate via OpenAI or AWS Bedrock or groq

MIT License Supported Python Versions gpt-multi-atomic-agents

PyPI Releases PyPI - Downloads

ko-fi

Introduction

This is an LLM based Agents Framework using an Agent Oriented Programming approach to orchestrate agents using a shared Function Calling language.

The framework is generic and allows agents to be defined in terms of a name, description, accepted input function calls, and allowed output function calls.

The agents communicate indirectly using a blackboard. The language is a composed of the function calls: each agent specifies what functions it understands as input, and what function calls it is able to generate. In this way, the agents can understand each other's output.

A router takes the user prompt and selects the best sequence of the most suitable agents, to handle the user prompt. The router rewrites the user prompt to suit each agent, which improves quality and avoids unwanted output.

Finally, the output is returned in the form of an ordered list of function calls.

When integrating, the client would implement the functions. The client executes the functions according to the results from this framework.

Examples

SimLife world builder

This is a demo 'Sim Life' world builder. It uses 3 agents (Creature Creature, Vegetation Creator, Relationship Creator) to process user prompts. The output is a series of Function Calls which can be implemented by the client, to build the Sim Life world.

INPUT:

Add a sheep that eats grass

OUTPUT:

Generated 3 function calls
[Agent: Creature Creator] AddCreature( creature_name=sheep, icon_name=sheep-icon, land_type=prairie, age=1 )
[Agent: Plant Creator] AddPlant( plant_name=grass, icon_name=grass-icon, land_type=prairie )
[Agent: Relationship Creator] AddCreatureRelationship( from_name=sheep, to_name=grass, relationship_name=eats )

Becuase the framework has a dynamic router, it can handle more complex 'composite' prompts, such as:

  • "Add a cow that eats grass. Add a human - the cow feeds the human. Add and alien that eats the human. The human also eats cows."

The router figures out which agents to use, what order to run them in, and what prompt to send to each agent.

Setup

  1. Install Python 3.11 and poetry

  2. Install dependencies.

poetry install
  1. Get an Open AI key

  2. Set environment variable with your Open AI key:

export OPENAI_API_KEY="xxx"

Add that to your shell initializing script (~/.zprofile or similar)

Load in current terminal:

source ~/.zprofile

Usage

Test script:

./test.sh

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

gpt_multi_atomic_agents-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

gpt_multi_atomic_agents-0.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gpt_multi_atomic_agents-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10

File hashes

Hashes for gpt_multi_atomic_agents-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7654d349df15e08d99e9cc27ab484858cd979bd8d055f831df5f99ea37de4be4
MD5 fbb8b5d8ea1d9a62e90bb4f63eca26b7
BLAKE2b-256 c728cf81e2797a74024ba3b489dda74bfc36035a85b9e6ebc8f389ae851c1531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gpt_multi_atomic_agents-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 064eef5bd59abde8a0e05f02073e698adbf38a8472050d952c178b1841ff0048
MD5 e620b9c0069adbe3298bdb7eb5b49a2e
BLAKE2b-256 b111ea4647002acedd9608458328df4b36a76277e35c9429e12183793a7c3f8a

See more details on using hashes here.

Supported by

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