OpenAI Swarm on Llama3 // Multi-agent framework

Alternative LLM client // Groq, Nvidia, self-host..

sbagency
5 min read3 days ago

There are many LLM based multi-agent frameworks: crewai, autogen, langgraph, chatdev, etc. Now +swarm // multi-agent orchestration. It can use alternative LLM models (pass the customized client parameter to Swarm constructor).

AI-agents can collaborate at speeds and scales beyond human capabilities // thousands of agents, a promising field for research and development. But LLMs hallucinations/errors is a barrier for adoption.

https://github.com/openai/swarm
https://cookbook.openai.com/examples/orchestrating_agents
!pip install openai
!pip install git+https://github.com/openai/swarm.git

Alternative LLM model // Llama3, tool use

import openai
from google.colab import userdata

model = "llama3-groq-70b-8192-tool-use-preview"

llm_client = openai.OpenAI(
base_url="https://api.groq.com/openai/v1",
api_key=userdata.get('GROQ_API_KEY'),
)

Bare minimum example, custom LLM client

# https://github.com/openai/swarm/blob/main/examples/basic/bare_minimum.py
from swarm import Swarm, Agent

swarm_client = Swarm(client=llm_client)

agent = Agent(
name="Agent",
instructions="You are a helpful agent.",
model=model,
tool_choice="auto"
)

messages = [{"role": "user", "content": "Hi!"}]
response = swarm_client.run(agent=agent, messages=messages)

print(response.messages[-1]["content"])
https://colab.research.google.com/github/sbagency/AI-agents-hacks/blob/main/Openai_swarm_Llama3_Groq_ipynb%22.ipynb

Why AI-Agents? // high-level model for complex problems

https://www.forbes.com/sites/timothypapandreou/2024/10/11/ai-agents-are-accelerating-digital-transformation-are-you-ready/

The article discusses the rise of AI agents as a pivotal force in digital transformation, with these intelligent entities poised to revolutionize industries by automating tasks, making informed decisions, and even collaborating with humans. Unlike traditional chatbots, AI agents can source data, perform complex actions, and make decisions autonomously. They are already integrated into daily life, such as in self-driving cars, virtual assistants, and booking platforms.

Emerging trends show AI agents reshaping business operations, such as acting as customer representatives, virtual colleagues, or fully autonomous business entities. As AI agents advance, they will increasingly anticipate user needs, transforming industries like customer service, marketing, and healthcare, while raising issues about the evolving nature of work. Companies must adapt to these changes to stay competitive in this AI-driven future.

https://singularityhub.com/2024/10/11/ai-agents-could-collaborate-on-far-grander-scales-than-humans-study-says/

A new study suggests that AI agents could collaborate in much larger groups than humans, potentially working together in teams of 1,000 or more. While humans are generally limited to maintaining social groups of around 150 individuals (a concept known as Dunbar’s number), researchers found that large language models (LLMs) like GPT-4 Turbo could achieve consensus in groups as large as 1,000 instances.

In the study, AI models were given random opinions and exposed to each other’s views to see if they could reach consensus. Larger, more advanced models like GPT-4 Turbo successfully formed agreements in large groups, while smaller or older models struggled to do so. The research highlights the potential for AI agents to collaborate on a grander scale than humans, but also raises questions about the computational costs and whether consensus always leads to optimal solutions.

This finding contributes to ongoing research into multi-agent systems, where groups of AI work together to solve tasks. Though AI lacks biological limitations on information processing, it’s uncertain whether current models are intelligent enough to fully exploit these capabilities.

There is a problem

https://venturebeat.com/ai/ai21-ceo-says-transformers-not-right-for-ai-agents-due-to-error-perpetuation/

AI21 CEO Ari Goshen argues that transformer models, widely used in AI development, are not ideal for AI agents due to issues like error perpetuation and high costs. Instead, Goshen advocates for alternative architectures like AI21’s JAMBA (based on Mamba), which offer better memory performance and efficiency. He claims that transformer models’ stochastic nature makes them unreliable for agent-based systems. As AI agents gain popularity, companies like ServiceNow, Salesforce, and Slack are adopting them, but Goshen emphasizes that models must be more reliable and cost-effective before AI agents can be widely deployed in enterprises.

LLMs for agents // function-calling leaderboard

https://gorilla.cs.berkeley.edu/leaderboard.html
https://writer.com/blog/actions-with-palmyra-x-004/

The article introduces Palmyra X 004, a new large language model (LLM) by Writer, designed to revolutionize enterprise workflows through advanced action capabilities. Palmyra X 004 enables AI to interact with external systems, such as software and databases, using tool calling, automating complex tasks like data integration, code generation, and workflow management.

Key features of Palmyra X 004 include:
- The ability to perform actions in external systems via tool calling.
- Automatic data integration with retrieval-augmented generation (RAG).
- Code generation and deployment.
- Expanded 128k context window for handling larger data.
- Structured output for easier system integration.

The model outperforms competitors in action accuracy, ranking highest on Berkeley’s Tool Calling Leaderboard and Stanford HELM benchmarks. It can automate tasks such as updating financial records, analyzing data, and managing workflows without human intervention, making it valuable across industries like healthcare, finance, and product development.

Palmyra X 004’s action capabilities simplify processes by letting AI handle real work, enabling more efficient, scalable, and cost-effective operations. It is available in Ask Writer and AI Studio for immediate use.

--

--

sbagency

Tech/biz consulting, analytics, research for founders, startups, corps and govs.