Skip to main content

A lightweight agent interaction framework.

Project description

motleycrew

A lightweight agent interaction framework.

Minimal example with maximum automation (might take a while to build ;) ):

from motleycrew import Task, MotleyCrew

task = Task("""Research arxiv on the latest trends in machine learning
and produce an engaging blog post on the topic""",
            documents=["paper1.pdf", "paper2.pdf"])
crew = MotleyCrew(tasks=[task])
crew.run()

Come to think of it, might it make sense to make it 2 libraries, one with the interaction primitives, and the other on top of it with the automation?

Here the MotleyCrew auto-spawns agents to complete the task, and picks additional tools for them.

Short term, more crewAI-style (here some is copy-pasted from crewAI, will need to edit before going public)

from langchain import hub
from langchain_community.tools import DuckDuckGoSearchRun
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_openai_tools_agent

from motley_crew import Task, MotleyCrew
from motley_crew.agents import LangchainAgent, MotleyAgent

tools=[DuckDuckGoSearchRun()]
researcher_prompt = hub.pull("hwchase17/openai-tools-agent")
llm = ChatOpenAI(model="gpt-4-0125-preview", temperature=0)

researcher_agent = AgentExecutor(
    agent=create_openai_tools_agent(llm, tools, researcher_prompt),
    tools=tools,
    verbose=True,
)

researcher = LangchainAgent(
    agent=researcher_agent,
    goal="Research the web and any documents they are given, and summarize the results",
    allow_delegation=False
)

writer = MotleyAgent(
    goal="Craft compelling content on tech advancements",
    description="""You are a renowned Content Strategist, known for your insightful and engaging articles.
  You transform complex concepts into compelling narratives.""",
    verbose=True,
    kind = "crewai",
    delegation=True,
)

# Create tasks for your agents
task1 = Task(
    description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
  Identify key trends, breakthrough technologies, and potential industry impacts.
  Your final answer MUST be a full analysis report""",
    agent=researcher,
    documents = ["paper1.pdf", "paper2.pdf"],
)

task2 = Task(
    description="""Using the insights provided, develop an engaging blog
  post that highlights the most significant AI advancements.
  Your post should be informative yet accessible, catering to a tech-savvy audience.
  Make it sound cool, avoid complex words so it doesn't sound like AI.
  Your final answer MUST be the full blog post of at least 4 paragraphs.
  """,
    agent=writer,
    depends_on=task1,
)

# Instantiate your crew with a sequential process
crew = MotleyCrew(
    agents=[researcher, writer],
    tasks=[task1, task2],
    verbose=2,  # You can set it to 1 or 2 to different logging levels
)

# Get your crew to work!
result = crew.run()

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

motleycrew-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

motleycrew-0.1.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: motleycrew-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.1.0

File hashes

Hashes for motleycrew-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ae642591c8c5716af9044158e18f1a714d45494928fa0eb9be696431f43764d
MD5 f806d7e2c4529948db1814215c567c7a
BLAKE2b-256 d2b42ef29d48739ca26bd124b8124b5a89d31b535574b8b9f48d902c290b6924

See more details on using hashes here.

File details

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

File metadata

  • Download URL: motleycrew-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.1.0

File hashes

Hashes for motleycrew-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c15c16ff66c6feb34ec9089b82a5dec2bfa670eae07ee968c3c83af9e2be762
MD5 2dc6f1dc0f085c498a28fc17681a2ae9
BLAKE2b-256 4efa942258dd4644f81bbe5d0c2628d4e58f0863987265d457bb7f3b54673cca

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