$ show MervinPraison/PraisonAI
PraisonAI is a production-oriented, multi-language AI agent orchestration framework shipped as a monorepo of cooperating Python, TypeScript, and Rust packages. The core SDK (`praisonaiagents`) implements `Agent`, `Task`, `AgentTeam`, and `AgentFlow`/`Workflow` abstractions with MCP support (stdio/HTTP/WebSocket/SSE), integration with 20+ LLM providers via LiteLLM-style configuration, memory backends (SQLite, file, mem0, MongoDB), RAG/knowledge bases over vector stores, guardrails, approval flows, policy engines, context compaction, telemetry, background jobs, and durable run ledgers. A user-facing `praisonai` wrapper provides a Typer CLI (`run`, `chat`, `code`, `serve mcp`, agent-as-API), bot adapters for Telegram/Discord/Slack via a WebSocket gateway, sandboxed compute (Docker, E2B, Modal, Daytona), deployment registries, cloud managed agents, and a fine-tuning package (`praisonai-train`). The repository is decisively an application/framework, though it carries data-research features as part of the product surface (RAG pipelines, evaluation loops, synthetic-data generation, LoRA fine-tuning), making it a hybrid in feature terms only.
The LLM identified 5 files worth highlighting for reuse:
Parses LLM errors and extracts retry-after hints with defense against NaN/inf values, negative numbers, fractional seconds, and partial token matches, plus capped backoff and classifier fallback chains. Isolated, dependency-light logic that can be extracted into any LLM client or rate-limit middleware; the rigor in rejecting malformed hints so they cannot poison backoff schedulers is non-obvious engineering.
Shared path containment resolver (`resolve_within_root`, `is_within_root`) for workspace-isolated file tools. A single well-tested implementation of a universal security problem (preventing file access outside a sandbox root, covering symlink and ambiguous-host edge cases) that can be extracted into any agentic-coding, file-tool, or sandbox project.
Generic PEP 562 lazy-import helper (`create_lazy_getattr`) used across the monorepo to defer heavy optional dependencies (litellm, chromadb, sandbox providers) until first use. Self-contained and directly reusable in any Python library that wants zero import cost for optional integrations; the pattern is applied consistently and pinned by regression tests.
Persistence facade (`PersistenceOrchestrator`, `wrap_agent_with_persistence`, `create_persistent_session`) that decorates any sync or async agent with conversation persistence across SQLite/JSON/state backends. Demonstrates a clean wrapper pattern for adding durable chat history to arbitrary agents without modifying the agent, and includes drift-guard tests asserting the facade stays aligned with the underlying orchestrator.
Port interfaces (HTTP, storage, secrets, time) for the Tauri mobile shell with deterministic fake implementations whose own arguments are asserted in tests, guarding against fakes silently discarding parameters. A small, transferable example of hexagonal-architecture discipline for cross-platform runtime seams, useful for any mobile or embedded app targeting multiple runtimes.