llm-mar
v1.0.9
Published
LLM-MAR is a compact CLI that creates LLM agents, lets them debate, answers questions, and builds workflows.
Downloads
97
Maintainers
Readme
LLM-MAR
LLM-MAR (Multi Agent Reasoning) is a compact CLI that creates LLM agents, lets them debate, answers questions, and builds workflows.
Table of Contents
Installation
Option 1: Install from npm (Recommended)
npm install -g llm-marOption 2: Install from source
Clone the repository:
git clone https://github.com/llm-mar/llm-mar.git cd llm-marInstall dependencies:
npm installSet up your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
Quick Start
Get started with LLM-MAR in minutes! Create intelligent agents, form teams, and orchestrate debates—all through simple YAML configurations.
1. Create Your First Agent
Let's create an AI assistant specialized in creative writing:
llm-mar create agent writer --model gpt-4 --goal "To write engaging stories" --role "Creative Writer" --system-prompt "You are a talented fiction writer with a vivid imagination." --instructions "Use descriptive language,Build suspense,End with a twist" --output textThis generates a YAML configuration file that defines your agent's personality and capabilities.
2. See the YAML Structure
The command above creates default/writer.yaml with this structure:
version: '1.0'
kind: Agent
metadata:
name: writer
description: An agent named writer
spec:
id: writer
model: gpt-4
goal: To write engaging stories
role: Creative Writer
system_prompt: You are a talented fiction writer with a vivid imagination.
instructions:
- Use descriptive language
- Build suspense
- End with a twist
output: textKey Components:
- metadata: Basic info and description
- spec: The agent's configuration including model, role, and behavior
- instructions: List of guidelines for the AI's responses
3. Run Your Agent
Now let's use the agent to generate a story:
llm-mar run default/writer.yaml --input "Write a short story about a mysterious old clock in an antique shop."The agent will respond with a creative story based on its configuration!
4. Build a Team
Combine multiple agents for collaborative tasks:
llm-mar create team story_team --agents "default/writer.yaml,default/editor.yaml" --output text5. Set Up a Debate
Create engaging debates between agents:
llm-mar create debate tech_debate --agents "default/optimist.yaml,default/pessimist.yaml" --judges "default/judge.yaml" --input "Will AI replace human jobs?" --output textUsage
After installation, use the llm-mar command (or npx llm-mar if installed locally).
Creating Agents
Create a new agent YAML file:
llm-mar create agent myagent --model gpt-4 --goal "To answer questions" --role "Assistant" --system-prompt "You are a helpful assistant." --instructions "Think step by step,Answer clearly" --output textThis creates default/myagent.yaml.
Creating Teams
Create a team of agents:
llm-mar create team myteam --agents "default/agent1.yaml,default/agent2.yaml" --output textRunning Agents
Run an agent with input:
llm-mar run default/myagent.yaml --input "What is the capital of France?"Running Teams
Run a team with a specific agent:
llm-mar run default/myteam.yaml --agent agent1 --input "Discuss this topic"Running Debates
Run a debate (assuming you have a debate YAML):
llm-mar run default/debate1.yamlYAML Structure
LLM-MAR uses YAML files to define agents, teams, and debates. Here's a quick overview of the structure:
Agent YAML
version: '1.0'
kind: Agent
metadata:
name: Scientist
description: A scientific analysis agent
spec:
id: scientist
model: gpt-4
goal: To provide scientific explanations
role: Research Scientist
system_prompt: You are an expert scientist...
instructions:
- Use evidence-based reasoning
- Explain complex concepts simply
output: textTeam YAML
version: '1.0'
kind: Team
metadata:
name: Research Team
description: Collaborative research team
spec:
agents:
- default/scientist.yaml
- default/analyst.yaml
output: textDebate YAML
version: '1.0'
kind: Debate
metadata:
name: Ethics Debate
description: Debate on AI ethics
spec:
method: majority_vote
input: Should AI have rights?
judges:
- default/judge.yaml
agents:
- default/pro.yaml
- default/con.yaml
output: textFor detailed configuration options and advanced features, see docs/yaml-structure-guide.md.
