peargent.

Overview

About peargent.

Alt text for the image

Peargent is a modern, simple, and powerful Python framework for building intelligent AI agents with production-grade features. It offers a clean, intuitive API for creating conversational agents that can use tools, maintain memory, collaborate with other agents, and scale reliably into production.

What is Peargent?

Peargent simplifies the process of building AI agents by providing:

  • Flexible LLM Support - Works seamlessly with OpenAI, Groq, Google Gemini, and Azure OpenAI
  • Powerful Tool System - Execute actions with built-in timeout, retries, and input/output validation
  • Persistent Memory - Multiple backends supported: in-memory, file, Sqlite, PostgreSQL, Redis
  • Multi-Agent Orchestration - Coordinate specialized agents for complex workflows
  • Production-Ready Observability - Built-in tracing, cost tracking, and performance metrics
  • Type-Safe Structured Outputs - Easily validate responses using Pydantic models

How Does Peargent Work?

Peargent lets you build individual agents or complex systems where each Agent contributes specialized work while sharing context through a global State. Agents operate inside a Pool, coordinated by a Router that can run in round-robin or LLM-based mode to decide which agent handles each step. Agents use Tools to take actions and update the shared State, while History persists reasoning and decisions to maintain continuity across the workflow.

Why Peargent?

Start with a basic agent in just a few lines:

  from peargent import create_agent

  agent = create_agent(
      persona="You are a helpful assistant",
      model="gpt-4"
  )

  response = agent.run("What is the capital of France?")
  print(response)

Scale to complex multi-agent systems with memory, tools, and observability:

  from peargent import create_agent, create_tool, create_pool
  from peargent.history import HistoryConfig
  from peargent.storage import Sqlite

  # Create specialized agents with persistent memory
  researcher = create_agent(
      persona="You are a research expert",
      model="gpt-4",
      tools=[search_tool, analyze_tool],
  )

  writer = create_agent(
      persona="You are a technical writer",
      model="gpt-4",
  )

  # Orchestrate multiple agents
  pool = create_pool(
      agents=[researcher, writer],
      history=HistoryConfig(
          store=Sqlite(database_path="./pool_conversations/")
      )
  )

  result = pool.run("Research and write about quantum computing")
  print(result)