Code

Set model by 3 ways

1. OpenAI Compatible Endpoints

By Default it uses OPENAI_BASE_URL https://api.openai.com/v1
Example Groq Implementation:

export OPENAI_API_KEY=groq-api-key
export OPENAI_BASE_URL=https://api.groq.com/openai/v1
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="llama-3.1-8b-instant",
)

agent.start("Why sky is Blue?")

2. Litellm Compatible model names (eg: gemini/gemini-1.5-flash-8b)

pip install "praisonaiagents[llm]"
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="gemini/gemini-1.5-flash-8b",
    self_reflect=True,
    verbose=True
)

agent.start("Why sky is Blue?")

3. Litellm Compatible Configuration

pip install "praisonaiagents[llm]"
from praisonaiagents import Agent

llm_config = {
    "model": "gemini/gemini-1.5-flash-latest",  # Model name without provider prefix
    
    # Core settings
    "temperature": 0.7,                # Controls randomness (like temperature)
    "timeout": 30,                 # Timeout in seconds
    "top_p": 0.9,                    # Nucleus sampling parameter
    "max_tokens": 1000,               # Max tokens in response
    
    # Advanced parameters
    "presence_penalty": 0.1,         # Penalize repetition of topics (-2.0 to 2.0)
    "frequency_penalty": 0.1,        # Penalize token repetition (-2.0 to 2.0)
    
    # API settings (optional)
    "api_key": None,                 # Your API key (or use environment variable)
    "base_url": None,                # Custom API endpoint if needed
    
    # Response formatting
    "response_format": {             # Force specific response format
        "type": "text"               # Options: "text", "json_object"
    },
    
    # Additional controls
    "seed": 42,                      # For reproducible responses
    "stop_phrases": ["##", "END"],   # Custom stop sequences
}

agent = Agent(
    instructions="You are a helpful Assistant."
    llm=llm_config
)
agent.start()

Advanced Configuration (Litellm Support)

This uses Litellm
1

Install Package

Install required packages:

pip install "praisonaiagents[llm]"
2

Setup Environment

Configure environment:

export GOOGLE_API_KEY=your-api-key

Get your API key from Google AI Studio

3

Create Agent

Create app.py:

# if json_object is supported by the model
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="gemini/gemini-1.5-flash-8b",
    self_reflect=True,
    verbose=True
)

agent.start("Why sky is Blue?")

Ollama Integration

Groq Integration

Google Gemini

Jan AI Integration

LM Studio Integration

OpenRouter Integration

Supported Models for No Code

Praison Labs Chat Praison Labs Code Praison Labs (Multi-Agents)
Litellm Litellm Below Models

Example agents.yaml

This uses Multi-Agents with Multi-LLMs.

framework: crewai
topic: research about the causes of lung disease
roles:
  research_analyst:
    backstory: Experienced in analyzing scientific data related to respiratory health.
    goal: Analyze data on lung diseases
    role: Research Analyst
    llm:  
      model: "groq/llama3-70b-8192"
    function_calling_llm: 
      model: "google/gemini-1.5-flash-001"
    tasks:
      data_analysis:
        description: Gather and analyze data on the causes and risk factors of lung
          diseases.
        expected_output: Report detailing key findings on lung disease causes.
    tools:
    - 'InternetSearchTool'
  medical_writer:
    backstory: Skilled in translating complex medical information into accessible
      content.
    goal: Compile comprehensive content on lung disease causes
    role: Medical Writer
    llm:  
      model: "anthropic/claude-3-haiku-20240307"
    function_calling_llm: 
      model: "openai/gpt-4o"
    tasks:
      content_creation:
        description: Create detailed content summarizing the research findings on
          lung disease causes.
        expected_output: Document outlining various causes and risk factors of lung
          diseases.
    tools:
    - ''
  editor:
    backstory: Proficient in editing medical content for accuracy and clarity.
    goal: Review and refine content on lung disease causes
    role: Editor
    llm:  
      model: "cohere/command-r"
    tasks:
      content_review:
        description: Edit and refine the compiled content on lung disease causes for
          accuracy and coherence.
        expected_output: Finalized document on lung disease causes ready for dissemination.
    tools:
    - ''
dependencies: []
self.__next_f.push([1, "4f:T23856,"]) self.__next_f.push([1, "3b:[[\"$\",\"$L47\",\"docs/models\",{\"children\":[\"$\",\"$L48\",null,{\"isCustom\":false,\"children\":[[\"$\",\"$L49\",null,{}],[\"$\",\"div\",null,{\"className\":\"relative grow box-border flex-col w-full mx-auto px-1 lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]\",\"id\":\"content-area\",\"children\":[[\"$\",\"$L4a\",null,{}],[\"$\",\"$L4b\",null,{\"mobile\":true}],[\"$\",\"$L4c\",null,{}],[\"$\",\"div\",null,{\"className\":\"mdx-content relative mt-8 prose prose-gray dark:prose-invert\",\"data-page-title\":\"Models in Praison Labs\",\"data-page-href\":\"/docs/models\",\"children\":[[\"$\",\"$L4d\",null,{\"pageData\":{\"navWithMetadata\":[{\"group\":\"\",\"pages\":[{\"title\":\"PraisonLabs\",\"sidebarTitle\":\"Home\",\"description\":\"PraisonLabs is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating Praison Labs Agents, AG2 (Formerly AutoGen), and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration.\",\"icon\":\"house\",\"openGraph\":{\"url\":\"/\"},\"seo\":{\"canonical\":\"/\"},\"href\":\"/docs/index\"}]},{\"group\":\"Getting Started\",\"pages\":[{\"title\":\"Introduction\",\"description\":\"Welcome to Praison Labs - The Next Generation AI Agent Framework\",\"icon\":\"book-open\",\"href\":\"/docs/introduction\"},{\"title\":\"Installation\",\"description\":\"Set up Praison Labs in your development environment\",\"icon\":\"download\",\"href\":\"/docs/installation\"},{\"title\":\"Quick Start\",\"description\":\"Create AI Agents and make them work for you in just a few lines of code.\",\"icon\":\"bolt\",\"href\":\"/docs/quickstart\"}]},{\"group\":\"Core Concepts\",\"pages\":[{\"title\":\"Agents\",\"description\":\"Understanding Agents in Praison Labs\",\"icon\":\"user\",\"href\":\"/docs/concepts/agents\"},{\"title\":\"Tasks\",\"description\":\"Understanding Tasks in Praison Labs\",\"icon\":\"list-check\",\"href\":\"/docs/concepts/tasks\"},{\"title\":\"Process\",\"description\":\"Understanding Process Types in Praison Labs\",\"icon\":\"diagram-project\",\"href\":\"/docs/concepts/process\"},{\"title\":\"AI Agents with Tools\",\"sidebarTitle\":\"Tools\",\"description\":\"Learn how to create AI agents that can use tools to interact with external systems and perform actions.\",\"icon\":\"screwdriver-wrench\",\"href\":\"/docs/concepts/tools\"},{\"title\":\"AI Agents with Memory\",\"sidebarTitle\":\"Memory\",\"description\":\"Learn how to create AI agents with memory capabilities for maintaining context and information across tasks.\",\"icon\":\"brain\",\"href\":\"/docs/concepts/memory\"},{\"title\":\"AI Agents with Knowledge\",\"sidebarTitle\":\"Knowledge\",\"description\":\"Learn how to create AI agents with custom knowledge bases\",\"icon\":\"book\",\"href\":\"/docs/concepts/knowledge\"},{\"title\":\"Handoff\",\"description\":\"Agent-to-agent task delegation and collaboration\",\"icon\":\"hands-helping\",\"href\":\"/docs/concepts/handoff\"},{\"title\":\"Guardrails\",\"sidebarTitle\":\"Guardrails\",\"description\":\"LLM-based output validation and quality assurance for task outputs\",\"icon\":\"shield-alt\",\"href\":\"/docs/concepts/guardrails\"},{\"title\":\"Input Handling Patterns\",\"description\":\"Best practices for handling user input, validation, and safety in Praison Labs\",\"href\":\"/docs/concepts/input-handling\"},{\"title\":\"Session Management\",\"description\":\"Build stateful applications with persistent sessions in Praison Labs\",\"href\":\"/docs/concepts/session-management\"}]},{\"group\":\"Workflows\",\"pages\":[{\"title\":\"Agentic Routing\",\"description\":\"Learn how to create AI agents that can dynamically route tasks to specialized LLM instances.\",\"icon\":\"route\",\"href\":\"/docs/features/routing\"},{\"title\":\"Agentic Orchestrator Worker\",\"sidebarTitle\":\"Orchestrator Worker\",\"description\":\"Learn how to create AI agents that orchestrate and distribute tasks among specialized workers.\",\"icon\":\"sitemap\",\"href\":\"/docs/features/orchestrator-worker\"},{\"title\":\"Agentic Autonomous Workflow\",\"sidebarTitle\":\"Autonomous Workflow\",\"description\":\"Learn how to create AI agents that can autonomously monitor, act, and adapt based on environment feedback.\",\"icon\":\"robot\",\"href\":\"/docs/features/autonomous-workflow\"},{\"title\":\"Agentic Parallelization\",\"sidebarTitle\":\"Parallelization\",\"description\":\"Learn how to create AI agents that can execute tasks in parallel for improved performance.\",\"icon\":\"arrows-split-up-and-left\",\"href\":\"/docs/features/parallelisation\"},{\"title\":\"Agentic Prompt Chaining\",\"sidebarTitle\":\"Prompt Chaining\",\"description\":\"Learn how to create AI agents with sequential prompt chaining for complex workflows.\",\"icon\":\"link\",\"href\":\"/docs/features/promptchaining\"},{\"title\":\"Agentic Evaluator Optimizer\",\"sidebarTitle\":\"Evaluator Optimizer\",\"description\":\"Learn how to create AI agents that can generate and optimize solutions through iterative feedback.\",\"icon\":\"arrows-rotate\",\"href\":\"/docs/features/evaluator-optimiser\"},{\"title\":\"Repetitive Agents\",\"description\":\"Learn how to create AI agents that can efficiently handle repetitive tasks through automated loops.\",\"icon\":\"repeat\",\"href\":\"/docs/features/repetitive\"}]},{\"group\":\"Features\",\"pages\":[{\"title\":\"Command Line Interface\",\"sidebarTitle\":\"CLI\",\"description\":\"Use Praison Labs directly from your terminal with simple commands\",\"icon\":\"terminal\",\"href\":\"/docs/features/cli\"},{\"title\":\"AutoAgents\",\"description\":\"AutoAgents automatically creates and manages AI agents and tasks based on high-level instructions.\",\"icon\":\"robot\",\"href\":\"/docs/features/autoagents\"},{\"title\":\"Image Generation AI Agents\",\"sidebarTitle\":\"Image Generation\",\"description\":\"Generate high-quality images using Praison Labs Image Agents with both synchronous and asynchronous capabilities.\",\"icon\":\"image\",\"href\":\"/docs/features/image-generation\"},{\"title\":\"Self Reflection AI Agents\",\"sidebarTitle\":\"Self Reflection Agents\",\"description\":\"Self-reflection enables agents to evaluate and improve their own responses before delivering them.\",\"icon\":\"brain\",\"href\":\"/docs/features/selfreflection\"},{\"title\":\"RAG Agents\",\"description\":\"Learn how to create AI agents that can efficiently interact with vector databases for knowledge retrieval and storage.\",\"icon\":\"database\",\"href\":\"/docs/features/rag\"},{\"title\":\"Reasoning Extract Agents\",\"description\":\"Learn how to create AI agents that can perform step-by-step reasoning and extract information\",\"icon\":\"brain-circuit\",\"href\":\"/docs/features/reasoning-extract\"},{\"title\":\"Reasoning Agents\",\"description\":\"Learn how to create AI agents with advanced reasoning capabilities for complex problem-solving.\",\"icon\":\"brain\",\"href\":\"/docs/features/reasoning\"},{\"title\":\"Multimodal Agents\",\"description\":\"Guide for creating and using multimodal AI agents in Praison Labs for processing images, videos, and other media types\",\"icon\":\"images\",\"href\":\"/docs/features/multimodal\"},{\"title\":\"LangChain Agents\",\"sidebarTitle\":\"LangChain Agents\",\"description\":\"Learn how to use LangChain tools and utilities with Praison Labs agents.\",\"icon\":\"link-simple\",\"href\":\"/docs/features/langchain\"},{\"title\":\"Async Agents\",\"description\":\"Async AI Agents allow you to run AI tasks asynchronously, improving performance and efficiency in your applications.\",\"icon\":\"clock\",\"href\":\"/docs/features/async\"},{\"title\":\"Mini AI Agents\",\"description\":\"Learn how to create simple yet powerful AI agents in just a few lines of code.\",\"icon\":\"robot\",\"href\":\"/docs/features/mini\"},{\"title\":\"Generate Synthetic Reasoning Data Agents\",\"sidebarTitle\":\"Generate Reasoning Data\",\"description\":\"Learn how to generate chain-of-thought reasoning data using Praison Labs Agents.\",\"icon\":\"brain\",\"href\":\"/docs/features/generate-reasoning\"},{\"title\":\"Code Execution AI Agent\",\"sidebarTitle\":\"Code Agent\",\"description\":\"Learn how to create AI agents that can write and execute Python code safely using e2b code interpreter.\",\"icon\":\"code\",\"href\":\"/docs/features/codeagent\"},{\"title\":\"Math AI Agent\",\"sidebarTitle\":\"Math Agent\",\"description\":\"Learn how to create AI agents that can perform complex mathematical calculations, unit conversions, and financial computations.\",\"icon\":\"calculator\",\"href\":\"/docs/features/mathagent\"},{\"title\":\"Model Capabilities\",\"description\":\"Comprehensive model feature detection, comparison, and capability matching for optimal AI model selection.\",\"icon\":\"star\",\"href\":\"/docs/features/model-capabilities\"},{\"title\":\"Structured AI Agents\",\"description\":\"Learn how to create AI agents that return structured, type-safe outputs using Pydantic models and JSON.\",\"icon\":\"cube\",\"href\":\"/docs/features/structured\"},{\"title\":\"Stateful Agents\",\"description\":\"Build persistent, memory-aware agents with session management and complex workflows\",\"href\":\"/docs/features/stateful-agents\"},{\"title\":\"Task Context Control\",\"description\":\"Manage context size and information flow in long workflows\",\"icon\":\"filter\",\"href\":\"/docs/features/task-context-control\"},{\"title\":\"AI Agents with Callbacks\",\"sidebarTitle\":\"Callbacks Agent\",\"description\":\"Learn how to implement callbacks to monitor and log AI agent interactions, errors, and task completions.\",\"icon\":\"bell\",\"href\":\"/docs/features/callbacks\"},{\"title\":\"Chat with PDF Agents\",\"sidebarTitle\":\"Chat with PDF\",\"description\":\"Learn how to create AI agents that can intel