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

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.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

gpt_multi_atomic_agents-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gpt_multi_atomic_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d9fa636635c10fa4b97cf1ab1d57c22007f2fc6c4c573faaad7d16b3d67fc7c6
MD5 8dba0fcb621a4eb5bd275bc77bb84f35
BLAKE2b-256 2a50096752d5abad66ca1e89722014cb47c5a8c5934853dcd727b31fc5f873e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gpt_multi_atomic_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ca514fefba91b04f70891ce0d2adeb42fcb5c58ffc8fb6e9a30be7ece3e47f
MD5 897ed4e6ca43d8bb4c57bbb1b63cd49b
BLAKE2b-256 dca3e155ca687d89f15539e20065ad71d70d5cff390561ba7ced84b1b8a52897

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