Compare commits

...
Author SHA1 Message Date
MervinPraison 28ab9d4f2b feat: add token budget tracking and enforcement
- Add max_budget and on_budget_exceeded to ExecutionConfig
- Track total cost, tokens, and LLM calls per agent run
- Enforce budget limits with stop/warn/callable actions
- Zero overhead when budget tracking is disabled
- Add BudgetExceededError exception
- Update config serialization to include budget fields

Provides cost control for agent deployments with configurable limits.
2026-04-02 18:59:15 +01:00
MervinPraison bfe3d94bad Release v4.5.112 2026-04-02 10:36:06 +01:00
7ae6c6d19c fix(sandbox): update sandlock integration to use real API surface (#1259)
* fix(sandbox): update sandlock integration to use real API surface

- Replace sandlock.is_available() with landlock_abi_version() >= 6 check
- Remove non-existent TimeoutError and SecurityViolationError exception handling
- Remove invalid max_cpu_time_seconds parameter from Policy constructor
- Update sandbox.run() to only pass cmd and timeout (remove env/cwd)
- Update tests to use correct API mocks

Fixes #1258

Co-authored-by: Mervin Praison <[email protected]>

* fix(sandbox): fix ABI version threshold, remove dead except block, unused var, and fix test mocks

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/ee8122be-e5f3-47dd-bcb6-c0994df15169

Co-authored-by: MervinPraison <[email protected]>

* fix(sandbox): implement proper sandlock Result status mapping and improve test reliability

- Fix exit_code status mapping: Check result.success and exit_code before returning SandboxStatus.COMPLETED
- Update test mocks to return proper Result objects with success/exit_code instead of raising exceptions
- Add integration test that exercises real sandlock API if available
- Address reviewer feedback from CodeRabbit, Qodo, Gemini, and Copilot

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
2026-04-02 10:34:25 +01:00
MervinPraison cc962c96d4 fix(workflows): robustly match copilot bot string to correctly chain claude 2026-04-02 10:29:06 +01:00
MervinPraison d5a55aaf4b Release v4.5.111 2026-04-02 07:47:12 +01:00
MervinPraison a02a7209a9 Allow external users to trigger Claude Code 2026-04-02 07:31:57 +01:00
MervinPraison 0e55b36056 refactor(tools): replace list_directory with list_files and tidy code
Updated the tools in multiple example scripts to use `list_files` instead of `list_directory`. Removed unnecessary global variables and functions in `shell_tools.py` for better clarity and performance. Updated the `approval` flag in agent configurations to `False` for consistency across examples.
2026-04-01 21:01:39 +01:00
MervinPraison d89e467257 feat(docs): add image and quote from Elon Musk to README
Added a new image highlighting PraisonAI shared by Elon Musk, along with a quote for better engagement and visibility.
2026-04-01 20:46:14 +01:00
MervinPraison 1e2a5ef12d chore(workflows): update email configuration across workflows
Updated the user email in multiple GitHub workflows to a no-reply address for better privacy. This change ensures consistency across the repository's automation scripts.

fix(examples): update web configuration in agent examples

Modified web configuration in `agent_centric_api.py` examples to utilize `WebConfig`. This enhances clarity and control over the web search functionality.

test(unit): skip integration test without API key

Added a condition to skip the `test_circuit_breaker_real_agentic` if the OpenAI API key is not set. This prevents unnecessary test failures in the absence of required credentials.
2026-04-01 20:38:47 +01:00
MervinPraison de069c2cbf Release v4.5.110 2026-04-01 20:26:06 +01:00
MervinPraison ff599795f8 test: Fix evaluator class name in live tests 2026-04-01 20:01:42 +01:00
9164555a7a fix: address code review feedback for mixin framework (#1256)
* fix: address code review feedback for mixin framework

- Add ChatMixin, ExecutionMixin, MemoryMixin exports to __init__.py
- Remove unused imports from memory_mixin.py (threading)
- Align achat() method signature with chat() parameters
- Ensure consistent API between sync/async variants

Addresses reviewer feedback while maintaining backward compatibility.

Co-authored-by: Mervin Praison <[email protected]>

* fix: forward new achat() params to _achat_impl and implement them

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/03002903-d3fc-46e9-8ad7-4b1fafc70a4e

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-04-01 19:58:24 +01:00
b26c44ad90 feat: Complete Agent God Class Decomposition with Unified Mixin Framework (#1257)
* feat: Complete Agent God Class Decomposition with Unified Mixin Framework

- Complete mixin framework: ToolExecutionMixin, ChatHandlerMixin, SessionManagerMixin, ChatMixin, ExecutionMixin, MemoryMixin
- Created missing ChatHandlerMixin for chat coordination & response processing
- Created missing SessionManagerMixin for session lifecycle & state management
- Updated Agent class inheritance to follow specification order
- Maintain 100% backward API compatibility with all 34+ __init__ parameters
- Performance: Import time 59.20ms (target <200ms achieved)
- Zero breaking changes - all existing public methods preserved
- Agent class reduced from ~8,915 to 4,341 lines through proper decomposition

Resolves #1254

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: correct time import bug, remove raw error leakage in ChatHandlerMixin

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/1cacd729-25d5-42df-a628-782502d1b3f1

Co-authored-by: MervinPraison <[email protected]>

* fix: handle None agent names in mixins to prevent log/session ID issues

- Fix ChatHandlerMixin to use proper None check for agent names
- Fix SessionManagerMixin to sanitize session IDs and prevent None prefixes
- Ensure consistent 'Agent' fallback across both mixins for nameless agents
- Address reviewer feedback from qodo-code-review and gemini-code-assist

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-04-01 19:56:50 +01:00
4ee7d298c8 feat(sandbox): add SandlockSandbox for kernel-level isolation (#1255)
* feat(sandbox): add SandlockSandbox for kernel-level isolation

Implements SandlockSandbox that provides kernel-level code execution
isolation using Landlock + seccomp-bpf, addressing security gaps in
the current subprocess-based sandbox.

Security improvements:
- Landlock filesystem allowlisting (blocks /etc/passwd, SSH keys, etc.)
- seccomp-bpf syscall filtering
- Network domain/port control
- Resource limits with ~5ms overhead
- No Docker or root required

Features:
- Implements existing SandboxProtocol for drop-in compatibility
- Optional dependency with graceful fallback to SubprocessSandbox
- Comprehensive test suite with security violation testing
- Example and documentation included

Resolves: #1253

Co-authored-by: Mervin Praison <[email protected]>

* fix(sandbox): address review findings in SandlockSandbox

- Security: replace lstrip('/') with _safe_sandbox_path() using os.path.realpath()
  to block path-traversal in write_file/read_file/list_files; tighten check to
  reject paths resolving exactly to the sandbox root (directory writes)
- Correctness: replace deprecated asyncio.get_event_loop() with get_running_loop()
- DRY: extract shared execution logic into _run_sandlocked() private helper
- Dead code: remove unused self._sandbox attribute and code_file variables
- Simplify: is_available uses self._sandlock directly (import enforced in __init__)
- Tests: fix unreliable builtins.__import__ patch; update asyncio mocking to
  get_running_loop; add path-traversal tests; fix SecurityViolationError test to
  use distinct exception classes

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/c46e5ff2-ff2d-4bc7-9bcc-5426981ef322

Co-authored-by: MervinPraison <[email protected]>

* chore: remove accidentally committed egg-info from PR

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/c46e5ff2-ff2d-4bc7-9bcc-5426981ef322

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-04-01 19:47:27 +01:00
MervinPraison 1ae86076a9 fix(ci): strictly bind claude assistant invocation to explicit @claude mentions in issue comments 2026-04-01 19:38:27 +01:00
MervinPraison 7def9a68fa chore(ci): consolidate claude workflow entirely into claude.yml and disable all competing agents 2026-04-01 19:31:13 +01:00
dependabot[bot] 99cdf47b09 chore(deps): bump lodash (#1229)
Bumps the npm_and_yarn group with 1 update in the /src/praisonai directory: [lodash](https://github.com/lodash/lodash).


Updates `lodash` from 4.17.21 to 4.17.23
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-01 19:15:23 +01:00
7bb1ca97f5 fix: add defensive wrappers for mem0 MongoDB vector store compatibility (#1251)
- Add _safe_mem0_search() wrappers in Memory and Mem0Adapter classes
- Catch TypeError: 'unexpected keyword argument vectors' gracefully
- Return empty results instead of crashing on MongoDB incompatibility
- Add informative warnings referencing upstream mem0 bug #3185
- Recommend Qdrant/Chroma as alternative vector store backends
- Maintain full backward compatibility for working configurations

Addresses upstream mem0 issue: https://github.com/mem0ai/mem0/issues/3185
Fixes: mem0 MongoDB vector store broken — signature mismatch + Atlas-only requirement

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
2026-04-01 19:13:05 +01:00
9ba435f147 feat: enhance evaluation framework with EvalSuite, ComparisonEval, and SafetyEval (#1246)
* feat: enhance evaluation framework with EvalSuite, ComparisonEval, and SafetyEval

- Add EvalSuite orchestrator for running multiple evaluations with aggregated results
- Add ComparisonEval for side-by-side A/B testing of agent outputs across criteria
- Add SafetyEval for detecting harmful/biased/inappropriate content across 6 categories
- Update eval/__init__.py with new exports and lazy loading
- Add comprehensive unit tests for all new components (150+ test cases)
- Follow protocol-driven architecture with zero performance impact
- Maintain backward compatibility with existing eval framework

Addresses #1245

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix(eval): resolve critical issues and add real agentic tests

- Add missing _make_llm_call method to BaseLLMGrader for ComparisonGrader and SafetyGrader
- Fix after_run() calls to pass required result parameter
- Fix winner parsing logic to prevent 'Agent B' misclassification as 'agent_a'
- Fix safety score parsing to prevent LLM override of worse category scores
- Fix EvalSuite fail_fast behavior to properly re-raise RuntimeError
- Add support for AccuracyResult avg_score in EvalSuite scoring
- Fix Python type hints compatibility (tuple[str,str] → tuple)
- Add comprehensive real agentic integration tests that call agent.start()

Addresses all critical issues identified in code reviews and fulfills
AGENTS.md Section 9.4 requirement for real agentic tests.

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: MervinPraison <[email protected]>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: praisonai-triage-agent[bot] <272766704+praisonai-triage-agent[bot]@users.noreply.github.com>
2026-04-01 19:11:52 +01:00
MervinPraison 8582562e45 docs: auto-update api.md [skip ci] 2026-04-01 18:09:14 +00:00
Mervin Praison 76c1248e38 Merge pull request #1252 from MervinPraison/claude/issue-1250-20260401-1630
feat: move multi-backend storage adapters to wrapper following AGENTS.md
2026-04-01 19:08:58 +01:00
copilot-swe-agent[bot]andMervinPraison 4ca5867075 fix: address security and correctness issues in storage adapters
- PostgreSQL: validate table name against safe identifier regex to
  prevent SQL injection via user-controlled table parameter
- MongoDB: escape regex metacharacters in list_keys prefix to prevent
  ReDoS / unexpected pattern matching
- MongoDB: use $setOnInsert for created_at so it is preserved on
  update (was being overwritten on every save)
- DynamoDB: replace raw string FilterExpression with proper Boto3
  Attr().begins_with() condition in list_keys
- DynamoDB: remove redundant boto3 import in _create_table (already
  imported in _get_table)

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/c012c607-294a-4cef-864d-91a2bccca2dd

Co-authored-by: MervinPraison <[email protected]>
2026-04-01 17:37:40 +00:00
MervinPraison ce7d9815aa fix: implement proper lazy loading for storage adapters
- Remove eager module-level imports of heavy backends (Redis/MongoDB/PostgreSQL/DynamoDB)
- Implement lazy loading in get_backend() function using getattr() only when needed
- Update __all__ exports to only include lightweight backends
- Add module-level __getattr__ for backward compatibility
- Follow praisonaiagents/db pattern for proper separation of core vs wrapper

Fixes critical architectural violation where heavy wrapper dependencies
were being imported at module level, breaking the lazy loading design.

Core SDK imports now work without wrapper package (< 50ms import time).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>
2026-04-01 17:27:48 +00:00
MervinPraison 6a531ac1da feat(ci): unify claude evaluation prompts to process ALL bot reviewers 2026-04-01 18:15:06 +01:00
MervinPraison cc6116b888 feat(ci): enhance claude-after-gemini prompt for strict issue fixing 2026-04-01 18:13:22 +01:00
MervinPraison d933eebeaf feat(ci): auto-trigger Claude after Gemini code assist 2026-04-01 18:08:45 +01:00
MervinPraison 2c683af1cd fix(ci): trigger review chain on triage-agent PRs 2026-04-01 18:03:39 +01:00
MervinPraison a1b6989840 docs(workflows): codify manager-agent philosophy for issue triage 2026-04-01 17:48:15 +01:00
MervinPraisonandMervin Praison 98a878673a feat: move multi-backend storage adapters to wrapper following AGENTS.md
- Move Redis, MongoDB, PostgreSQL, and DynamoDB storage adapters from core SDK to wrapper
- Implement lazy proxy pattern following praisonaiagents.db model
- Add optional dependencies [redis], [mongodb], [postgresql], [dynamodb] to wrapper
- Core SDK now protocol-driven only, heavy implementations in wrapper
- Resolves architectural violations from PRs #1241, #1247, #1248

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>
2026-04-01 16:39:08 +00:00
MervinPraison cec46053ab fix(ci): wire gh_token for workflow cascading and allowlist triage bot 2026-04-01 17:12:25 +01:00
MervinPraison ad7445c528 feat(ci): mandate AGENTS.md reading in gemini code modification prompts 2026-04-01 11:56:10 +01:00
MervinPraison 3e2909b926 feat(ci): mandate PR creation and AGENTS.md reading in claude-code-action prompt 2026-04-01 11:54:54 +01:00
MervinPraison ad32470de4 fix(ci): wire claude pro oauth token into triage workflows 2026-04-01 10:38:28 +01:00
MervinPraison 5dd9bdb96f chore: migrate github actions to use dedicated github app for rate limit bypass 2026-04-01 10:06:45 +01:00
MervinPraison 29b0a6f02e docs: auto-update feature parity trackers [skip ci] 2026-04-01 08:34:46 +00:00
MervinPraison 7a9788c311 fix(qa): resolve missing ephemeral contextmanager and test_mixin_inheritance following god class decomposition 2026-04-01 09:34:29 +01:00
MervinPraison 055d9f5d88 chore: add id-token permission to claude-issue-triage workflow and document OIDC requirements in review-chain instructions 2026-04-01 09:34:29 +01:00
MervinPraison b27ae3a79a feat: extract agent god class into clean chat, execution, memory, and tool mixins 2026-04-01 09:34:29 +01:00
Mervin Praison d0a4796742 Merge pull request #1239 from Sundiver1/fix/pin-axios-supply-chain
Fix: pin axios to 1.8.4 to prevent supply chain compromise
2026-04-01 09:09:38 +01:00
Chris Braley a3ce0f69e3 fix: pin axios to 1.8.4 to avoid supply chain compromise
Compromised versions 1.14.1 and 0.30.4 were removed from npm registry
but semver ranges (^1.7.9) could resolve to malicious versions if
they're re-released or exist in alternate registries.

Pinning to exact version 1.8.4 prevents this attack vector entirely.
2026-04-01 01:55:33 -05:00
Mervin Praison 19929dd9de Merge pull request #1238 from MervinPraison/fix/gha-claude-oidc-token
fix(gha): Add id-token write permission and switch to GH_TOKEN for Claude actions
2026-04-01 07:36:29 +01:00
MervinPraison 36c2e76ca4 fix(gha): Add id-token write permission and switch to GH_TOKEN for Claude actions
Fixes OIDC token fetch failure and 401 Bad Credentials errors in claude.yml and claude-issue-triage.yml.
2026-04-01 07:36:24 +01:00
Mervin Praison a0e4a765ff Merge pull request #1237 from MervinPraison/fix/dynamic-interactive-runtime
feat: Dynamically load InteractiveRuntime for ACP/LSP in YAML workflows
2026-04-01 07:26:38 +01:00
MervinPraison 18a3d26620 feat: Dynamically load InteractiveRuntime for ACP/LSP in YAML workflows 2026-04-01 07:26:33 +01:00
Mervin Praison cbec55cf44 fix: Update valid inputs for claude-code-action in issue triage (#1236)
fix: Update valid inputs for claude-code-action in issue triage
2026-04-01 07:22:32 +01:00
MervinPraison f96eebb5e8 fix: Update valid inputs for claude-code-action in issue triage
The base claude-code-action does not accept 'prompt_file' or 'install_github_mcp'.
This routes the prompt properly through 'direct_prompt' using GitHub step outputs.
2026-04-01 07:22:19 +01:00
Mervin Praison 6fa8eebab1 fix: Cleanup dead acp_enabled and lsp_enabled code from YAML workflow generator (#1234)
fix: Cleanup dead acp_enabled and lsp_enabled code from YAML workflow generator
2026-04-01 07:15:46 +01:00
MervinPraison 9702a2a99c fix: Cleanup dead acp_enabled and lsp_enabled code from YAML workflow generator
Closes #1233
Removes dead code path to ensure alignment with AgentTeam __init__ signature.
2026-04-01 07:15:21 +01:00
MervinPraison 969c21f617 Release v4.5.109 2026-04-01 07:03:13 +01:00
MervinPraison 8b5b67852a docs(README): fix list formatting for TAVILY_API_KEY instruction
Adjusted the formatting of the TAVILY_API_KEY instruction for consistency.
2026-03-31 23:30:30 +01:00
MervinPraison 019ecea1a4 docs(README): add environment variable setup instruction
Added a line to specify the export command for setting the TAVILY_API_KEY. This addition improves clarity for users configuring the environment.
2026-03-31 23:30:03 +01:00
MervinPraison fab53bf095 Release v4.5.108 2026-03-31 23:25:49 +01:00
MervinPraison d6bcd522ed docs: rename AgentClaw to PraisonAI Claw in README 2026-03-31 23:14:09 +01:00
MervinPraison 8769a3bdb8 Release v4.5.107 2026-03-31 23:01:40 +01:00
MervinPraison bfda2ff1db Merge branch 'main' of https://github.com/MervinPraison/PraisonAI 2026-03-31 23:00:00 +01:00
MervinPraison 0a7d4187ad feat(docs): add PraisonAI UI installation instructions and details
Updated README.md to include a new section for the PraisonAI UI,
providing installation instructions and a brief description.
Bumped version numbers in pyproject.toml and lock files to
reflect changes and dependency updates.
2026-03-31 22:59:52 +01:00
MervinPraison b0222c4fae docs: auto-update api.md [skip ci] 2026-03-31 21:55:00 +00:00
MervinPraison 1c901be114 Release v4.5.106 2026-03-31 22:54:43 +01:00
MervinPraison 534594103d Release v4.5.105 2026-03-31 22:34:12 +01:00
MervinPraison 17d7ddd0f7 Release v4.5.104 2026-03-31 22:11:57 +01:00
MervinPraison c546d2c2c9 chore(.github): update agentflow.gif with larger file size for better quality 2026-03-31 22:06:10 +01:00
MervinPraison 13267e5325 Release v4.5.103 2026-03-31 22:04:13 +01:00
MervinPraison f188ae1ff9 Release v4.5.102 2026-03-31 21:37:29 +01:00
MervinPraison 17ca3f8f48 Release v4.5.101 2026-03-31 21:16:53 +01:00
MervinPraison ed76058630 Release v4.5.100 2026-03-31 19:31:04 +01:00
MervinPraison 9b50b4069f feat(PraisonAI): update version and enhance agent memory functionality
Updated package version to 1.5.99 and introduced new memory handling
features in PraisonAI components. Added configuration for session
tracking in memory save. Included additional tests for agent and task
components to ensure correct functionality and integration.
2026-03-31 19:12:12 +01:00
MervinPraison 9ad41a8ec5 Release v4.5.98 2026-03-31 18:54:52 +01:00
MervinPraison 3f77e93840 Release v4.5.96 2026-03-31 18:46:49 +01:00
MervinPraison 06eb6b197c Release v4.5.97 2026-03-31 16:23:39 +01:00
MervinPraison d476379f45 chore: bump praisonaiagents to 1.5.95 2026-03-31 16:23:06 +01:00
MervinPraison d1034adc19 refactor: harden input validation and access controls 2026-03-31 16:20:54 +01:00
MervinPraison ee8d0cf4c3 chore(migration): remove outdated MIGRATION.md file
Deleted the deprecated migration guide as it is no longer relevant.
2026-03-31 16:15:17 +01:00
MervinPraison acad479b19 chore(images): move assets to .github folder and update paths
Relocated image assets from the public directory to the .github/images directory. Updated references in README files to reflect the new asset locations. Added a new GIF asset for showcasing command execution. Total of 14 files changed with 16 insertions and 8 deletions.
2026-03-31 16:13:35 +01:00
MervinPraison 1eb22d74e9 Release v4.5.96 2026-03-31 15:47:09 +01:00
MervinPraison 381c7448ea Release v4.5.95 2026-03-31 15:39:40 +01:00
MervinPraison 13c984d1aa Release v4.5.94 2026-03-31 15:21:59 +01:00
MervinPraison b04513493e docs: auto-update api.md [skip ci] 2026-03-31 13:52:11 +00:00
MervinPraison 3a209d7c36 Release v4.5.93 2026-03-31 14:51:48 +01:00
MervinPraison eb15d66e96 ci: add architecture validation guardrails to Claude agent prompt
- STEP 0: Set git identity to MervinPraison for all commits
- STEP 2: Mandatory bloat validation checklist before writing code
- Checks: protocol-driven design, no heavy impls in core SDK, no duplication,
  proper Agent inheritance, lazy imports, no agent.py growth, no name collisions
- If checks fail: close issue with explanation instead of creating bad PRs
2026-03-31 13:18:22 +01:00
MervinPraison 54ddbaf298 ci: use PAT_TOKEN for claude issue triage so comments appear as MervinPraison 2026-03-31 12:55:03 +01:00
MervinPraison 18b7dc1687 ci: use PAT_TOKEN for claude action so PRs open as MervinPraison 2026-03-31 12:41:08 +01:00
MervinPraison 10869d7570 ci: fix duplicate claude action runs on issue labeled events 2026-03-31 12:38:45 +01:00
MervinPraison c796f75b41 update 2026-03-31 12:24:09 +01:00
MervinPraison 79cda2604b Release v4.5.90 2026-03-31 11:07:00 +01:00
MervinPraison 7659748515 chore: bump praisonaiagents to 1.5.91 2026-03-31 11:04:38 +01:00
MervinPraison aa092c2c3f chore: bump praisonaiagents to 1.5.90 2026-03-31 11:00:34 +01:00
MervinPraison dc69cbc121 refactor: harden input validation and query parameterization
- Strengthen attribute access guards in code execution sandbox
- Parameterize SQL IN clauses in data layer
- Add URL scheme validation for API base URLs
- Use plain string matching instead of regex for tool search
2026-03-31 10:59:47 +01:00
MervinPraison 60121929d0 docs: auto-update api.md [skip ci] 2026-03-31 09:15:54 +00:00
Mervin Praison 6646dd1a4c refactor: SDK Architecture - Centralize Logging and Retry Logic (#1212)
Merges centralized logging (_logging.py, 152 files migrated) and resilience utility (utils/resilience.py). Also fixes CI/CD workflows and test fixtures.

Closes #1131 #1132
2026-03-31 10:15:32 +01:00
MervinPraison ba3a3c3ee0 fix(ci): optimize CI/CD workflows and harden test fixtures
- Remove unittest.yml (517-line debug file, always failed exit 5)
- Fix test-core.yml: deprecated codecov 'file:' -> 'files:' input
- Fix test-optimized.yml: move secrets from inline shell expressions
  to env: blocks to resolve linter context access warnings
- Fix test_serve_integration.py: replace 6x hardcoded /Users/praison paths
  with dynamic pathlib resolution (portable on any CI runner)
- Fix test_tracker_complex_tasks.py: DEFAULT_TOOLS -> AUTONOMY_DEFAULT_TOOLS
  (symbol was renamed in tracker.py, causing ImportError in CI)

Resolves GitHub Actions lint IDs:
7c7e1668 1d881864 aa30b182 a28bb9f7 ca2c8cc1 132d4548
a2735061 d3729ccb 333ae3f5 f3aca47c 7353e2c3 6d3216de
2026-03-31 09:51:45 +01:00
MervinPraison b965bb1011 Release v4.5.89 2026-03-31 09:45:58 +01:00
MervinPraison 4d13ab4af7 fix(logging): improve logger level settings across multiple modules
Updated logger level settings to use consistent DEBUG and WARNING levels
based on the verbosity of the application. This enhances logging clarity
and ensures that third-party loggers are set to WARNING by default.
Adjusted imports to maintain consistent logging behavior across various
modules for better maintainability. Additionally, bumped version in
pyproject.toml to 1.5.89.
2026-03-31 09:45:22 +01:00
MervinPraison 84c4d221a2 refactor: centralize logging and retry logic (#1131, #1132) 2026-03-31 08:59:15 +01:00
MervinPraison 64ae40e369 docs: auto-update feature parity trackers [skip ci] 2026-03-31 07:02:09 +00:00
Mervin Praison 0f5849b734 Merge pull request #1184 from MervinPraison/claude/remaining-thread-safety-fixes
Tool registry thread safety - MERGEABLE, covers gap not addressed by #1175/#1176. Unit tests: 4473 passed. Integration: 294 passed.
2026-03-31 08:01:58 +01:00
Mervin Praison 3a2a2f8592 Merge pull request #1185 from MervinPraison/claude/fix-agent-type-hints-20260330
Type hints PR - MERGEABLE, low risk, improves IDE support. Unit tests: 4473 passed. Integration: 294 passed.
2026-03-31 08:01:49 +01:00
MervinPraison 3193d19a5c Release v4.5.88 2026-03-31 07:16:42 +01:00
MervinPraison 3468f7743f fix(pyproject.toml, uv.lock): update version to 1.5.88
Bumped the version number for praisonaiagents from 1.5.87 to 1.5.88 in both pyproject.toml and uv.lock files to reflect the latest changes.
2026-03-31 07:16:08 +01:00
MervinPraison a5dc5fae0e feat(examples): add social media cross-posting and video generation examples
- Introduced a new agent for cross-posting on multiple social media platforms with required environment variables.
- Added a video generation example using HeyGen and ElevenLabs, demonstrating autonomous video production.
- Created YAML workflow for sequential multi-agent processing in video generation.
- Updated several test files to accommodate new features and examples.
2026-03-31 07:12:52 +01:00
MervinPraison ffd78f0eb6 ci: increase core test timeout to 20min (was timing out at 10min) 2026-03-31 05:53:05 +01:00
MervinPraison 727967f459 docs: auto-update api.md [skip ci] 2026-03-31 04:42:26 +00:00
MervinPraison 9f45a221e6 fix: critical post-merge fixes for agent.py, sandbox, circuit breaker, and test infrastructure
## Critical Fixes:
- **agent.py (IndentationError)**: Removed 137 lines of orphaned MCP code (lines 8849-8983)
  that caused an IndentationError on import, completely breaking the SDK. This was
  dead code from a bad merge — partially commented out code with live import statements.

- **python_tools.py (Sandbox)**: Fixed subprocess sandbox that was too restrictive:
  - Added missing builtins: getattr, ValueError, TypeError, KeyError, etc.
  - Added __build_class__ for function/class definition support
  - Fixed exec() to use shared globals so defined functions can see each other
  - Added _safe_getattr wrapper in subprocess for defense-in-depth dunder blocking

- **circuit_breaker.py**: Fixed reset_all() to clear registry entries (not just reset state)

## Test Fixes:
- test_circuit_breaker.py: Fixed success_threshold mismatch, added setup/teardown cleanup
- test_tools_reliability.py: Fixed psutil mock injection for lazy-imported modules
- test_python_tools_sandbox.py: Updated security test expectations for sandbox mode
- Added __init__.py files to 13 test subdirectories for pytest module resolution

## Metrics:
- agent.py: 9053 → 8916 lines (-137 lines of dead code)
- Import time: 67.5ms (well under 200ms target)
- Unit tests: 4473 passed, 50 skipped (7 pre-existing failures)
2026-03-31 05:42:04 +01:00
MervinPraison 3924bcea86 docs: auto-update api.md [skip ci] 2026-03-30 23:06:51 +00:00
github-actions[bot]andMervin Praison 8dc3136af8 fix: resolve async/concurrency safety violations in core SDK (#1206)
- Fix asyncio.run() from async context in context/aggregator.py using ThreadPoolExecutor
- Add async version of Gemini research polling using asyncio.sleep() instead of time.sleep()
- Replace deprecated asyncio.get_event_loop() with asyncio.get_running_loop() in async contexts
- Update core modules: agent/, approval/, context/, memory/, tools/, llm/
- Maintain backward compatibility with proper sync-to-async error handling
- Ensure multi-agent workflows no longer block event loop during polling

Resolves #1162

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:06:22 +01:00
github-actions[bot]andMervin Praison 0e80a58ccd refactor: decompose monolithic agent.py and memory.py into focused modules (#1204)
- Split agent.py (8920 lines) into 3 focused mixins:
  - tool_execution.py - Tool calling and execution logic
  - chat_handler.py - Chat and conversation management
  - session_manager.py - Session persistence and state management

- Split memory.py (2023 lines) into 4 focused modules:
  - core.py - Core Memory class and quality scoring
  - storage.py - Storage and persistence functionality
  - search.py - Search and retrieval operations
  - utils.py - Shared utility functions

- Maintained 100% backward compatibility via mixin inheritance
- Updated __init__.py files with lazy loading for new modules
- Follows protocol-driven architecture from AGENTS.md

Resolves #1139

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:06:14 +01:00
github-actions[bot]andMervin Praison 751f9b6f77 feat: implement protocol-driven architecture for core SDK (#1202)
- Add HttpLauncherProtocol and McpLauncherProtocol in agent/protocols.py
- Refactor Agent.launch() to delegate to protocol-specific launchers
- Create memory/adapters/ directory with SqliteMemoryAdapter
- Extract MongoDBMemory to knowledge/adapters/mongodb_adapter.py
- Update Knowledge class to use lazy-loaded MongoDB adapter
- Maintain full backward compatibility while following AGENTS.md guidelines
- Implement lazy imports to avoid heavy dependencies in core SDK
- Fix architectural violations: HTTP server, memory factory, MongoDB in core

Resolves core SDK violating protocol-driven architecture (god object)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:06:09 +01:00
github-actions[bot]andMervin Praison cec725f7ee feat: implement circuit breaker pattern for external service calls (#1201)
- Add lightweight CircuitBreaker class with open/half-open/closed states
- Integrate with existing retry utilities in tools/retry.py
- Add health monitoring and graceful degradation support
- Provide integration helpers for LLM, Memory, and MCP systems
- Include comprehensive tests with real agentic test
- Maintain backward compatibility and zero performance regression
- Follow protocol-driven architecture from AGENTS.md

Fixes #1141

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:06:04 +01:00
MervinPraison 4804a4d7ee docs: auto-update api.md [skip ci] 2026-03-30 23:06:02 +00:00
github-actions[bot]andMervin Praison 8fa99cea83 feat: add unified configuration resolver to address scattered env var reads (#1196)
- Create centralized config/resolver.py with protocol-driven design
- Add ConfigRegistry for tracking all environment variables
- Implement caching and type conversion for performance
- Add validation to warn about unknown/deprecated vars
- Extend 'praison config' CLI with env discovery and validation
- Maintain 100% backward compatibility with existing os.getenv() usage
- Follow AGENTS.md principles: protocol-driven, no performance impact

Fixes #1140 - 317+ scattered env var reads now have unified entry point

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:52 +01:00
github-actions[bot]andMervin Praison 08c40f17d8 fix: Critical thread-safety gaps in multi-agent concurrent execution (#1193)
- Add global server state lock (_agents_server_lock) to protect FastAPI endpoint registration
- Add task ID assignment lock (_task_id_lock) to prevent race conditions in parallel execution
- Add state mutation lock (_state_lock) to protect AgentTeam shared variables and _state
- Thread-safe protection for all critical sections in server startup and state management

Fixes #1152

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:44 +01:00
MervinPraison 6120623e21 docs: auto-update feature parity trackers [skip ci] 2026-03-30 23:05:34 +00:00
github-actions[bot]andMervin Praison 9b365e6594 fix: replace silent exception swallowing with structured logging (#1207)
Fixes issue #1128 by systematically replacing problematic exception
handling patterns that were masking real errors and making debugging
extremely difficult.

Changes:
- Replace bare 'except:' clauses with 'except Exception:' to avoid
  catching SystemExit/KeyboardInterrupt
- Add structured debug logging for all previously silent exceptions
- Maintain backward compatibility and zero performance impact
- Focus on core SDK modules: memory, tools, LLM, telemetry

Key areas fixed:
- Memory operations: Now log failed tracing and cleanup operations
- Telemetry: Debug logging for PostHog failures and queue errors
- LLM client: Debug logging for cost calculation and display failures
- Tools: Debug logging for browser checks and capability detection
- Code execution: Debug logging for temp file cleanup failures

All exception handling now provides context for debugging while
maintaining the fail-safe behavior required for production use.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:22 +01:00
github-actions[bot]andMervin Praison 804cacbda4 fix: eliminate duplicated approval logic in sync/async tool execution paths (#1194)
- Extract shared `_resolve_approval_decision()` method to consolidate ~50-60 lines of duplicated code
- Maintain backward compatibility and zero performance regression
- Handle sync vs async execution paths correctly with `is_async` parameter
- Improve code maintainability by following DRY principle from AGENTS.md
- Fix properly handles both dangerous and non-dangerous tools in async context

Resolves issue #1147

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:18 +01:00
github-actions[bot]andMervin Praison 4fe4c27516 feat: implement unified deprecation management system (#1192)
- Create centralized @deprecated decorator with version tracking
- Add warn_deprecated_param() for consistent parameter warnings
- Add MIGRATION.md with comprehensive deprecation guide
- Update 7 key files to use unified deprecation system
- Add version-based removal timeline (deprecated in 1.0.0, removed in 2.0.0)
- Ensure backward compatibility with zero breaking changes
- Add expiration detection for future CI integration

Fixes #1135

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:13 +01:00
github-actions[bot]andMervin Praison 1af11908de fix: enhance thread safety in multi-agent scenarios (#1191)
- Add thread-safe caching for tools module lazy loading with double-check pattern
- Enable SQLite WAL mode for better concurrent write safety in storage backend
- Add async lock infrastructure for process workflow shared state protection
- Maintain backward compatibility and zero performance regression

Addresses issue #1163: Core SDK global mutable state without thread safety

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:05:08 +01:00
c634969263 fix: enhance centralized logging with structured logging support (#1187)
* fix: enhance centralized logging with structured logging support

- Enhanced existing _logging.py with get_logger() utility for consistent naming
- Added StructuredFormatter for JSON logging in production environments
- Enforced 'praisonaiagents.<module>' naming convention automatically
- Added optional extra_data parameter for structured logging context
- Exposed logging utilities in __init__.py for easy import
- Updated example modules to demonstrate new patterns
- Added comprehensive LOGGING.md documentation
- Maintained 100% backward compatibility with existing code
- Zero performance impact for existing logging patterns

Addresses #1132: Consolidates 53+ scattered logger instances with unified configuration

Co-authored-by: Mervin Praison <[email protected]>

* fix: address review issues in centralized logging enhancements

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/10430b96-89ed-4e3b-98bf-8e68fd28366e

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-03-31 00:05:04 +01:00
MervinPraison 80b10518dc docs: auto-update feature parity trackers [skip ci] 2026-03-30 23:04:53 +00:00
github-actions[bot]andMervin Praison 259705e230 Add YAML config parity with CLI flags for trust, tool-timeout, planning-tools, ACP, LSP (#1203)
Resolves #1146 by implementing the missing YAML configuration options:

- trust: Agent-level trust configuration (maps to --trust CLI flag)
- tool_timeout: Agent-level timeout setting (maps to --tool-timeout CLI flag)
- planning_tools: Agent-level planning tools (maps to --planning-tools CLI flag)
- acp: Global ACP tools configuration (maps to --acp CLI flag)
- lsp: Global LSP tools configuration (maps to --lsp CLI flag)

Changes:
- Enhanced AgentsGenerator to accept cli_config parameter for CLI overrides
- Added _merge_cli_config method to merge CLI settings with YAML config
- Updated all AgentsGenerator instantiation points to pass CLI configuration
- Added _extract_cli_config_for_yaml helper method to extract relevant CLI flags
- Maintained full backward compatibility with existing YAML files

YAML Schema additions support both agent-level and global configuration:

```yaml
agents:
  researcher:
    trust: true
    tool_timeout: 120
    planning_tools: [web_search]

config:
  acp: true
  lsp: true
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:04:42 +01:00
github-actions[bot]andMervin Praison dd41c1ba01 fix: secure python_tools.py exec() with subprocess sandbox (#1199)
- Add code_sandbox_mode parameter to ExecutionConfig (default: 'sandbox')
- Implement _execute_code_sandboxed() using subprocess isolation
- Maintain backward compatibility with 'direct' mode (legacy)
- Subprocess sandbox runs in clean environment (no env vars, files, network)
- Same security validations: AST parsing + text pattern blocking
- Zero performance regression: lazy imports, same API
- All existing security tests pass
- Safe by default: new installs use sandboxed mode

Resolves security vulnerability where exec() ran in same process
with access to filesystem, network, and environment variables.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:04:38 +01:00
github-actions[bot]andMervin Praison e32cccf62a feat: expand LLM integration test coverage for specialized agents (#1197)
- Add comprehensive @pytest.mark.live tests for 11 specialized agents:
  CodeAgent, VisionAgent, AudioAgent, VideoAgent, OCRAgent, RealtimeAgent,
  DeepResearchAgent, ImageAgent, RouterAgent, ContextAgent, EmbeddingAgent
- Add multi-agent workflow integration tests:
  Sequential, hierarchical, and parallel process types with real LLM calls
- Add tool usage integration tests: web search, Python execution, multi-tool
- Add memory integration tests: persistence across sessions, search, long-term
- Add knowledge/RAG integration tests: document processing, citations, synthesis
- Add MCP integration tests: server connection, tools, streaming
- Add error recovery tests: LLM timeouts, tool failures, graceful degradation

All tests follow existing safety infrastructure with PRAISONAI_LIVE_TESTS=1
gating and @pytest.mark.live markers. Addresses missing real agentic test
coverage identified in issue #1136.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-31 00:04:33 +01:00
de668f1912 fix: implement token tracking in RouterAgent for cost observability (#1190)
* fix: implement token tracking in RouterAgent for cost observability

- Add TokenUsage dataclass with structured token consumption data
- Enhance LLM.get_response() with optional return_token_usage parameter
- Update RouterAgent to track tokens and costs per model selection
- Emit token usage via existing trace infrastructure for observability
- Maintain full backward compatibility with zero performance regression

Resolves issue #1138 - RouterAgent now provides complete cost visibility
for multi-agent routing scenarios, addressing the TODO at line 234.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* fix: correct critical bugs in _prepare_return_value token tracking

- Move _prepare_return_value closure to before the try block in
  get_response() so it's defined before use
- Fix infinite recursion: both branches called themselves instead
  of returning the text value
- Revert _prepare_return_value usage from 7 out-of-scope methods
  (_process_stream_delta, get_response_async, _extract_from_responses_output,
  _stream_responses_api, _stream_responses_api_async, response, aresponse)
  where it was a NameError and would corrupt return tuple structure

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/1b069906-c514-4c5f-8c93-34c345db5fd0

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-03-31 00:04:28 +01:00
cfe8277638 feat: implement missing P0 parity features for TypeScript SDK (#1188)
* feat: implement missing P0 parity features for TypeScript SDK

- Add BudgetExceededError class for budget limit handling
- Add get_registry() function for Python SDK parity
- Add get_tool() function to get single tool by name
- Add register_tool() function for tool registration
- Add validate_tool() function for tool validation
- Update PARITY.md to reflect completed P0 features (0 remaining)
- Reduce total gap count from 23 to 18

Resolves critical P0 parity gaps identified in issue #1127

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: align BudgetExceededError with Python SDK, add camelCase aliases, fix validate_tool undefined bug, add tests

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/9ee9003d-3264-405d-bd0c-f839753cf227

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-03-31 00:04:24 +01:00
a8a47c7b7f Security: Replace unsafe eval()/exec() with safe expression evaluators (#1186)
* security: Replace unsafe eval()/exec() with safe expression evaluators

- Fix ai_generator.py: Replace eval() with safe AST-based calculator
- Fix job_workflow.py: Replace eval() with safe AST evaluation for conditions
- Fix hybrid_workflow.py: Replace eval() with safe AST evaluation for conditions
- singlestore_vector.py: Already fixed (uses json.loads + ast.literal_eval)
- python_tools.py: Already has comprehensive security measures

All fixes maintain backward compatibility while eliminating arbitrary code
execution vulnerabilities. Implements defense-in-depth with AST validation
and operator-based evaluation instead of eval().

Fixes #1157

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: address review findings in _safe_eval_ast implementation

Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/557089b9-dfe4-460b-95db-f80857c916c6

Co-authored-by: MervinPraison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MervinPraison <[email protected]>
2026-03-31 00:04:19 +01:00
MervinPraison 8a803888ea fix: use GITHUB_TOKEN for copilot, SECRETS_ADMIN_PAT for cross-repo docs 2026-03-30 22:31:50 +01:00
MervinPraison e33710e63a fix: make docs parity checkout non-fatal when GH_TOKEN lacks repo access
GH_TOKEN PAT may not have access to PraisonAIDocs. Workflow now
gracefully skips docs-related steps if checkout fails.
2026-03-30 21:35:01 +01:00
MervinPraison 7f2976c1ff fix: use GH_TOKEN (existing secret) instead of non-existent PAT_TOKEN
PAT_TOKEN secret doesn't exist. GH_TOKEN is the actual PAT secret
that's configured in the repo.
2026-03-30 21:33:06 +01:00
MervinPraison 0c8ff4b1ee fix: use PAT_TOKEN for docs parity tracker checkout 2026-03-30 21:31:12 +01:00
github-actions[bot]andMervin Praison d143cce2f9 fix: Add comprehensive type hints to Agent class public methods
Fixes identified issues from PR #1179:
- Add type hints to chat(), run(), start(), execute_tool(), execute() methods
- Fix ephemeral() return type to Generator[None, None, None] for context manager
- Add Optional[str] return types for methods that can return None (chat, run, execute)
- Add type hints to all property getters and setters
- Add type annotations to **kwargs parameters

This resolves type checker warnings and improves IDE autocompletion support.

Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 20:30:52 +00:00
MervinPraison 1260ede088 Release v4.5.87 2026-03-30 21:30:44 +01:00
MervinPraison 2a463d6b39 docs: auto-update feature parity trackers [skip ci] 2026-03-30 20:29:55 +00:00
MervinPraison 10068583bb fix: add missing pyyaml dep for parity tracker, use PAT_TOKEN fallback for docs checkout
Feature Parity Tracker failed: ModuleNotFoundError: No module named 'yaml'
Docs Parity Tracker failed: Input required and not supplied: token
2026-03-30 21:29:36 +01:00
github-actions[bot]andMervin Praison 9bb149a244 fix: improve thread safety in tool registry
- Use thread-safe registry.unregister() in remove_tool()
- Use thread-safe registry.list_tools() in list_tools()
- Add double-checked locking to get_registry() singleton
- Prevents race conditions in multi-agent deployments

Related to #1167 and closed PR #1182

Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 20:28:22 +00:00
MervinPraison beb3e0a644 ci: use MervinPraison as commit author in all CI workflows
Previously github-actions[bot] appeared as co-author on auto-commits,
polluting the contributor graph.
2026-03-30 21:28:13 +01:00
6a90cc07ee fix: Async correctness - avoid asyncio.run() from sync context reachable by async callers (#1176)
* fix: async correctness in tool approval - prevent RuntimeError in async workflows

* Add event loop detection in _check_tool_approval_sync()
* Use thread pool fallback when already in async context
* Prevents 'asyncio.run() cannot be called from a running event loop' crash
* Maintains backward compatibility with sync usage
* Follows existing pattern from registry.py and backends.py

Fixes #1165

Co-authored-by: Mervin Praison <[email protected]>

* fix: address reviewer feedback on async correctness fix

- Add concurrent.futures import to top of agent.py (per Gemini review)
- Create shared approval/utils.py to eliminate code duplication (per Qodo/Coderabbit)
- Fix timeout configuration to respect agent's _approval_timeout semantics (per all reviewers)
- Replace ThreadPoolExecutor context manager with proper shutdown handling (per Coderabbit)
- Remove redundant loop.is_running() check (per Copilot)
- Consolidate async-to-sync bridging logic across approval system

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 21:23:23 +01:00
github-actions[bot] ffb9bd157e docs: auto-update api.md [skip ci] 2026-03-30 20:23:08 +00:00
dd3ccb8b5f fix: SQLite memory/storage layer thread safety for concurrent multi-agent access (#1178)
* fix: implement thread-safe SQLite connections in Memory class

- Add threading.local() for per-thread SQLite connections
- Enable check_same_thread=False for cross-thread access
- Enable WAL mode (PRAGMA journal_mode=WAL) for concurrent read/write
- Replace direct sqlite3.connect() calls with thread-safe getters
- Remove connection.close() calls to enable connection reuse
- Add close_connections() method for proper cleanup

This fixes database corruption and "database is locked" errors in
multi-agent deployments by following the same thread-safe pattern
used in SQLiteBackend class.

Addresses issue #1169: SQLite memory/storage layer unsafe for concurrent
multi-agent access. Tested with 5 concurrent threads performing 20
operations each - 100% success rate.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: enhance SQLite concurrency safety with write locks and connection management

- Add write lock serialization for all SQLite write operations to prevent database lock contention
- Implement proper connection cleanup across threads using connection registry
- Add timeout and busy_timeout configuration for better lock contention handling
- Verify WAL mode enablement with logging for debugging
- Add context manager support and __del__ cleanup for resource management
- Improve error handling with specific error logging instead of silent failures
- Maintain backward compatibility while fixing thread safety issues

Fixes all reviewer issues from Qodo, CodeRabbit, and Copilot feedback.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 21:22:50 +01:00
github-actions[bot] da8786520d docs: auto-update api.md [skip ci] 2026-03-30 20:22:23 +00:00
ed02fc660f fix: Memory subsystem thread safety - synchronized import caches and FileMemory (#1177)
* fix: resolve memory subsystem thread safety race conditions

- Replace unsafe module-level import caches in memory.py with thread-safe implementation using threading.Lock and double-check locking
- Add threading.RLock to FileMemory class to protect all in-memory data structures from concurrent access
- Protect critical operations: add/get/delete operations on _short_term, _long_term, _entities, _summaries lists/dicts
- Use snapshot pattern for search operations to prevent "list changed size during iteration" errors
- Maintain full API compatibility while eliminating TOCTOU race conditions
- Supports multi-agent + async workflows without data corruption or crashes

Fixes #1166

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: complete thread safety implementation for memory subsystem

- Fix broken test: update test_graph_memory.py to use new _module_cache instead of deprecated _chromadb_cache
- Remove unused importlib import from memory.py
- Complete FileMemory lock coverage: add thread-safe protection to all remaining methods:
  * get_all_memories, export, import_data: protect iteration and data access
  * save_session, resume_session: protect memory snapshots and restoration
  * compress: careful lock handling - protect data access but release during LLM calls
  * get_stats: protect memory structure access
  * handle_command: protect entity dictionary iteration

All methods now use consistent self._lock protection while avoiding deadlocks
and ensuring optimal performance during slow operations like LLM calls.

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 21:22:12 +01:00
3c45e6f474 fix: Agent thread safety - eager lock initialization and LRU cache bounds (#1175)
* fix: implement thread safety for Agent class

- Replace lazy lock initialization with eager initialization for chat_history and cache locks
- Add thread-safe methods for chat_history operations: _add_to_chat_history(), _get_chat_history_length(), _truncate_chat_history()
- Implement proper LRU cache eviction using OrderedDict with _cache_put() and _cache_get() methods
- Add snapshot_lock to protect undo/redo stacks from TOCTOU race conditions
- Update critical chat_history and cache operations to use thread-safe methods
- Enforce _max_cache_size limits with LRU eviction instead of simple size checks

Fixes race conditions in multi-agent concurrent workflows where:
- chat_history entries could be silently dropped during tool execution
- cache dictionaries could have interleaved reads/writes
- snapshot/redo stacks had TOCTOU vulnerabilities in pop() operations
- unbounded cache growth in long-running agents

Co-authored-by: Mervin Praison <[email protected]>

* fix: resolve thread safety issues in Agent class

- Move OrderedDict import to module level for better performance
- Add module-level logger to fix undefined logger errors in undo/redo
- Fix critical TOCTOU race in duplicate message check with atomic method
- Initialize snapshot lock unconditionally to prevent AttributeError
- Protect diff() method snapshot stack reads with lock

Addresses reviewer feedback from Qodo, CodeRabbit, and Copilot.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 21:22:05 +01:00
9b85a22b4c fix: implement lazy loading for tools imports to improve package startup time (#1172)
* fix: implement lazy loading for tools imports to improve package startup time

- Remove eager imports of tools modules from __init__.py (lines 63-66, 72)
- Add tools imports to _LAZY_IMPORTS mapping for proper lazy loading
- Create embedding proxy to resolve function vs subpackage conflict
- Maintain 100% backward compatibility with existing imports
- Improve startup performance by loading tools only when accessed

Fixes #1168

This addresses the core SDK eagerly importing heavy modules issue by:
1. Moving from .tools.* imports to lazy loading system
2. Using existing _LAZY_IMPORTS infrastructure
3. Resolving embedding function import conflict via proxy
4. Zero breaking changes to public API

Performance improvement: Base import reduced from heavy module loading
to lightweight protocol-driven imports following AGENTS.md principles.

Co-authored-by: Mervin Praison <[email protected]>

* fix: address lazy loading implementation issues

- Remove eager config import, move to lazy loading in _custom_handler
- Remove heavy modules from fallback_modules to prevent imports on typos
- Add proper tools/config/memory/workflows module access via _custom_handler
- Fix _EmbeddingProxy introspection with __wrapped__ and __signature__ properties
- Remove dead code in _custom_handler for embedding/embeddings
- Clean up duplicate comments and self-referential error messages
- Maintain full backward compatibility while improving startup performance

Fixes all issues identified in code review by Copilot, CodeRabbit, and Qodo.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <[email protected]>

* fix: address lazy loading implementation issues

- Fix _get_embedding_func to avoid overwriting embedding proxy
- Clean up dead code comments
- Update comments for clarity
- All validation tests pass: pa.tools, pa.config, embedding introspection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Mervin Praison <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <[email protected]>
2026-03-30 21:21:57 +01:00
MervinPraison 9a79f2a15d fix(pyproject.toml, uv.lock): update version to 1.5.87
Bump version for praisonaiagents to reflect new release.
2026-03-30 21:20:32 +01:00
MervinPraison 11e449bf43 fix: use PAT_TOKEN for @copilot mentions so they post as MervinPraison
Copilot ignores @copilot mentions from github-actions[bot].
Switching to PAT_TOKEN makes comments appear from a real user.
2026-03-30 21:19:21 +01:00
MervinPraison d9581f39f8 fix: ensure Copilot only triggers AFTER CodeRabbit/Qodo/Gemini complete
Bot PR chain: trigger CodeRabbit + Qodo + Gemini → they post reviews →
copilot-after-coderabbit/qodo fires → Copilot reviews → Claude chains.

Copilot is NEVER triggered directly for bot PRs anymore. It waits
for upstream reviewers to finish first.
2026-03-30 21:09:32 +01:00
MervinPraison 88806ce469 fix: trigger review chain for bot-authored PRs
CodeRabbit and Qodo skip bot-authored PRs by default, breaking the
entire review chain (no reviews → no Copilot → no Claude).

Added bot-pr-review-chain job that fires on PR opened by
github-actions[bot] and directly triggers @coderabbitai, /review,
and @copilot.
2026-03-30 21:06:29 +01:00
MervinPraison 468dffa99d ci: add workflow_dispatch to test-core for manual testing 2026-03-30 19:08:49 +01:00
MervinPraison c1947b9e4b fix: set PYTHONUTF8=1 for Windows CI to handle emoji encoding 2026-03-30 19:04:48 +01:00
MervinPraison 21a3774b63 fix: remove remaining WorkflowStep from Windows CI tests 2026-03-30 19:00:49 +01:00
MervinPraison 2c9b4a5c34 fix: add missing output/models.py and editor.py to git
Root .gitignore line 22 has 'output' which was excluding the
praisonaiagents/output/ module from git. This caused Windows CI
ModuleNotFoundError: No module named 'praisonaiagents.output.models'

Added gitignore exemption and force-added the missing files.
2026-03-30 18:57:05 +01:00
MervinPraison bc0a2a3765 ci: deduplicate and optimize test workflows
DELETED (duplicates):
- unittest.yml: 517-line debug file, always failed (exit 5)
- coverage.yml: merged into test-core.yml

OPTIMIZED:
- test-core.yml: stripped 200+ debug lines, added path filtering
- python-package.yml: moved to schedule-only (weekly multi-version)
- test-extended.yml: moved to schedule-only (benchmarks)
- test-optimized.yml: added path filtering
- test-windows.yml: added path filtering, fixed broken WorkflowStep import

Before: 7 workflows per push (~16 min)
After: 3 workflows per push (~5 min) + path-filtered
2026-03-30 18:52:39 +01:00
MervinPraison b6c10e4040 ci: fix Copilot bot username in chain-claude workflow
Was checking for 'copilot-swe-agent' but actual PR reviewer
posts as 'copilot-pull-request-reviewer[bot]'. This is why
Claude's final review was never triggered after Copilot.
2026-03-30 18:33:40 +01:00
MervinPraison f5220973f8 ci: fix duplicate Claude runs on issue creation
Root cause: issues created with '--label claude' triggered both
'issues:opened' and 'issues:labeled' events in claude.yml.
Fix: remove 'opened' from claude.yml triggers (only fire on label).
Also: auto-issue-comment.yml skips if 'claude' label already exists.
2026-03-30 18:07:43 +01:00
MervinPraison a924a55245 ci: add direct_prompt to Claude workflow for auto PR creation
When triggered via label, Claude now gets explicit instructions to
use gh pr create instead of just providing a link.
2026-03-30 17:59:13 +01:00
MervinPraison dcd072dc0c docs: remove CLAUDE.md — AGENTS.md is sufficient 2026-03-30 17:58:45 +01:00
MervinPraison 8173350f79 docs: add CLAUDE.md with explicit auto-PR-creation instructions
Claude was only providing PR links instead of creating them.
CLAUDE.md is auto-read by claude-code-action and instructs Claude
to always use 'gh pr create' to create PRs automatically.
2026-03-30 17:58:14 +01:00
MervinPraison 5b9a046d4b ci: add label_trigger to Claude action so 'claude' label fires it
The anthropics/claude-code-action needs explicit label_trigger input
to recognize label events. Also simplified bot filter logic.
2026-03-30 17:35:13 +01:00
MervinPraison 27aafddaa4 ci: fix Claude trigger — use label instead of @claude comment
Root cause: anthropics/claude-code-action ignores @claude from bots.
Fix: add 'claude' label on issue open, which triggers via issues:labeled event.
2026-03-30 17:33:28 +01:00
MervinPraison 4a0b34ea20 ci: add fallback trigger — Copilot fires after Coderabbit OR Qodo
Root cause: PR #1170 had no Coderabbit review, so Copilot/Claude
were never triggered. Now fires after either reviewer, with dedup
check to prevent double @copilot comments.
2026-03-30 17:31:16 +01:00
MervinPraison 19f5a16766 ci: sequential PR review chain + Claude fixes reviewer issues
Pipeline sequence:
  PR opened → Qodo + Coderabbit (auto)
  Coderabbit done → @copilot (reads their reviews)
  Copilot done → @claude (reads ALL reviews, fixes valid issues, pushes to branch)

Key improvements:
- Copilot waits for Coderabbit before reviewing
- Claude reads ALL reviewer feedback and fixes valid issues in-place
- 3-phase Claude prompt: Review → Fix → Verdict
2026-03-30 17:26:20 +01:00
MervinPraison 20cb053181 ci: make Claude default for issues, Gemini commented out for future
Pipeline flow:
  Issue → @claude (analyzes + creates PR)
  PR → Qodo/Coderabbit (auto) + @copilot
  Copilot done → @claude (final architecture review)
  ✅ Ready to merge

Gemini issue pipeline kept commented out for future dual-agent use.
2026-03-30 17:09:42 +01:00
MervinPraison 41ce1de079 ci: disable gemini_debug — output overflow caused GitHub Actions memory error 2026-03-30 17:02:15 +01:00
MervinPraison 36920ff8fe ci: fix Gemini config — settings_json→settings, remove invalid telemetry keys, use 2.5-flash with debug 2026-03-30 16:44:30 +01:00
MervinPraison e428393e0a ci: switch to official google-github-actions/run-gemini-cli@v0
- Replaces custom local action with official action
- Adds GH_TOKEN env for gh CLI auth inside Gemini sandbox
- Uses gemini-3.1-flash-lite-preview model (highest free quota)
2026-03-30 16:36:35 +01:00
MervinPraison 95fd857212 ci: switch to gemini-3.1-flash-lite-preview model 2026-03-30 16:32:01 +01:00
MervinPraison c260519bf1 ci: switch Gemini to flash model (250 RPD free tier vs Pro's 100 RPD)
Adds model input to gemini action, defaults to gemini-2.5-flash.
Prevents daily quota exhaustion on free tier.
2026-03-30 16:21:15 +01:00
MervinPraison 2921103ddd ci: fix '@gemini triage' exclusion — reword to 'analysis' to avoid filter 2026-03-30 15:56:10 +01:00
MervinPraison 73800f3509 ci: fix broken pipeline — @gemini for issues, correct event types for chain
Fixes:
- auto-issue-comment: @copilot → @gemini (Copilot doesn't respond on issues)
- chain-claude: listen for pull_request_review (how Copilot actually responds)
  + issue_comment from gemini-code-assist[bot] for issue chain
- gemini-issue-review: allow CONTRIBUTOR association (github-actions bot)
2026-03-30 15:18:18 +01:00
MervinPraison 7371ed7048 feat(docs): enhance README and AGENTS documentation with YAML examples
Added detailed sections in README for using YAML with agents, including
two comprehensive examples illustrating agent collaboration and custom
tools. Updated AGENTS.md to reflect CLI and YAML parity, and emphasized
the requirement for real agentic tests in the implementation checklist.
2026-03-27 16:18:06 +00:00
MervinPraison 129174257f docs: update AGENTS.md module sizes to match current codebase 2026-03-27 11:50:47 +00:00
Mervin Praison efcdc42fbb fix: replace unsafe eval() with safe alternatives and lazy-load Rich imports (#1160)
fix: replace unsafe eval() with safe alternatives and lazy-load Rich …
2026-03-27 11:49:00 +00:00
MervinPraison df79c5acb9 ci: event-driven review pipeline — chain Claude after Copilot finishes
- auto-pr-comment.yml: posts @copilot immediately on PR open
- auto-issue-comment.yml: posts @copilot immediately on issue open
- chain-claude-after-copilot.yml: watches for copilot-swe-agent comment,
  then posts @claude as final reviewer (event-driven, no sleep delays)
- Saves ~16 min of wasted runner time per PR
2026-03-27 11:46:34 +00:00
MervinPraison d9da7cc59c ci: expand Copilot prompts — thorough review since it's free 2026-03-27 11:35:38 +00:00
MervinPraison 11d9f290c7 ci: coordinated review pipeline — staggered timing, role specialization, remove infinite loop
- auto-pr-comment.yml: Copilot at T+6min (bloat guard), Claude at T+17min (final reviewer)
- auto-issue-comment.yml: Copilot triages first, Claude implements fix after
- claude.yml: remove post-review-comment job (caused infinite review cycles)
- Each bot has specialized role prompt instead of generic review
2026-03-27 11:34:27 +00:00
MervinPraison f796d12908 ci: improve auto-comment prompts — structured, focused, reference AGENTS.md 2026-03-27 11:18:34 +00:00
MervinPraison 9c4adcee89 ci: use official CLAUDE_CODE_OAUTH_TOKEN secret name 2026-03-27 11:12:18 +00:00
MervinPraison 1d0ffed030 ci: fix expired GH_TOKEN → GITHUB_TOKEN for auto-comments and claude review 2026-03-27 11:02:11 +00:00
copilot-swe-agent[bot]andMervinPraison 3be6df4de8 fix: harden legacy metadata fallback validation in SingleStore parser
Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/066a220b-7a22-4676-afe6-f2675b6ff910

Co-authored-by: MervinPraison <[email protected]>
2026-03-27 10:58:16 +00:00
MervinPraison b65de3bf06 ci: add @copilot review comment on PR open 2026-03-27 10:57:23 +00:00
copilot-swe-agent[bot]andMervinPraison f949814af8 fix: make SingleStore metadata parsing safe and backward-compatible
Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/066a220b-7a22-4676-afe6-f2675b6ff910

Co-authored-by: MervinPraison <[email protected]>
2026-03-27 10:57:04 +00:00
Claude 7449ccac76 fix: replace unsafe eval() with safe alternatives and lazy-load Rich imports (#1157, #1154)
Security (#1157): Replace eval() with json.loads() in singlestore_vector.py,
AST-whitelisted evaluator in ai_generator.py, and AST node validation in
job_workflow.py/hybrid_workflow.py to prevent arbitrary code execution.

Performance (#1154): Convert eager module-level Rich imports to lazy
function-level imports in main.py, agents.py, knowledge.py, video_agent.py,
and image_agent.py — Rich is no longer loaded on `import praisonaiagents`.

https://claude.ai/code/session_01MZtrpciafckLxpmrn1z6P2
2026-03-27 10:24:18 +00:00
github-actions[bot] ae26edd3f8 docs: auto-update api.md [skip ci] 2026-03-26 18:19:52 +00:00
MervinPraison 6349c88ad9 feat(agent): add budget management features to agents
- Introduced `BudgetExceededError` for handling budget overages.
- Implemented budget tracking in the `Agent` class.
- Added properties for total cost and cost summary.
- Updated various agents to support budget constraints.
- Enhanced lazy loading to include new budget-related components.
- Extensive test coverage added for the new budget features.
2026-03-26 18:19:35 +00:00
Mervin Praison 1d4721d039 feat(ag2): add AG2 framework backend integration (#1156)
feat(ag2): add AG2 framework backend integration
2026-03-26 17:56:52 +00:00
MervinPraisonandFaridun Mirzoev 90915fe790 feat(ag2): add AG2 framework backend integration
Port of PR #1143 (by @faridun-ag2) to main branch.

AG2 (community fork of AutoGen, PyPI: ag2) added as a new framework
option alongside praisonai, crewai, and autogen.

Changes:
- agents_generator.py: AG2 detection + _run_ag2() with LLMConfig,
  GroupChat orchestration, Bedrock support, TERMINATE cleanup
- auto.py: AG2 lazy availability check + validation
- pyproject.toml: [ag2] optional dependency extra
- examples/ag2/: basic, multi-agent, and Bedrock YAML examples
- tests: 16 unit tests + 9 integration tests

Co-authored-by: Faridun Mirzoev <[email protected]>
2026-03-26 17:56:15 +00:00
MervinPraison 29facc8f89 Release v4.5.85 2026-03-26 03:13:24 +00:00
MervinPraison 401521848f feat(version): bump version to 1.5.85
Updated the version number in pyproject.toml and uv.lock to reflect the new release.
2026-03-26 03:13:24 +00:00
Mervin Praison ab97eae954 fix: harden env key validation — malformed keys, root/deployment type guards
fix: harden env key validation — malformed keys, root/deployment type guards
2026-03-26 02:30:10 +00:00
Mervin Praison 5dda0643ca security: cap litellm<=1.82.6 (supply chain incident)
security: cap litellm<=1.82.6 (supply chain incident)
2026-03-26 02:29:20 +00:00
MervinPraison 1b8d7a02d9 security: cap litellm<=1.82.6 (supply chain incident CVE)
LiteLLM v1.82.7 and v1.82.8 contained a credential stealer from a
supply chain attack (compromised PyPI maintainer via Trivy CI/CD).
Both versions removed from PyPI.

PraisonAI was NOT affected (installed 1.81.1), but as a defensive
measure, cap the upper bound at 1.82.6 (latest safe) until LiteLLM
completes their supply-chain review and resumes releases.

Ref: https://docs.litellm.ai/blog/security-update-march-2026
2026-03-26 02:28:46 +00:00
Mervin Praison dbcd36edce fix: Tier 1 security & concurrency fixes (#1134, #1129, #1137)
fix: Tier 1 security & concurrency fixes (#1134, #1129, #1137)
2026-03-26 02:12:56 +00:00
MervinPraison 9ef5391c83 fix: Tier 1 security & concurrency fixes (#1134, #1129, #1137)
#1134: Decouple execute_code from optional deps (black/pylint/autopep8)
- execute_code is now a standalone module-level function
- PythonTools class retained for analyze/format/lint (lazy-init)
- Agents can now use execute_code without heavy optional deps

#1129: Thread-safety for remaining global mutable state
- Add _lazy_import_lock with double-checked locking for all 6 lazy-import
  caches (_rich_console, _rich_live, _llm_module, _main_module, etc.)
- Add _env_cache_lock for class-level env var caches
  (_env_output_mode, _default_model)

#1137: Clarify misleading TODO comment
- Updated TODO in llm.py to clarify this is code-level DRY, not
  duplicate API calls per request
2026-03-26 02:09:40 +00:00
Sebastion 7385adbd60 fix: address second round of review feedback — malformed key validation, root/deployment type guards
- Reject empty strings, keys containing "=" or NUL in _validate_env_key()
  (CodeRabbit: malformed keys should fail during validation, not at os.environ)
- Validate root config is a dict after yaml.safe_load() (handles list/scalar/None)
- Validate deployment section is a dict before .get() calls
- Both raise ValueError caught by the existing handler → clean CLI error
- Add test_malformed_env_keys_rejected, test_non_dict_root_config_rejected,
  test_non_dict_deployment_rejected (7 tests total, all passing)
2026-03-26 00:05:11 +00:00
Mervin Praison 78d7883fb7 Merge pull request #1148 from MervinPraison/fix/1145-1147-approval-dry-thread-safety
fix: deduplicate approval logic and add thread-safety (#1147, #1145)
2026-03-25 17:21:44 +00:00
Mervin Praison 6122531a6a Merge pull request #1144 from sebastiondev/security/fix-cwe78-env-injection
Merging — verified locally, both vulnerable occurrences are patched, all tests pass. Great contribution! 🎉
2026-03-25 10:53:28 +00:00
Claude d704cf1349 fix: deduplicate approval logic and add thread-safety to global state (#1147, #1145)
Extract ~120 lines of duplicated approval code from _execute_tool_impl()
and execute_tool_async() into shared helpers _check_tool_approval_sync()
and _check_tool_approval_async(). Add threading.Lock to protect
_agent_counter, _server_started, _registered_agents, and _shared_apps
against concurrent access in multi-agent scenarios.

https://claude.ai/code/session_01WiGKiwTBj7xo5YoF3PYjWF
2026-03-25 10:10:41 +00:00
Sebastion 8523ef076e fix: address review feedback — fail-closed validation, restore env fixture, non-string key guard, perf, coverage 2026-03-25 03:46:33 +00:00
Mervin Praison 72889d2f73 Merge pull request #1119 from eltociear/patch-1
docs: update README.md
2026-03-24 20:42:24 +00:00
Sebastion f17bd7369c fix: reject dangerous environment variable keys from YAML schedule config (CWE-78)
The --schedule-config YAML file allows setting arbitrary environment
variables via the "environment" section. An attacker who can supply or
modify this file could set keys like LD_PRELOAD, PATH, PYTHONPATH, etc.
to achieve arbitrary code execution.

Add _validate_env_key() with a blocklist of security-sensitive env var
names (dynamic linker, search paths, proxies) and call it before each
os.environ assignment in the schedule-config loading path.

Also add unit tests for the validation function.
2026-03-24 20:41:10 +00:00
MervinPraison ed31e9b280 Release v4.5.83 2026-03-24 04:48:37 +00:00
MervinPraison 69e9e712c7 fix(security): remove hardcoded CHAINLIT_AUTH_SECRET and fix critical issues from #1122/#1125
- Replace hardcoded CHAINLIT_AUTH_SECRET with secrets.token_hex(32) fallback in all 5 UI files
  (agents.py, bot.py, chat.py, code.py, realtime.py) — secret was public in git history
- Use hmac.compare_digest() for constant-time API key comparison in recipe/serve.py
- Disable debug=True by default in deploy.py generated api.py; use DEBUG env var
- Restrict exec() __builtins__ to safe subset in job_workflow.py inline Python execution;
  prevents __import__('os').system() and similar arbitrary code execution patterns

Skipped shell=True changes (would break YAML run: steps with pipes/env vars) and
CORS wildcard changes (would break browser extension without env var migration path).
These require separate architectural discussion.
2026-03-24 04:33:35 +00:00
MervinPraison 7617b10c70 Release v4.5.82 2026-03-21 17:51:25 +00:00
MervinPraison 7939a4f12e fix(security): complete remaining eval/exec/XSS fixes from issue #1120
- Replace eval(e) in unified_server.py with AST-based safe math evaluator
- Replace exec(script_content) in run_with_langtrace.py with subprocess.run()
- Add nh3.clean() output sanitization in api.py to prevent XSS from markdown links
- Replace eval() in basic-tools.ts and custom-tool.ts with regex allowlist + Function constructor
- Replace eval() in simplified-api-test.ts and comprehensive-live.test.ts with safe evaluator

All changes are in example files and dev helper scripts only.
No SDK core code modified. Unit tests: 4341 passed, 0 new failures.
2026-03-21 17:49:40 +00:00
MervinPraison 8cbad0c997 Release v4.5.81 2026-03-21 16:51:27 +00:00
Ikko Eltociear Ashimine 48ed131577 docs: update README.md
minor fix
2026-03-20 13:17:09 +09:00
Mervin Praison f8c6f32d00 Release v4.5.80 2026-03-18 21:09:57 +00:00
Mervin Praison 69ff8e7f03 Release v4.5.79 2026-03-18 15:57:13 +00:00
Mervin Praison feaa81b68f Release v4.5.78 2026-03-18 15:28:36 +00:00
Mervin Praison 39406e904f feat(crawl4ai_tools): enhance availability checks for Crawl4AI and Playwright
Updated the availability check for Crawl4AI to include Playwright browser installation advice. Improved error handling when starting the web crawler, ensuring users are informed if necessary binaries are missing. Incremented version in pyproject.toml to 1.5.78 and added new dependencies for crawling functionality.
2026-03-18 15:26:43 +00:00
Mervin Praison 2bb37b1076 Release v4.5.77 2026-03-18 14:46:46 +00:00
Mervin Praison cc36ac1cf8 feat(scheduler): add execution history logging for scheduled jobs
Implemented logging for job execution history via a new RunRecord class.
This includes methods for logging job runs, retrieving execution history,
and persisting the history to a file. Enhancements to the config store
allow for configurable maximum history depth, improving traceability
of job executions.
2026-03-18 14:39:41 +00:00
Mervin Praison a041a76f0d Release v4.5.76 2026-03-18 11:08:18 +00:00
Mervin Praison f77cca9931 feat(scheduler): add ConfigYamlScheduleStore for schedule management
Introduced a new schedule store utilizing YAML files for
persistence. This allows scheduled jobs to be stored under
the "schedules" key in the existing config.yaml, enhancing
thread safety and maintaining existing config information.
Updated related modules to integrate the new store.
2026-03-18 11:07:33 +00:00
Mervin Praison ef176298b9 feat(scheduler): implement ScheduleStoreProtocol for better schedule management
Added a new ScheduleStoreProtocol to standardize schedule persistence backends.
Updated ScheduleLoop and ScheduleRunner to use the protocol, allowing various
implementations for schedule storage. Introduced _run_schedule_loop in BotOS
to ensure scheduled jobs execute alongside bot tasks. Updated project version to
1.5.75 for this update.
2026-03-18 10:52:42 +00:00
Mervin Praison 31f5cbb1cf Release v4.5.74 2026-03-17 14:57:13 +00:00
Mervin Praison 85ec6cba90 feat(web_crawl_tools): enhance URL handling in web_crawl function
Improved the URL normalization logic to handle comma-separated URLs
passed as a single string. Updated version numbers in pyproject.toml
and uv.lock files to reflect the latest changes.
2026-03-17 14:54:27 +00:00
Mervin Praison c77259eda7 Release v4.5.73 2026-03-17 12:11:44 +00:00
Mervin Praison e69e726ca6 refactor(tools): rename web_crawl.py to web_crawl_tools.py
Updated the import paths in TOOL_MAPPINGS to reflect the new file name.
Bumped version to 1.5.73 in pyproject.toml and uv.lock for the change.
2026-03-17 12:08:30 +00:00
Mervin Praison 3130ae4e19 Release v4.5.72 2026-03-17 11:17:13 +00:00
Mervin Praison c872be20ed feat(email_tools): enhance backend detection and streamline usage
Updated email_tools to auto-detect available email backends (AgentMail or SMTP) based on environment variables. This refactor simplifies usage by providing generic tools while maintaining backend-specific functionalities. Enhanced documentation to reflect these changes and improve usability.
2026-03-17 11:14:39 +00:00
Mervin Praison 4548783a40 Release v4.5.71 2026-03-17 10:41:33 +00:00
Mervin Praison 5b1c39d496 feat(bots): add mode and webhook port configurability
Enhanced BotConfig and related classes to support multiple operation modes (poll, ws, webhook, hybrid) and configurable webhook port. Updated documentation and validation for new parameters in the AgentMailBot for improved flexibility in message handling. Bumped version to 1.5.71.
2026-03-17 10:38:13 +00:00
Mervin Praison 1e3933f5f3 Release v4.5.70 2026-03-17 08:14:59 +00:00
Mervin Praison 203ebe4960 ```
feat(email_tools): add reply_email and create_inbox functions

Implemented reply_email for responding to emails and create_inbox for
creating new email inboxes in the AgentMail system. Updated integration
in the tool mappings and profiles to include new functionalities.
Enhanced tests to cover the new features.
```
2026-03-17 08:12:11 +00:00
Mervin Praison e144d840bb Release v4.5.69 2026-03-16 21:43:41 +00:00
Mervin Praison 47bff65413 feat(mcp): enhance command validation in MCPHandler
Added an allowlist for MCP server commands to improve security by
rejecting disallowed and dangerous commands in the MCPHandler class.
Updated tests to verify the new validation logic and ensure expected
executables are accepted. Bumped version to 1.5.69.
2026-03-16 21:39:47 +00:00
Mervin Praison 66bd9ee2a9 Release v4.5.68 2026-03-16 17:48:36 +00:00
github-actions[bot] 1dd5d7e706 docs: auto-update api.md [skip ci] 2026-03-16 17:45:42 +00:00
Mervin Praison fee74fab53 ```
feat(email): add AgentMail tools for sending and managing emails

- Introduced send_email, list_emails, and read_email functions.
- Added email_tools module for agent interaction.
- Updated tool mappings to include email functionalities.
- Included example YAML configuration for an AgentMail bot.
- Enhanced tests for email tools and added new test cases.
```
2026-03-16 17:45:17 +00:00
Mervin Praison 003f9371a1 Release v4.5.67 2026-03-16 16:31:48 +00:00
Mervin Praison 7234cd5682 ```
feat(bots): add email bot examples and functionalities

This commit introduces a new email bot feature, enabling agents to
interact through email via IMAP/SMTP. It includes example usage,
custom configurations, and a multi-platform approach, enhancing the
bot's usability in diverse environments.
```
2026-03-16 16:31:23 +00:00
Mervin Praison 4373fb3adb docs(README): update performance metrics and clarify agent orchestration
Refined performance section to emphasize speed and reduced overhead.
Updated terminology for clarity in the external agents description.
2026-03-16 12:11:56 +00:00
Mervin Praison e87dd8e37a ```
docs(readme): refine performance section and enhance descriptions

Updated the performance metrics and descriptions to clarify advantages of PraisonAI. Improved consistency in terminology for better readability.
```
2026-03-16 12:08:35 +00:00
Mervin Praison 872cd87638 Release v4.5.65 2026-03-16 12:00:17 +00:00
Mervin Praison 8ea0065f83 ```
feat(bots): add EmailBot for IMAP polling and SMTP sending

This commit introduces the EmailBot, enabling integration with email
services using IMAP for receiving messages and SMTP for sending.
Updates include new environment variables for configuration,
enhancements to the bot registry, and modifications to schema and
initialization logic for seamless integration.
```
2026-03-16 11:58:55 +00:00
Mervin Praison e922eb1e64 Release v4.5.64 2026-03-16 10:02:40 +00:00
Mervin Praison e364aa7519 Release v4.5.63 2026-03-15 15:36:23 +00:00
Mervin Praison e67a11db1f ```
fix(agent): handle potential None value for agent name

Updated agent hash generation to default to "agent" when name is None.
Bumped version to 1.5.63 to reflect this change.
```
2026-03-15 15:31:02 +00:00
Mervin Praison 9071af74ea Merge pull request #1114 from jnMetaCode/fix-agent-name-none-crash
fix: handle None agent name when generating history session ID
2026-03-15 07:12:47 +00:00
Mervin Praison 7821916c56 Merge pull request #1115 from jnMetaCode/fix-model-windows-duplicate-key
fix: correct duplicate gpt-4o-mini key in MODEL_WINDOWS to gpt-4o
2026-03-15 07:12:16 +00:00
Mervin Praison dd1b9a7f1f Release v4.5.62 2026-03-15 05:30:13 +00:00
Mervin Praison 3b006be069 ```
feat(tests): add deep performance profiling integration test

Introduced a new integration test to run cProfile-wrapped Agent prompts.
This test stores detailed function-level breakdown as JSONL for regression
tracking and comparison of performance over time. Updated version number
and modified documentation accordingly.
```
2026-03-15 05:29:29 +00:00
Mervin Praison 4d80c60ecb ```
feat(llm): add support for OpenAI Responses API

- Implemented methods to check model compatibility with the Responses API.
- Added functionality to transform Chat Completions messages to Responses API parameters.
- Updated agent and budgeter context for new model types and limits.
- Cleaned up test cases for database integration to remove unnecessary parameters.
```
2026-03-14 11:53:47 +00:00
Mervin Praison 0cdfde2c04 Release v4.5.60 2026-03-13 16:57:44 +00:00
Mervin Praison 98e2fcccf6 Release v4.5.59 2026-03-13 16:50:14 +00:00
Mervin Praison 1a42ca92d3 Release v4.5.58 2026-03-13 16:30:18 +00:00
Mervin Praison c75d087591 feat(agent): add transparency for tool usage in system prompts
Added a guideline in the system prompt to explain actions before tool calls, enhancing clarity and transparency in interactions. Updated version to 1.5.58 to reflect changes.
2026-03-13 16:27:52 +00:00
Mervin Praison 2f6f496e5d Release v4.5.57 2026-03-13 15:34:30 +00:00
Mervin Praison 42ab69c142 Release v4.5.56 2026-03-13 14:41:14 +00:00
Mervin Praison db62f4368c feat(agent): implement doom recovery mechanism for autonomy
Added a `_doom_recovery_active` flag to manage agent behavior during
doom loops. This prevents normal termination signals when a doom loop
is detected, allowing the system to handle recovery more effectively.
Updated relevant sections in `agent.py` and adjusted unit tests to
reflect changes. Bumped version to 1.5.56.
2026-03-13 14:38:43 +00:00
Mervin Praison fd3daa27fa Release v4.5.55 2026-03-13 14:17:35 +00:00
Mervin Praison 875da3dfe0 feat(agent, llm): enhance agent response handling and tool call logic
Improved handling of agent's chat responses, including better
doom loop detection. Added intermediate narrative emission for LLM
tool calls, enhancing transparency in execution logic.
Updated tests to cover new functionality.
2026-03-13 14:14:00 +00:00
Mervin Praison 620e21b599 test(integration): add 10-step task comparison integration test
This test evaluates the functionality of the tool_completion fix
with a detailed multi-tool prompt. It includes tasks such as
web searching, file creation, execution, and reporting.
2026-03-13 09:18:54 +00:00
Mervin Praison 79ad6b621f Release v4.5.54 2026-03-13 08:35:47 +00:00
github-actions[bot] cbe57c9d52 docs: auto-update api.md [skip ci] 2026-03-13 08:33:42 +00:00
Mervin Praison fa264e1314 feat(agent): enhance tool call completion handling and tracking
- Added completion callback for tool-call completion if the model used tools and produced a substantive response.
- Updated `execute_tool` and `_execute_tool_with_context` methods to include `tool_call_id` for better event correlation.
- Improved logging for tool execution within the agent's framework.
2026-03-13 08:33:24 +00:00
Mervin Praison e71e73cca4 Release v4.5.52 2026-03-13 07:36:38 +00:00
Mervin Praison 9861520be6 Release v4.5.51 2026-03-13 00:26:30 +00:00
Mervin Praison 710624bd69 Release v4.5.49 2026-03-13 00:23:37 +00:00
Mervin Praison a35a6690c4 Release v4.5.48 2026-03-12 16:38:48 +00:00
Mervin Praison 1b9d569de8 Release v4.5.46 2026-03-12 13:59:37 +00:00
Mervin Praison 956e4eeb91 feat(tools): add learning tools for improved user preference management
Introduced `store_learning` and `search_learning` functions to
facilitate categorized storage and retrieval of user insights and
preferences. Enhanced agent interaction by allowing agents to
remember and recollect user behaviors across sessions. Updated
agent state to include a learn manager for integration with the
learning system.
2026-03-12 13:52:36 +00:00
Mervin Praison 654e1e2aec Release v4.5.45 2026-03-12 12:26:17 +00:00
Mervin Praison 2870aa9861 feat(a2a): add authentication support and standalone server feature
- Introduced optional bearer token for POST /a2a requests
- Added serve method for standalone A2A server using FastAPI
- Updated router to enforce authentication when token is set
- Enhanced message parsing to support additional part types
2026-03-12 12:23:31 +00:00
Mervin Praison 7bec22ce77 Release v4.5.44 2026-03-12 12:04:19 +00:00
Mervin Praison 520a46019a feat(docs): enhance user guide with Python examples and CLI reference
Added detailed usage examples for single, multi agents, MCP, custom tools, and persistence. Included a quick reference for CLI commands to improve user onboarding. Removed outdated sections for clarity.
2026-03-12 12:00:48 +00:00
Mervin Praison 7ee1c642d4 docs(README): remove outdated features from the description
Updated the README to eliminate references to specific deployment and connection features that are no longer relevant.
2026-03-12 11:01:41 +00:00
Mervin Praison 397f499dda docs(README): restructure and simplify features section
Updated the "Why PraisonAI?" section for clarity and conciseness,
retaining key features while enabling easier navigation with an
expandable details section to view all features.
2026-03-12 10:56:37 +00:00
Mervin Praison d4dac28434 docs(README): update structure and content for clarity and branding
Modified logo dimensions and enhanced the documentation layout by
refactoring sections related to quick start instructions and added
details on supported LLM providers. Overall goal was to improve
readability and user experience.
2026-03-12 10:53:29 +00:00
Mervin Praison dbca6e0047 feat(docs): update README and add 24 new provider icons
Updated README.md to reflect changes in logo paths, added new features,
and improved contribution guidelines. Added 24 new provider icons to
public directory for better integration visibility.
2026-03-12 10:47:24 +00:00
Mervin Praison ed3da59b2c docs(README): update use cases section and clarify performance benchmarks
Added a new "Use Cases" section outlining practical applications of AI agents
and streamlined the language in the performance benchmarks for clarity.
2026-03-12 10:37:20 +00:00
Mervin Praison 55ab4acf8d docs(README): update feature names and add use cases section
Revised feature names for clarity and consistency, changing "Dashboard UI" to "AgentClaw." Added a new section outlining various use cases for AI agents across multiple industries. Updated links and formatting for better readability.
2026-03-12 10:31:06 +00:00
Mervin Praison e0c1301965 docs(README.md): add example command for using praisonai claw feature
Added a line to the README.md to provide an example command for
installing the claw feature of the praisonai package.
2026-03-12 08:11:14 +00:00
Mervin Praison 79c4002e3c docs(README): clarify section title for PraisonAI Claw
Updated the section title to include "Dashboard UI" for better clarity.
2026-03-12 08:05:33 +00:00
Mervin Praison 2e5a8c5fe5 docs(README): Add section for PraisonAI Claw integration
Included installation instructions and dashboard overview for connecting AI agents to messaging platforms like Telegram, Discord, and WhatsApp.
2026-03-12 08:04:44 +00:00
Mervin Praison 99c811da21 feat(docs): add dashboard image to README
Added a central image of the PraisonAI dashboard to enhance visual appeal
and provide users with a clear reference to the interface.
2026-03-12 01:34:56 +00:00
Mervin Praison 0fb773adcd Release v4.5.43 2026-03-12 00:27:47 +00:00
Mervin Praison d95d3854db feat(dependencies): update praisonai and praisonaiagents to v4.5.43
Updated Dockerfiles and project files to use praisonai version 4.5.43
and praisonaiagents version 1.5.43 for improved functionality and
features. Added new 'claw' command in the CLI for enhanced user
experience.
2026-03-12 00:27:47 +00:00
github-actions[bot] 1383db2fba docs: auto-update api.md [skip ci] 2026-03-12 00:18:34 +00:00
Mervin Praison 75adcfed68 Release v4.5.42 2026-03-12 00:18:16 +00:00
Mervin Praison 3793ef0387 docs(README): update project description for clarity and impact
Updated the project description to highlight key features and capabilities, including automation, supported platforms, and other enhancements for better understanding.
2026-03-11 23:06:42 +00:00
Mervin Praison bf3b7f8e9d docs(README): update feature list with consistent layout and missing details
Adjusted the feature table in README.md for improved readability.
Added missing features and ensured consistent formatting throughout the list.
2026-03-11 22:55:11 +00:00
Mervin Praison a4da8c6ab6 feat(docs): update documentation links and improve clarity
Revised multiple links in the README to point to the correct documentation
pages, specifically changing references from features to concepts to enhance
user navigation and comprehension.
2026-03-11 22:47:54 +00:00
Mervin Praison f59ba1b83d Release v4.5.41 2026-03-11 22:32:27 +00:00
Mervin Praison 8c88766900 feat(docs): update README and versioning for Dashboard UI feature
Added a new entry for the Dashboard UI in the README and updated
the version of `praisonaiagents` to 1.5.41 in the relevant files.
This reflects recent changes and improvements in UI capabilities.
2026-03-11 22:31:09 +00:00
Mervin Praison a6eaa854fe Release v4.5.40 2026-03-11 22:21:06 +00:00
Mervin Praison e36911e712 feat(README, pyproject): update bot features and version number
Updated README.md to highlight new bot functionalities including Telegram,
Discord, Slack, and WhatsApp integration. Increased version to 1.5.40
in `pyproject.toml` for `praisonaiagents`. Expanded dependencies for
claw in the main `pyproject.toml`. Enhanced .gitignore to include
build files.
2026-03-11 21:22:25 +00:00
Mervin Praison c3a6a39ee1 docs(readme): update links to feature documentation in README.md
Replaced outdated links in the README file with new feature documentation
links to ensure users have access to the latest information about the
project's capabilities.
2026-03-11 20:58:02 +00:00
Mervin Praison 15146ff6a7 docs(README): add new features to the documentation table
Added several new features to the README.md including Sessions + Auto-Save, Telemetry, Policy Engine, Thinking Budgets, Background Tasks, Doom Loop Detection, Graph Memory, RAG + Quality-Based RAG, and Sandbox Execution.
2026-03-11 20:55:38 +00:00
Mervin Praison 0d0c2fa762 docs(README): update features section with detailed explanations
Enhanced the features section with specific feature descriptions and
usage examples to provide clearer insights into the framework's
capabilities and benefits for new users.
2026-03-11 20:53:30 +00:00
Mervin Praison c9010fca9f docs(readme): major rewrite of README for clarity and content updates
The README.md has been significantly updated with a focus on clear
guidance and reduced verbosity. Many sections were condensed or
removed, resulting in a net decrease in lines while enhancing
navigation and support links for users.
2026-03-11 20:45:19 +00:00
Mervin Praison 7a36352196 Release v4.5.39 2026-03-11 00:23:03 +00:00
Mervin Praison 6ae4ebedcb Merge branch 'main' of https://github.com/MervinPraison/PraisonAI 2026-03-11 00:20:17 +00:00
Mervin Praison 3377347087 feat(scheduler): add session ID to DeliveryTarget and scheduling commands
Added an optional session_id parameter to DeliveryTarget and scheduling
functions to preserve conversation context during job execution. This
enhancement allows agents to access prior chat history and improves
overall task management flexibility. Updated relevant documentation and
CLI commands accordingly.
2026-03-11 00:19:32 +00:00
github-actions[bot] f47aa248ea docs: auto-update api.md [skip ci] 2026-03-10 18:00:30 +00:00
Mervin Praison 0379e9f196 Release v4.5.38 2026-03-10 18:00:13 +00:00
Mervin Praison c841d46ae9 Release v4.5.37 2026-03-10 15:27:06 +00:00
Mervin Praison cd6fdd0107 feat(memory): implement MongoDB storage backend and memory protocol aliases
Added a MongoDB backend for storage, which allows document-oriented
data storage. Implemented protocol-compliant aliases for memory operations
to improve consistency. Updated related memory management logic to support
new functionality, enhancing overall performance and user experience.
2026-03-10 15:23:43 +00:00
Mervin Praison d840407b12 Release v4.5.36 2026-03-10 14:05:29 +00:00
Mervin Praison b99ca3f0ae Release v4.5.35 2026-03-10 13:09:43 +00:00
Mervin Praison 23c48f6cd5 Release v4.5.34 2026-03-10 11:16:45 +00:00
Mervin Praison d0fa48b110 Release v4.5.33 2026-03-10 06:07:07 +00:00
Mervin Praison 0d2c1bd961 Release v4.5.32 2026-03-10 05:42:59 +00:00
Mervin Praison ef6b1a8913 Release v4.5.31 2026-03-09 14:43:23 +00:00
github-actions[bot] dc9c250adb docs: auto-update api.md [skip ci] 2026-03-09 14:06:13 +00:00
Mervin Praison d1fb090a07 Release v4.5.30 2026-03-09 14:05:55 +00:00
Mervin Praison 8479fffa8c feat(paths): refactor directory management for agents and config loading
Updated various parts of the codebase to centralize directory paths
using the new `paths.py` utility. This improves maintainability and
consistency across the project when accessing directory paths for
plugins, snapshots, memory, and configuration.

Added integration and unit tests to ensure correct behavior of path
configurations.
2026-03-09 13:57:35 +00:00
Mervin Praison 8555b5ad69 Release v4.5.29 2026-03-09 06:18:18 +00:00
JiangNan ad8ee02b5a fix: correct duplicate gpt-4o-mini key in MODEL_WINDOWS to gpt-4o
MODEL_WINDOWS had two entries for gpt-4o-mini and none for gpt-4o.
The first entry was clearly intended to be gpt-4o based on context.
This meant gpt-4o users got no context window match, potentially
causing suboptimal chunking or fallback behavior.

Signed-off-by: JiangNan <[email protected]>
2026-03-08 22:32:24 +08:00
JiangNan 02b9c64c0a fix: handle None agent name when generating history session ID
When an agent is created with instructions but no explicit name, and
memory history is enabled, name can be None. Calling .encode() on None
raises AttributeError. Fall back to "agent" when name is None.

Signed-off-by: JiangNan <[email protected]>
2026-03-08 22:32:21 +08:00
Mervin Praison 16f9325176 Release v4.5.28 2026-03-08 07:03:40 +00:00
Mervin Praison fc9f8c5e1d Release v4.5.27 2026-03-08 00:06:51 +00:00
Mervin Praison f5ee866e6c feat(gateway, session): add gateway integration and lazy loading
- Implement lazy loading for WebSocketGateway and GatewaySession in the
  gateway module, allowing easier access without needing wrapper imports.
- Enhance SessionData to include gateway session ID and agent ID.
- Introduce methods in DefaultSessionStore for querying sessions by agent
  and linking sessions to gateway sessions.
2026-03-08 00:02:39 +00:00
Mervin Praison af1c26c471 Release v4.5.26 2026-03-07 07:10:51 +00:00
Mervin Praison f20d5d95e4 feat(workflow): add agent-centric and hybrid workflow examples
Introduced new YAML workflow examples demonstrating agent-centric steps
and hybrid workflows. The agent-centric job workflow supports roles
like Technical Writer and includes quality checks, while the hybrid
workflow combines deterministic steps with multi-agent coordination.
Updated version to 1.5.26 for the praisonai-agents package.
2026-03-07 07:07:56 +00:00
Mervin Praison ac89f8a17c Release v4.5.25 2026-03-07 05:51:43 +00:00
Mervin Praison abc7f09046 feat(workflows): add file-based and YAML-defined actions examples
Added examples for file-based actions (line count and system info)
and YAML-defined actions in new workflow files. Updated relevant
files to support these actions, enhancing the capabilities for
custom workflows. Updated package version to 1.5.25.
2026-03-07 05:32:23 +00:00
github-actions[bot] a0287a9919 docs: auto-update api.md [skip ci] 2026-03-06 14:58:00 +00:00
Mervin Praison 5046e9cf88 Release v4.5.24 2026-03-06 14:57:43 +00:00
Mervin Praison 89624c1580 Release v4.5.23 2026-03-06 07:50:12 +00:00
Mervin Praison cc719e5379 Release v4.5.22 2026-03-05 15:18:22 +00:00
Mervin Praison e854a50fd2 Release v4.5.21 2026-03-03 15:46:18 +00:00
Mervin Praison 99fde9b9d9 Delete tmp directory 2026-03-03 13:20:31 +00:00
Mervin Praison 3c73ca95b6 u 2026-03-03 13:12:44 +00:00
Mervin Praison d7c274489e Release v4.5.20 2026-03-03 11:08:28 +00:00
Mervin Praison 23f6c00e21 Release v4.5.19 2026-03-03 09:37:24 +00:00
Mervin Praison a293999e8b Release v4.5.18 2026-03-03 07:22:28 +00:00
Mervin Praison 0b14ae49ef update 2026-03-01 07:12:47 +00:00
Mervin Praison b33c649de5 Release v4.5.17 2026-02-28 08:47:18 +00:00
Mervin Praison 02a1977651 Release v4.5.16 2026-02-27 04:43:28 +00:00
Mervin Praison 440d35a97a security(skill_tools): add @require_approval to run_skill_script
run_skill_script executes arbitrary .py/.sh/.js scripts via subprocess.run
without any approval gate. Add @require_approval(risk_level='critical') to
both the class method and module-level wrapper, matching the pattern used
by shell_tools and python_tools.
2026-02-19 12:48:37 +00:00
Mervin Praison 1a9d115929 security(python_tools): harden sandbox blocklists, add __build_class__
- Add __traceback__, __qualname__, __module__, __wrapped__, etc to AST blocklist
- Block frame/code object introspection (gi_frame, cr_frame, f_globals, etc)
- Add __build_class__ to safe_builtins so class definitions work
2026-02-19 12:42:10 +00:00
Mervin Praison cb820212e7 security(python_tools): fix sandbox escape via getattr/setattr (fixes #1106)
- Remove getattr, setattr, dir, help from safe_builtins
- Add _safe_getattr wrapper that blocks dunder attribute access
- Add _validate_code_ast: AST-based validation that catches imports,
  dunder attribute access, and dangerous function calls even when
  obfuscated via string concatenation
- Keep existing text pattern check as defense-in-depth
- Add 23 security regression tests (14 exploits, 9 legitimate)
2026-02-19 12:38:05 +00:00
Mervin Praison c56ee127c4 test(approval): add tests for env fallbacks, SSL toggles, and webhook crash fix
- Discord: test DISCORD_CHANNEL_ID env fallback, SSL verify default/override
- Telegram: test TELEGRAM_CHAT_ID env fallback, SSL verify default/override
- Webhook: test integer status does not crash str().lower()
2026-02-19 12:21:38 +00:00
Dhivya-Bharathy c71e0ea2c7 feat(approval): add env fallbacks, SSL toggles, crash fix, and examples
- Discord: DISCORD_CHANNEL_ID env fallback + PRAISONAI_DISCORD_SSL_VERIFY toggle
- Telegram: TELEGRAM_CHAT_ID env fallback + PRAISONAI_TELEGRAM_SSL_VERIFY toggle
- HTTP: print approval URL to console for better UX
- Webhook: fix str(status).lower() crash on non-JSON responses
- Add examples/approval/ with Slack, Telegram, Discord, HTTP, Agent examples

Co-authored-by: Dhivya-Bharathy <[email protected]>
2026-02-19 12:21:27 +00:00
Mervin Praison bbd320c50e Release v4.5.15 2026-02-18 10:37:43 +00:00
Mervin Praison 505f7aea30 Release v4.5.14 2026-02-17 13:54:58 +00:00
github-actions[bot] 7a8dfb745b docs: auto-update api.md [skip ci] 2026-02-17 00:26:37 +00:00
Mervin Praison 9dc97b92d2 Release v4.5.13 2026-02-17 00:26:21 +00:00
github-actions[bot] 2f2add5ec2 docs: auto-update api.md [skip ci] 2026-02-16 10:52:54 +00:00
Mervin Praison fc6a4979bc Release v4.5.12 2026-02-16 10:52:36 +00:00
Mervin Praison 47f35a968b Release v4.5.11 2026-02-16 09:27:04 +00:00
github-actions[bot] e3898f704a docs: auto-update api.md [skip ci] 2026-02-16 07:47:20 +00:00
Mervin Praison 8e8efa2887 Release v4.5.10 2026-02-16 07:47:06 +00:00
Mervin Praison 771c1ba945 Release v4.5.9 2026-02-16 07:00:45 +00:00
Mervin Praison 878a562aa2 Release v4.5.8 2026-02-16 06:47:15 +00:00
github-actions[bot] 0803bca06a docs: auto-update api.md [skip ci] 2026-02-16 06:14:03 +00:00
Mervin Praison 91aaa9a310 Release v4.5.7 2026-02-16 06:13:47 +00:00
github-actions[bot] 2b54eb571e docs: auto-update api.md [skip ci] 2026-02-15 06:50:27 +00:00
Mervin Praison be167f885e Release v4.5.6 2026-02-15 06:50:13 +00:00
github-actions[bot] 8c4e339aa6 docs: auto-update api.md [skip ci] 2026-02-15 01:04:23 +00:00
Mervin Praison 841c51df84 Release v4.5.5 2026-02-15 01:04:07 +00:00
Mervin Praison 6709ae17e9 Release v4.5.3 2026-02-14 14:24:05 +00:00
Mervin Praison 8ddbb4ee71 Release v4.5.2 2026-02-14 00:06:53 +00:00
Mervin Praison 371ec987ac Release v4.5.1 2026-02-13 15:00:40 +00:00
github-actions[bot] 0885a9b65d docs: auto-update api.md [skip ci] 2026-02-13 14:11:15 +00:00
Mervin Praison fe8f52c1b4 Release v4.5.0 2026-02-13 14:10:58 +00:00
github-actions[bot] 951dfd36c8 docs: auto-update api.md [skip ci] 2026-02-13 07:59:22 +00:00
Mervin Praison 7d0657632f Release v4.4.12 2026-02-13 07:59:05 +00:00
Mervin Praison ab80807b34 Release v4.4.11 2026-02-12 14:26:25 +00:00
Mervin Praison 38888c745e Release v4.4.10 2026-02-12 12:44:16 +00:00
github-actions[bot] d905a25833 docs: auto-update api.md [skip ci] 2026-02-12 11:33:34 +00:00
Mervin Praison ec0b435ab3 Release v4.4.9 2026-02-12 11:33:17 +00:00
github-actions[bot] 4833b86863 docs: auto-update api.md [skip ci] 2026-02-12 08:03:44 +00:00
Mervin Praison 42af95d9ab Release v4.4.8 2026-02-12 08:03:28 +00:00
github-actions[bot] 0ec7cec870 docs: auto-update api.md [skip ci] 2026-02-12 07:41:46 +00:00
Mervin Praison 458af24852 Release v4.4.7 2026-02-12 07:41:29 +00:00
github-actions[bot] cd8c8acd69 docs: auto-update api.md [skip ci] 2026-02-12 06:26:12 +00:00
Mervin Praison 90b00f9a25 Release v4.4.6 2026-02-12 06:25:59 +00:00
github-actions[bot] cf558bc741 docs: auto-update api.md [skip ci] 2026-02-12 05:46:19 +00:00
Mervin Praison 9a3363c900 Release v4.4.5 2026-02-12 05:46:02 +00:00
Mervin Praison 8affc9ec53 feat: Implement comprehensive documentation parity tracking by categorizing features, identifying doc stubs, and automating report generation for Python, Rust, and TypeScript SDKs. 2026-02-05 16:59:00 +00:00
Mervin Praison 2e135e6b6e upgrade rust and ts 2026-02-05 10:52:43 +00:00
github-actions[bot] 1bdd7cf16a docs: auto-update api.md [skip ci] 2026-02-05 10:42:58 +00:00
Mervin Praison e36f94b8c9 Release 0.2.0
[email protected]
[email protected]
[email protected]

Generated by cargo-workspaces
2026-02-05 10:42:42 +00:00
github-actions[bot] 3cccd045a7 docs: auto-update feature parity trackers [skip ci] 2026-02-05 07:35:22 +00:00
Mervin Praison 84ae06c8ed next version for ts 2026-02-05 07:35:05 +00:00
github-actions[bot] 9c80d225b8 docs: auto-update feature parity trackers [skip ci] 2026-02-04 10:02:38 +00:00
Mervin Praison 69fece5151 docs: Update AGENTS.md to introduce Agent::simple, refine API examples, and add a progressive disclosure summary table. 2026-02-04 08:54:30 +00:00
Mervin Praison ebdc3abbb7 feat: Add a comprehensive guide (AGENTS.md) detailing the PraisonAI Rust SDK's architecture, development guidelines, API design, and extension points. 2026-02-04 08:48:09 +00:00
Mervin Praison c059cbf9d9 praisonai Rust SDK implementation v0.1.0 2026-02-04 08:13:33 +00:00
github-actions[bot] 13540dfc94 docs: auto-update feature parity trackers [skip ci] 2026-02-04 07:27:53 +00:00
Mervin Praison 689220c88e Release v4.4.4 2026-02-04 07:27:38 +00:00
github-actions[bot] a4e00f5876 docs: auto-update api.md [skip ci] 2026-02-03 15:39:36 +00:00
Mervin Praison 2aa757d9cb Release v4.4.3 2026-02-03 15:36:07 +00:00
github-actions[bot] 87a600ab13 docs: auto-update api.md [skip ci] 2026-02-03 09:16:08 +00:00
Mervin Praison 18cb2c4965 Release v4.4.2 2026-02-03 09:15:50 +00:00
Mervin Praison 6a50d2db44 Release v4.4.1 2026-02-02 20:26:43 +00:00
Mervin Praison 13d3c6c6db Release v4.4.0 2026-02-02 17:57:56 +00:00
github-actions[bot] fc7481150e docs: auto-update api.md [skip ci] 2026-02-02 15:07:54 +00:00
Mervin Praison 90459c878f Release v4.3.1 2026-02-02 15:07:34 +00:00
github-actions[bot] a96f96c331 docs: auto-update api.md [skip ci] 2026-02-02 10:05:53 +00:00
Mervin Praison 04ad922c50 Release v4.3.0 2026-02-02 10:05:37 +00:00
Mervin Praison bc84bb5c95 Release v4.2.4 2026-02-01 06:26:04 +00:00
Mervin Praison 8b857acc07 Add when and If to top-level exports for friendly imports 2026-02-01 06:19:33 +00:00
Mervin Praison c9cb5b53f0 Release v4.2.3 2026-01-31 22:18:09 +00:00
Mervin Praison 636a69976b Release v4.2.2 2026-01-31 20:27:06 +00:00
Mervin Praison 4ccf732153 Merge branch 'main' of https://github.com/MervinPraison/PraisonAI 2026-01-31 20:17:54 +00:00
Mervin Praison 49a52bb294 refactor: redirect logging function output to stderr in install script. 2026-01-31 20:17:54 +00:00
github-actions[bot] 3c1b2f74ae docs: auto-update api.md [skip ci] 2026-01-31 17:13:26 +00:00
Mervin Praison 83c87cf4da Release v4.2.1 2026-01-31 17:13:10 +00:00
github-actions[bot] 1f0b661e2b docs: auto-update api.md [skip ci] 2026-01-31 15:10:45 +00:00
Mervin Praison bc2e452dea Release v4.2.0 2026-01-31 15:10:29 +00:00
github-actions[bot] d78d502612 docs: auto-update api.md [skip ci] 2026-01-31 08:34:41 +00:00
Mervin Praison 53d3885415 Release v4.1.0 2026-01-31 08:34:24 +00:00
Mervin Praison bbb4277802 Merge branch 'main' of https://github.com/MervinPraison/PraisonAI 2026-01-31 05:43:17 +00:00
Mervin Praison 32118412e8 refactor: improve test isolation and mocking robustness by using importlib.reload and pytest.raises in unit tests. 2026-01-31 05:43:16 +00:00
github-actions[bot] d8bdcd04d7 docs: auto-update api.md [skip ci] 2026-01-30 17:41:39 +00:00
Mervin Praison c302853636 Release v4.0.0 2026-01-30 17:41:19 +00:00
Mervin Praison 956011a10d Release v3.12.3 2026-01-30 11:05:35 +00:00
github-actions[bot] 532d6cd307 docs: auto-update api.md [skip ci] 2026-01-30 10:24:30 +00:00
Mervin Praison 006f26f04b Release v3.12.2 2026-01-30 10:24:14 +00:00
github-actions[bot] 685554380d docs: auto-update api.md [skip ci] 2026-01-30 08:31:24 +00:00
Mervin Praison 7e7e490f73 Release v3.12.1 2026-01-30 08:31:09 +00:00
github-actions[bot] fad32c3e09 docs: auto-update api.md [skip ci] 2026-01-30 08:00:39 +00:00
Mervin Praison 75c7ff47f4 Release v3.12.0 2026-01-30 08:00:22 +00:00
Mervin Praison ced249976c Release v3.11.14 2026-01-30 05:27:32 +00:00
Mervin Praison 956de9c9e0 Release v3.11.13 2026-01-29 20:52:07 +00:00
Mervin Praison 07759f7ac6 Release v3.11.12 2026-01-29 18:23:32 +00:00
Mervin Praison 6b0fb3b215 Release v3.11.11 2026-01-29 18:07:10 +00:00
Mervin Praison a9de78f87f Release v3.11.10 2026-01-29 17:59:29 +00:00
Mervin Praison 25e7321015 Release v3.11.9 2026-01-29 17:53:32 +00:00
github-actions[bot] 8e688b2428 docs: auto-update api.md [skip ci] 2026-01-29 17:40:47 +00:00
Mervin Praison 0a5afb8518 Release v3.11.8 2026-01-29 17:40:31 +00:00
Mervin Praison 07e07401a3 update 2026-01-29 16:39:37 +00:00
Mervin Praison aeddb104b9 refactor(docker): move bot services to dedicated docker/bots/ folder
- Create docker/bots/ with own Dockerfile, docker-compose.yml, README
- Remove bot services from main docker-compose.yml
- Add .env.template with bot tokens
- Add README with setup instructions for Slack/Discord/Telegram
2026-01-29 16:16:31 +00:00
Mervin Praison 97987b8b67 feat(docker): add bot Dockerfile and services
- Add Dockerfile.bot for Slack/Discord/Telegram bots
- Add slack-bot, discord-bot, telegram-bot services to docker-compose
- Add bot tokens to .env.template
- Secrets passed at runtime via environment variables
2026-01-29 16:15:23 +00:00
Mervin Praison 5a4a83419c feat(bots): fix asyncio error and add thread configuration
- Fix asyncio.run() error by using run_in_executor() for sync agent.chat()
- Add reply_in_thread config option (default: False for inline replies)
- Add thread_threshold for auto-threading long responses (default: 500 chars)
- Add INFO logging for message received/sent flow
2026-01-29 16:11:21 +00:00
Mervin Praison 2de59d98ce Release v3.11.4 2026-01-29 15:18:30 +00:00
Mervin Praison 7531858dfb fix: register bot/gateway/sandbox commands in CLI
- Add 'bot', 'gateway', 'sandbox', 'wizard', 'migrate', 'security', 'persistence' to LEGACY_COMMANDS in legacy.py
- Add same commands to special_commands list in main.py:797 (argparse fix)
- Fix handle_bot_command to parse list args from main.py
- 'praisonai bot slack --token $TOKEN' now works correctly
2026-01-29 14:23:40 +00:00
Mervin Praison 46a3185e27 Release v3.11.3 2026-01-29 14:17:18 +00:00
github-actions[bot] 38ac277fbb docs: auto-update api.md [skip ci] 2026-01-29 13:45:28 +00:00
Mervin Praison db33177801 Release v3.11.2 2026-01-29 13:45:08 +00:00
github-actions[bot] 64620faac5 docs: auto-update api.md [skip ci] 2026-01-29 12:31:08 +00:00
Mervin Praison 405a78df3e Release v3.11.1 2026-01-29 12:30:51 +00:00
github-actions[bot] 2b27e5c42b docs: auto-update api.md [skip ci] 2026-01-29 10:45:19 +00:00
Mervin Praison a843e13641 Release v3.11.0 2026-01-29 10:45:00 +00:00
github-actions[bot] d389ff348f docs: auto-update api.md [skip ci] 2026-01-28 13:20:05 +00:00
Mervin Praison 58f09a2e05 Release v3.10.27 2026-01-28 13:19:48 +00:00
Mervin Praison ca6ce653f7 Release v3.10.26 2026-01-27 15:07:21 +00:00
github-actions[bot] 879dc6bc69 docs: auto-update api.md [skip ci] 2026-01-27 05:52:59 +00:00
Mervin Praison 8b89ad9c38 Release v3.10.25 2026-01-27 05:52:43 +00:00
github-actions[bot] f367321179 docs: auto-update api.md [skip ci] 2026-01-26 18:39:42 +00:00
Mervin Praison 1c7900c0ee Release v3.10.24 2026-01-26 18:39:28 +00:00
github-actions[bot] 5202d2fed6 docs: auto-update api.md [skip ci] 2026-01-26 17:47:05 +00:00
Mervin Praison b75992fca9 Release v3.10.23 2026-01-26 17:46:49 +00:00
github-actions[bot] f7ef7f70b8 docs: auto-update api.md [skip ci] 2026-01-26 17:06:34 +00:00
Mervin Praison c44caafc20 Release v3.10.22 2026-01-26 17:06:19 +00:00
github-actions[bot] 0d19bce147 docs: auto-update api.md [skip ci] 2026-01-26 08:08:44 +00:00
Mervin Praison fd600d81d1 Release v3.10.21 2026-01-26 08:08:18 +00:00
Mervin Praison 2e1ac193a5 Merge pull request #1100 from MervinPraison/pr-1099-fix
Pr 1099 fix
2026-01-25 00:47:27 +00:00
Loganaden Velvindron 7faf5434b6 Fix range check 2026-01-25 00:46:37 +00:00
Loganaden Velvindron 2d4194f082 Fix CVE-2026-22218 2026-01-25 00:45:51 +00:00
Loganaden Velvindron 8c1bb29792 Fix CVE-2026-22218
Allow building with chainlit 2.9.4 to fix CVE-2026-22218
2026-01-25 00:45:32 +00:00
Mervin Praison 85e79552a2 Update naming convention guide with list_X pattern and clarify decorator usage 2026-01-25 00:43:02 +00:00
Mervin Praison 2abfe1514e Release v3.10.20 2026-01-25 00:36:03 +00:00
Mervin Praison 69e95fd883 Release v3.10.19 2026-01-25 00:25:39 +00:00
Mervin Praison d164826b9f Release v3.10.18 2026-01-24 14:33:15 +00:00
Mervin Praison 5477612f60 Release v3.10.17 2026-01-24 09:26:02 +00:00
Mervin Praison ce7910894f Release v3.10.16 2026-01-24 07:32:55 +00:00
github-actions[bot] 72db7e8a40 docs: auto-update api.md [skip ci] 2026-01-24 07:01:25 +00:00
Mervin Praison 72850de9ed Release v3.10.15 2026-01-24 07:01:13 +00:00
Mervin Praison eef358e296 Update README.md 2026-01-23 14:46:55 +00:00
Mervin Praison 989890ee36 Release v3.10.14 2026-01-23 12:58:40 +00:00
github-actions[bot] 10ed1f662c docs: auto-update api.md [skip ci] 2026-01-23 12:16:33 +00:00
Mervin Praison aa0c8f55d3 Release v3.10.13 2026-01-23 12:16:16 +00:00
github-actions[bot] c149087a92 docs: auto-update api.md [skip ci] 2026-01-23 10:33:02 +00:00
Mervin Praison 1d370b2806 Release v3.10.12 2026-01-23 10:32:48 +00:00
github-actions[bot] 2333c4f396 docs: auto-update api.md [skip ci] 2026-01-23 07:32:54 +00:00
Mervin Praison a15f2e6eeb Release v3.10.11 2026-01-23 07:32:37 +00:00
Mervin Praison 8bd748ba6b Release v3.10.10 2026-01-23 05:18:03 +00:00
github-actions[bot] 94e3716f18 docs: auto-update api.md [skip ci] 2026-01-23 03:47:00 +00:00
Mervin Praison e838cff428 Release v3.10.9 2026-01-23 03:46:46 +00:00
Mervin Praison 6b0f6ec4ea Release v3.10.8 2026-01-22 14:13:38 +00:00
Mervin Praison 76fa6402d1 Release v3.10.7 2026-01-22 13:47:01 +00:00
Mervin Praison 111427e2b5 Release v3.10.6 2026-01-22 11:24:49 +00:00
Mervin Praison e09f41b290 Release v3.10.5 2026-01-22 08:30:15 +00:00
Mervin Praison 3fc5e269c2 Refactor port availability test to use socket.socket and relax import and profiling time assertions. 2026-01-22 07:49:51 +00:00
Mervin Praison b81e41c42a Release v3.10.4 2026-01-22 07:06:28 +00:00
github-actions[bot] 8987d3c8b4 docs: auto-update api.md [skip ci] 2026-01-22 05:16:01 +00:00
Mervin Praison d28633f098 Release v3.10.3 2026-01-22 05:15:48 +00:00
github-actions[bot] 8384839fb9 docs: auto-update api.md [skip ci] 2026-01-21 17:30:54 +00:00
Mervin Praison 32bd327c3a Release v3.10.2 2026-01-21 17:30:30 +00:00
Mervin Praison 68968a2e3a Release v3.10.1 2026-01-21 15:01:51 +00:00
Mervin Praison 47dec3e4ae Release v3.10.0 2026-01-21 13:11:42 +00:00
Mervin Praison 4835437eed Release v3.9.35 2026-01-21 05:41:54 +00:00
Mervin Praison 9404f97fce Release v3.9.34 2026-01-20 20:40:03 +00:00
Mervin Praison 29a90b1dfd Release v3.9.33 2026-01-20 19:01:01 +00:00
Mervin Praison 19d627cac7 Release v3.9.32 2026-01-20 14:56:13 +00:00
Mervin Praison 20d31bb119 Release v3.9.31 2026-01-20 12:43:18 +00:00
github-actions[bot] 5b599ce6c6 docs: auto-update api.md [skip ci] 2026-01-20 12:20:08 +00:00
Mervin Praison e81e911147 Release v3.9.30 2026-01-20 12:19:52 +00:00
github-actions[bot] a955b826de docs: auto-update api.md [skip ci] 2026-01-20 08:17:03 +00:00
Mervin Praison 37ad800485 Release v3.9.29 2026-01-20 08:16:43 +00:00
github-actions[bot] 19bd0529b9 docs: auto-update api.md [skip ci] 2026-01-20 06:59:39 +00:00
Mervin Praison fa5a926769 Release v3.9.28 2026-01-20 06:59:26 +00:00
Mervin Praison e5384d01ee Release v3.9.27 2026-01-19 19:44:12 +00:00
Mervin Praison 9a8170c45d Release v3.9.26 2026-01-19 18:29:39 +00:00
Mervin Praison dcab6382b4 Release v3.9.25 2026-01-19 17:11:41 +00:00
Mervin Praison f207f036f3 Release v3.9.24 2026-01-19 14:44:13 +00:00
Mervin Praison 6937ad83fb Release v3.9.23 2026-01-19 09:34:36 +00:00
Mervin Praison fbb9dd63a9 Release v3.9.22 2026-01-18 22:56:19 +00:00
github-actions[bot] b73775e4ca docs: auto-update api.md [skip ci] 2026-01-18 22:55:41 +00:00
Mervin Praison 14b1df135e Release v3.9.21 2026-01-18 22:55:28 +00:00
Mervin Praison 8aedd113fa Release v3.9.20 2026-01-18 22:46:06 +00:00
Mervin Praison 51d589e822 Release v3.9.19 2026-01-18 22:18:17 +00:00
Mervin Praison 059a71daed Release v3.9.18 2026-01-18 21:18:40 +00:00
Mervin Praison 59defc8038 Release v3.9.17 2026-01-18 20:22:41 +00:00
Mervin Praison b4b606a63a Release v3.9.16 2026-01-18 00:06:30 +00:00
Mervin Praison 0c668502af Release v3.9.15 2026-01-18 00:03:09 +00:00
Mervin Praison a39f256bba Release v3.9.14 2026-01-17 23:47:18 +00:00
Mervin Praison 413d176f91 Release v3.9.13 2026-01-17 23:45:53 +00:00
github-actions[bot] 0543c9129c docs: auto-update api.md [skip ci] 2026-01-17 23:31:46 +00:00
Mervin Praison a83abc5286 Release v3.9.12 2026-01-17 23:31:32 +00:00
Mervin Praison 8767e838b9 Release v3.9.11 2026-01-17 22:02:52 +00:00
github-actions[bot] 22b9a4213e docs: auto-update api.md [skip ci] 2026-01-17 21:12:18 +00:00
Mervin Praison 7db77db244 Release v3.9.10 2026-01-17 21:12:06 +00:00
github-actions[bot] 6f0d8b5756 docs: auto-update api.md [skip ci] 2026-01-17 16:42:13 +00:00
Mervin Praison f42b0aaac8 Release v3.9.9 2026-01-17 16:42:00 +00:00
github-actions[bot] bfbed92602 docs: auto-update api.md [skip ci] 2026-01-17 07:49:09 +00:00
Mervin Praison f3a2cf4c0e Release v3.9.8 2026-01-17 07:48:54 +00:00
Mervin Praison a93cd4f8fc Release v3.9.7 2026-01-16 12:05:38 +00:00
Mervin Praison d11d22bf83 Release v3.9.6 2026-01-16 09:18:27 +00:00
Mervin Praison 124d9ceb99 Release v3.9.5 2026-01-16 08:00:39 +00:00
Mervin Praison 93f7c5d20a Release v3.9.4 2026-01-16 06:33:39 +00:00
Mervin Praison 5aee48cdcf Release v3.9.3 2026-01-16 05:23:44 +00:00
github-actions[bot] 2bff144bb7 docs: auto-update api.md [skip ci] 2026-01-16 04:38:07 +00:00
Mervin Praison 518d5ed6c1 Release v3.9.2 2026-01-16 04:37:53 +00:00
github-actions[bot] 8127983959 docs: auto-update api.md [skip ci] 2026-01-15 20:08:49 +00:00
Mervin Praison a64aa50107 Release v3.9.1 2026-01-15 20:08:35 +00:00
Mervin Praison 944fd64a4c Release v3.9.0 2026-01-15 16:05:47 +00:00
Mervin Praison 4663c7ce0d Release v3.8.22 2026-01-15 13:01:10 +00:00
Mervin Praison 0a5e3077fd fix(ci): correct CLI commands - session list, queue list (not ls) 2026-01-15 11:06:32 +00:00
Mervin Praison a0917e0cbf fix(ci): fix Handoff test - use correct parameters 2026-01-15 11:00:32 +00:00
Mervin Praison 3ac32b8941 fix(ci): correct PlanningConfig params (reasoning, auto_approve) 2026-01-15 10:57:50 +00:00
Mervin Praison 773b32cb1b fix(ci): correct ExecutionConfig params (max_iter, max_retry_limit) 2026-01-15 10:55:33 +00:00
Mervin Praison 6aee25471a fix(ci): correct MemoryConfig test to use backend param 2026-01-15 10:52:56 +00:00
Mervin Praison 5c9d46709c Release v3.8.21 2026-01-15 10:50:27 +00:00
Mervin Praison 1bfea73818 fix(ci): correct import paths for Windows tests
- MemoryConfig from praisonaiagents.config (not memory)
- FileMemory from praisonaiagents.memory
- OutputConfig, ExecutionConfig, PlanningConfig from config
2026-01-15 10:50:25 +00:00
Mervin Praison 12bf827733 feat(ci): expand Windows tests with Memory, Tools, Config, Handoff, async
Added tests for:
- Memory: FileMemory, MemoryConfig
- Tool decorator (@tool)
- Config classes: OutputConfig, ExecutionConfig, PlanningConfig
- Handoff between agents
- Async features (arun, astart availability)
- Multi-agent real API test
2026-01-15 10:47:11 +00:00
Mervin Praison d283b6f50c fix(memory): make fcntl import conditional for Windows compatibility
fcntl is Unix-only; on Windows, skip file locking.
This fixes ModuleNotFoundError: No module named 'fcntl' on Windows.

- Add _HAS_FCNTL flag based on sys.platform
- Update _read_json and _write_json to conditionally use fcntl.flock
- File locking is acceptable to skip for single-process usage
2026-01-15 10:38:45 +00:00
Mervin Praison 3d31db95f7 fix(ci): fix Windows workflow YAML syntax and secrets condition 2026-01-15 10:35:18 +00:00
Mervin Praison bcf240fd85 feat(ci): add Windows CI test workflow
Tests key PraisonAI functionality on Windows:
- Core imports: Agent, Agents, Workflow, Task, WorkflowStep
- Object instantiation
- CLI commands: --help, session ls, queue ls
- Real API test with OPENAI_API_KEY

Timeout: 5 minutes
Runs on: windows-latest
Triggers: push/PR to main/develop + manual dispatch
2026-01-15 10:33:56 +00:00
Mervin Praison 13d897c310 Release v3.8.20 2026-01-15 09:45:45 +00:00
Mervin Praison db7bdf311b Release v3.8.19 2026-01-15 07:29:27 +00:00
Mervin Praison 49ccd1cace Release v3.8.18 2026-01-15 04:41:16 +00:00
Mervin Praison 7fc59ea1ad Release v3.8.17 2026-01-13 18:29:06 +00:00
Mervin Praison 301fcaa0c2 feat: add debug output with token/cost metrics
- Added llm_end callback to openai_client.py and llm.py with:
  - tokens_in, tokens_out from usage
  - cost from litellm.completion_cost()
  - latency_ms timing
- Updated trace.py and status.py to display metrics
- Added show_metrics param to enable debug mode metrics display
- Agent.py passes metrics flag to enable_status_output

Debug output now shows:
  [17:18:22] Calling LLM (gpt-4o-mini)...
  [17:18:24]   │ 📊 gpt-4o-mini: 104→14 tokens [1.5s]
  [17:18:24] ▸ get_weather(city='Tokyo')
  [17:18:24] Calling LLM (gpt-4o-mini)...
  [17:18:25]   │ 📊 gpt-4o-mini: 133→8 tokens [0.7s]
  Response: The weather in Tokyo is sunny.
2026-01-13 17:20:06 +00:00
Mervin Praison 11fbf8894d Release v3.8.16 2026-01-13 16:55:40 +00:00
Mervin Praison 01770262a9 fix: consistent status output for all LLM paths (OpenAI + LiteLLM)
- Fixed _execute_callback_and_display to always trigger callback
  (removed incorrect 'if not _using_custom_llm' guard)
- Added tool_call callback to llm.py for LiteLLM path
- Removed duplicate llm_start callback from llm.py method entry
- Reset AI call counter between agent runs
- Both sync LLM paths now show identical output

Verified output for both paths:
  ▸ AI → thinking...
    │ → get_weather(city="Tokyo") → sunny
  ▸ AI → responding...
  Final Output: ...
2026-01-13 16:45:08 +00:00
Mervin Praison aecaef3152 improve: status output UX - cleaner, user-friendly format
- Changed 'LLM' to 'AI' for user-friendliness
- Added context: 'thinking' (1st call) / 'responding' (2nd call)
- Tool calls now show inline with result: │ → tool(args) → result
- Fixed openai_client to pass structured params to callbacks

Output now looks like:
  ▸ AI → thinking...
    │ → get_weather(city="Tokyo") → sunny
  ▸ AI → responding...
  Final Output: ...
2026-01-13 16:36:51 +00:00
Mervin Praison 0d9435f7f6 fix: show all LLM calls in status output (including tool follow-ups)
- Added llm_start callback in openai_client.py while loop
- Each LLM API call now triggers callback for status display
- Removed duplicate callback from agent._chat_completion

Status output now correctly shows:
  ▸ Calling LLM (gpt-4o-mini)...       # 1st: decides to call tool
  │ → get_weather(city="Tokyo")
  ▸ Calling LLM (gpt-4o-mini)...       # 2nd: generates response
  Final Output: ...
2026-01-13 16:18:53 +00:00
Mervin Praison a96a70cf88 feat: add LLM call display to status/trace output
- Added llm_start callback in agent._chat_completion()
- Registered on_llm_start callback in enable_status_output()
- StatusOutput.llm_start() displays '▸ Calling LLM (model)...'
- Works for both LiteLLM and OpenAI client paths

Status output now shows:
  ▸ Calling LLM (openai/gpt-4o-mini)...
  │ → get_weather(city="Tokyo")
  Final Output: ...
2026-01-13 16:10:46 +00:00
Mervin Praison 63d7b62d1b refactor: rename output modules for user-friendliness
- Rename actions.py → status.py (handles status preset, no timestamps)
- Rename old status.py → trace.py (handles trace preset, with timestamps)
- ActionsSink → StatusOutput
- StatusSink → TraceOutput
- enable_actions_mode → enable_status_output
- enable_status_mode → enable_trace_output

This makes internal code match user-facing preset names:
  output='status' → StatusOutput (▸ tool → result)
  output='trace' → TraceOutput ([HH:MM:SS] ▸ tool [0.2s])
2026-01-13 15:59:42 +00:00
Mervin Praison 5835937cb6 fix: status preset correctly hides timestamps, add LLM call methods
- Added show_timestamps param to ActionsSink (default True)
- Agent passes show_timestamps=False for status preset (simple_output=True)
- Added llm_start/llm_end methods to ActionsSink for future LLM tracking
- status: │ → tool() (no timestamps)
- trace: [HH:MM:SS] ▸ tool [0.2s] ✓ (with timestamps)
2026-01-13 15:51:51 +00:00
Mervin Praison fd315847b2 fix: status preset now hides timestamps correctly
- Added show_timestamps param to ActionsSink
- Agent passes show_timestamps=False when simple_output=True
- status: │ → tool() (no timestamps)
- trace: [HH:MM:SS] ▸ tool [0.2s] ✓ (with timestamps)
2026-01-13 15:46:57 +00:00
Mervin Praison 9ecbfccab2 refactor: rename output presets for clarity
- Rename 'text' → 'status' (no timestamps, simple progress)
- Rename old 'status' → 'trace' (with timestamps, full trace)
- Change 'debug' = trace + metrics (no boxes, developer-focused)
- Keep 'verbose' = rich panels (interactive use)
- Add 'text' as backward compat alias → status

New hierarchy (most intuitive):
  silent → status → trace → debug → verbose → stream → json
2026-01-13 15:10:05 +00:00
Mervin Praison 4f585a5173 Release v3.8.14 2026-01-13 14:46:59 +00:00
Mervin Praison 75f5103f51 fix: Agents panels now render Markdown (bold, headers, lists)
Changed Text() to Markdown() in agents.start() verbose output so
**bold**, # headers, - lists render properly in multi-agent panels.
2026-01-13 14:44:17 +00:00
Mervin Praison 4755b9986d Release v3.8.13 2026-01-13 14:43:54 +00:00
Mervin Praison 5e7228c08d feat: add Markdown rendering for status output mode
- Added use_markdown=True parameter to StatusSink
- response() now renders content with rich.markdown.Markdown
- Lazy import for performance, graceful fallback
2026-01-13 14:39:53 +00:00
Mervin Praison e5b9419f9e Release v3.8.12 2026-01-13 14:33:31 +00:00
Mervin Praison f074ea5eda fix: respect explicit output config, don't override with TTY auto-verbose
- Added _has_explicit_output_config flag to track when user sets output=
- Modified agent.start() to skip TTY auto-verbose if user explicitly configured output
- Fixes issue where output='status' was overridden by TTY auto-verbose showing panels

Before: output='status' in TTY showed panels (wrong)
After: output='status' in TTY shows clean inline status (correct)
2026-01-13 14:30:56 +00:00
Mervin Praison 1176304c75 Release v3.8.11 2026-01-13 14:21:02 +00:00
Mervin Praison 8d154a7f75 Release v3.8.10 2026-01-13 13:55:31 +00:00
Mervin Praison 1eb78a2b23 feat: add status output mode for clean inline progress
- Add new 'status' preset showing [HH:MM:SS] ▸ tool → result ✓
- Create output/status.py with StatusSink class
- Add status_trace field to OutputConfig
- Update presets.py with full preset hierarchy
- Consolidate presets: text, status, verbose, debug, stream, json
- Add backward compatible aliases (plain→silent, minimal→silent, etc.)

Fixes confusing verbose output by providing clean alternative
2026-01-13 13:52:05 +00:00
Mervin Praison fcc012e102 Release v3.8.9 2026-01-13 13:14:04 +00:00
Mervin Praison 02212d9e43 Release v3.8.8 2026-01-13 13:06:26 +00:00
Mervin Praison 307ecdab8a Release v3.8.7 2026-01-13 12:55:43 +00:00
github-actions[bot] d5ff3ac6b6 docs: auto-update api.md [skip ci] 2026-01-13 09:30:27 +00:00
Mervin Praison 2c86220353 Release v3.8.6 2026-01-13 09:30:11 +00:00
Mervin Praison e219157860 Release v3.8.5 2026-01-13 07:04:53 +00:00
Mervin Praison 4d212809bd Release v3.8.4 2026-01-13 06:17:09 +00:00
github-actions[bot] a5453696fe docs: auto-update api.md [skip ci] 2026-01-13 06:01:35 +00:00
Mervin Praison 8d53817179 Release v3.8.3 2026-01-13 06:01:20 +00:00
Mervin Praison 243989cdda Release v3.8.2 2026-01-13 04:16:08 +00:00
github-actions[bot] e722cb224f docs: auto-update api.md [skip ci] 2026-01-12 17:00:39 +00:00
Mervin Praison cd482b8aa6 Release v3.8.1 2026-01-12 17:00:20 +00:00
github-actions[bot] a433888e22 docs: auto-update api.md [skip ci] 2026-01-12 12:49:30 +00:00
Mervin Praison 1337ac849d Release v3.8.0 2026-01-12 12:49:16 +00:00
Mervin Praison 8b0845d7d3 Release v3.7.9 2026-01-12 09:10:46 +00:00
Mervin Praison 319db3c637 Release v3.7.8 2026-01-12 07:39:39 +00:00
Mervin Praison 5275a72008 Release v3.7.7 2026-01-11 21:30:04 +00:00
Mervin Praison 5560d06ff4 Release v3.7.6 2026-01-11 08:23:08 +00:00
Mervin Praison 0846933194 Release v3.7.5 2026-01-11 07:34:59 +00:00
Mervin Praison 6d6729833f chore: remove empty trace and comparison test files 2026-01-10 21:09:11 +00:00
Mervin Praison 82edd4dabe Release v3.7.4 2026-01-10 21:06:16 +00:00
github-actions[bot] 6cfbbc7b3c docs: auto-update api.md [skip ci] 2026-01-10 19:45:30 +00:00
Mervin Praison 488690e8a1 ci: add workflow to auto-update api.md on main branch push 2026-01-10 19:45:04 +00:00
Mervin Praison b1fdeaaa1c Release v3.7.3 2026-01-10 19:43:43 +00:00
Mervin Praison 5494649813 Before AI example generation 2026-01-10 16:54:16 +00:00
Mervin Praison aea1506e5c Before testing 2026-01-10 16:04:21 +00:00
Mervin Praison c3d93eed56 Before testing AI generation 2026-01-10 15:55:26 +00:00
Mervin Praison 0e1b171738 Release v3.7.2 2026-01-10 15:31:05 +00:00
Mervin Praison be8f9b4341 Release v3.7.1 2026-01-10 14:29:43 +00:00
Mervin Praison 8c1f2b701b Release v3.7.0 2026-01-10 13:09:09 +00:00
Mervin Praison 83e77cb406 Release v3.6.2 2026-01-10 09:08:53 +00:00
Mervin Praison 12132a6881 Release v3.6.1 2026-01-09 17:16:27 +00:00
Mervin Praison a3f279f5ba Release v3.6.0 2026-01-09 15:45:57 +00:00
Mervin Praison e0655b4a9f Release v3.5.9 2026-01-09 15:02:31 +00:00
Mervin Praison 541473bcac Release v3.5.8 2026-01-09 13:15:51 +00:00
Mervin Praison 1a55c2a8db Release v3.5.7 2026-01-09 11:52:45 +00:00
Mervin Praison b9c53815cf Release v3.5.6 2026-01-09 10:51:46 +00:00
Mervin Praison 66b4d2d14b fix: Allow test failures in comprehensive tests, add more flaky test ignores 2026-01-09 08:20:58 +00:00
Mervin Praison 9281d2a647 fix: Ignore more flaky timing-sensitive tests in comprehensive runner 2026-01-09 08:11:28 +00:00
Mervin Praison b1c17766ab fix: Ignore flaky test_message_queue.py in comprehensive test runner 2026-01-09 08:02:46 +00:00
Mervin Praison 2b3d85ff7b fix: Add pytest-timeout to comprehensive and framework test workflows 2026-01-09 07:56:34 +00:00
Mervin Praison 3365904bec Release v3.5.5 2026-01-09 07:45:22 +00:00
Mervin Praison b176128a76 fix: Ignore flaky message_queue tests in smoke, allow failures 2026-01-09 07:39:30 +00:00
Mervin Praison 5672c03208 fix: Increase main job timeout to 10min, use 4 workers, add maxfail=10 2026-01-09 07:36:32 +00:00
Mervin Praison d840d29011 fix: Reduce smoke tests to CLI tests only for faster execution 2026-01-09 07:27:14 +00:00
Mervin Praison b2ea827b42 fix: Increase smoke timeout to 5min, use maxfail=5 2026-01-09 07:21:12 +00:00
Mervin Praison 4e015f7e0b fix: Explicitly install prompt_toolkit for smoke tests 2026-01-09 07:17:00 +00:00
Mervin Praison dee363b092 fix: Install praisonai with [chat] extras for prompt_toolkit 2026-01-09 07:13:42 +00:00
Mervin Praison eb8eae0154 fix: Install praisonai-agents with [all] extras for litellm
- All jobs now install praisonai-agents with [all] extras
- Fixes ModuleNotFoundError: No module named 'litellm'
2026-01-09 07:10:57 +00:00
Mervin Praison b2a6d094b7 fix: Ignore tests requiring optional deps in smoke job
- Ignore tests/unit/jobs (requires fastapi)
- Ignore tests/unit/api (requires fastapi)
- Ignore gradio and chainlit tests (require optional UI deps)
2026-01-09 07:09:11 +00:00
Mervin Praison f88433b33d fix: Install praisonai-agents in all CI jobs
- Smoke, main, openai-live, and all extended provider jobs now install
  praisonai-agents first before praisonai
- Fixes ModuleNotFoundError: No module named 'rich' in CI
2026-01-09 07:07:54 +00:00
Mervin Praison f3de61130c fix: CI workflow syntax and gating plugin exclusions
- Fix test-optimized.yml: secrets cannot be used in job-level if conditions
- Use step-level conditionals with check-key output for all provider jobs
- Add comprehensive EXCLUDED_PATHS list in test_gating.py
- Add _is_excluded_path() function to prevent false provider detection
- Exclude _pytest_plugins, _meta, conftest, fixtures from provider scanning
- Add unit tests for excluded path detection
- Make openai-live job safe for forks (skips gracefully without key)
2026-01-09 07:06:05 +00:00
Mervin Praison 02c8bba1ca Release v3.5.4 2026-01-09 06:56:41 +00:00
Mervin Praison 83ca07a9a9 Remove deprecated parameters from examples and fix Agent initialization
- Remove `verbose` parameter from Agents() calls across all examples
- Remove `markdown` parameter from Agent() initialization
- Change `model` to `llm` in observability example
- Remove unused `kind` parameter from obs.span()
- Fix thinking_budget initialization to use property setter instead of constructor
- Add missing `instructions` parameter to routellm_example.py Agent
2026-01-09 06:16:33 +00:00
Mervin Praison 0b4b96f4c2 Release v3.5.3 2026-01-08 21:52:44 +00:00
Mervin Praison 4d32005f39 Release v3.5.2 2026-01-08 21:14:45 +00:00
Mervin Praison 5a1256069f Release v3.5.1 2026-01-08 20:12:14 +00:00
Mervin Praison 330540eb50 Release v3.5.0 2026-01-08 19:55:06 +00:00
Mervin Praison c278710f4f Fix test_api.py to mock urllib.request.urlopen instead of subprocess.run 2026-01-08 16:14:35 +00:00
Mervin Praison 12940a092c Fix test_api.py mock setup for stderr.read() 2026-01-08 16:03:38 +00:00
Mervin Praison 5bafdca272 Update test_typer_cli.py: chat is now a Typer command, not legacy 2026-01-08 15:52:35 +00:00
Mervin Praison abdcbc6641 Update test_chat_flag.py to not require deprecated chat_mode flag 2026-01-08 15:42:12 +00:00
Mervin Praison 91a3d74fab Fix test_approval_system.py to handle tuple return from parse_args() 2026-01-08 15:33:37 +00:00
Mervin Praison 4dc19bed16 Add console.py to output module (was gitignored)
The output/ directory was in .gitignore, so console.py wasn't committed.
Force-adding it to fix the ModuleNotFoundError in CI.
2026-01-08 15:28:17 +00:00
Mervin Praison aeb93919b6 Fix async test infrastructure and CLI output module export
Core SDK fixes:
- Add local async test runner in conftest.py that works when pytest-asyncio is not installed
- Register 'asyncio' marker to remove PytestUnknownMarkWarning
- Add @requires_wrapper skip decorator for tests that depend on praisonai wrapper
- Add @requires_knowledge skip decorator for tests that need knowledge dependencies

Wrapper CLI fixes:
- Add missing set_output_controller export to cli/output/__init__.py
- Update test_doctor_cli.py to test actual CLI subcommands instead of non-existent options

Result: Core SDK unit tests pass (1181 passed, 21 skipped), wrapper integration tests pass (17 passed)
2026-01-08 15:07:35 +00:00
Mervin Praison 0dfab2b8d9 Release v3.4.1 2026-01-08 14:36:54 +00:00
Mervin Praison be1e4b3424 Release v3.4.0 2026-01-08 13:29:57 +00:00
Mervin Praison 304952e84d Remove unused test and verification files 2026-01-08 12:50:16 +00:00
Mervin Praison 911b0ef941 Release v3.3.1 2026-01-08 12:28:06 +00:00
Mervin Praison 496e97ecb5 Release v3.3.0 2026-01-08 10:33:27 +00:00
Mervin Praison 96d55eb062 Release v3.2.1 2026-01-07 21:57:34 +00:00
Mervin Praison 0ea9b7aae5 Release v3.2.0 2026-01-07 19:44:05 +00:00
Mervin Praison 89ae110284 Release v3.1.9 2026-01-07 17:41:47 +00:00
Mervin Praison 6a3b5d2659 Release v3.1.8 2026-01-07 15:06:12 +00:00
Mervin Praison 63ddb0eb63 Release v3.1.7 2026-01-07 11:50:38 +00:00
Mervin Praison f39b1df91a Release v3.1.6 2026-01-07 10:26:35 +00:00
Mervin Praison bcf92d24d0 Release v3.1.5 2026-01-07 07:48:57 +00:00
Mervin Praison 96f76f10ae Release v3.1.4 2026-01-07 07:11:58 +00:00
Mervin Praison 418939ec40 Release v3.1.3 2026-01-02 09:48:09 +00:00
Mervin Praison 30d95297b2 Release v3.1.2 2026-01-02 08:17:39 +00:00
Mervin Praison a945014bb5 Release v3.1.1 2026-01-02 07:54:02 +00:00
Mervin Praison 844f918fc5 Release v3.1.0 2026-01-02 07:35:57 +00:00
Mervin Praison 32bd6e78f5 Release v3.0.9 2026-01-02 07:22:27 +00:00
Mervin Praison 21dad0f233 Release v3.0.8 2026-01-02 06:59:48 +00:00
Mervin Praison 2efcf6e75d Release v3.0.7 2026-01-02 06:43:56 +00:00
Mervin Praison bb67223e25 Release v3.0.6 2026-01-02 06:18:14 +00:00
Mervin Praison 64b47a2388 Release v3.0.5 2026-01-02 06:06:01 +00:00
Mervin Praison 92f93323c4 Release v3.0.4 2026-01-02 05:45:18 +00:00
Mervin Praison 7f791345fa Release v3.0.3 2026-01-02 05:17:33 +00:00
Mervin Praison 221e2657db Release v3.0.2 2026-01-02 04:33:19 +00:00
Mervin Praison 50609853ba feat(tui): queue editing + update_input method
## Queue Editing
- Added update_input method to QueueScheduler for editing queued runs
- Added update_input method to QueueManager
- Added handler for QueuePanelWidget.EditRequested in TUIApp
- Only queued (not running) items can be edited

## Queue-First Architecture Support
- Queue items can be edited before processing
- EditRequested message already existed in QueuePanelWidget

31 tests passing
2026-01-02 04:24:10 +00:00
Mervin Praison 2ac3ef9156 feat(tui): session history persistence with SessionStore
## Session History Implementation
- Created SessionStore class for in-memory chat history persistence
- Added chat_history field to QueuedRun model
- Modified queue worker to inject chat_history into Agent
- Updated TUIApp to store user/assistant messages in SessionStore
- Pass chat_history to queue when submitting messages

## How It Works
1. User sends message -> stored in SessionStore
2. Queue submission includes chat_history from SessionStore
3. Worker injects chat_history into Agent.chat_history
4. Agent has full conversation context
5. Response stored back in SessionStore

## Verified
- Agent remembers previous messages in session
- History format correct for LLM (role + content)
- 31 tests passing
2026-01-02 04:22:26 +00:00
Mervin Praison f9f6f59e08 fix(tui): sessions screen loading + update_sessions_screen method
- Call _update_sessions_screen() after pushing sessions screen
- Add _update_sessions_screen() method to load sessions from persistence
- Fallback to showing current session if persistence fails

31 tests passing
2026-01-02 04:02:55 +00:00
Mervin Praison 6a96a17fdf fix(tui): compose() NoneType error + add missing slash commands
## Fixes
1. ChatWidget.compose() now yields empty generator instead of None
2. Added 7 missing slash commands: /tokens, /plan, /map, /undo, /diff, /commit, /tools

## Commands Added
- /tokens - Show token usage breakdown
- /plan - Show/create task plans
- /map - Show repository map
- /undo - Undo last change
- /diff - Show diff of changes
- /commit - Commit changes
- /tools - Show available tools

31 tests passing
2026-01-02 04:01:25 +00:00
Mervin Praison 5b3917103e fix(tui): proper scrollbar + non-blocking input
## Scrollbar Fix (VerticalScroll)
- ChatWidget now inherits from VerticalScroll (not ScrollableContainer)
- Messages mount directly to container (removed inner Vertical)
- scroll_end() called after adding messages and during streaming
- CSS has overflow-y: auto for proper scrollbar display

## Non-Blocking Input (@work decorator)
- Message submission uses run_worker() for background execution
- _process_message_submission decorated with @work
- User can type while agent is processing
- Multiple messages can be queued

## Root Causes Fixed
1. Inner Vertical container had overflow:hidden - removed it
2. Message handler was async blocking - now uses worker pattern

Based on Textual documentation:
- VerticalScroll: container with vertical layout and auto Y scrollbar
- @work decorator: runs coroutine in background without blocking UI

31 tests passing
2026-01-02 03:56:56 +00:00
Mervin Praison 05c2627318 fix(tui): add scrollbar to chat + fix session history
## Scrollbar Fix
- ChatWidget now inherits from ScrollableContainer
- Scrollbar visible in chat area (like queue panel)

## Session History Fix
- Pass session_id from TUI app to queue submit
- Pass session_id in agent_config
- Worker now passes session_id to Agent constructor
- Agent will now use session history for context

Flow: TUI.session_id → queue.submit() → worker → Agent(session_id=...)

31 tests passing
2026-01-02 03:44:55 +00:00
Mervin Praison 785756abd1 feat(tui): NEWEST-AT-TOP rendering + fix @ typing blockage
## UX STRATEGY CHANGE (Stabilization)

### Newest-at-Top Rendering
- Messages now render NEWEST at TOP
- No scroll dependency - latest always visible
- Streaming updates visible immediately
- ChatWidget inherits from Vertical (not ScrollableContainer)

### @ Typing Not Blocked
- @ handler no longer mounts focus-stealing popup
- Users can freely type @path/to/file
- Manual path entry works without interruption

### Verified Working
- ✅ New messages appear at TOP
- ✅ Latest response always visible
- ✅ Streaming updates visible
- ✅ Can type while agent runs
- ✅ Queue increments immediately
- ✅ Backslash popup works
- ✅ @ does NOT block typing
- ✅ 31 tests passing
2026-01-02 03:38:13 +00:00
Mervin Praison f8d6ef4344 docs(tui): update help screen with auto-trigger features
- Document @ auto-show file browser
- Document / auto-show command discovery
- Update backslash description to 'auto-show'
2026-01-02 03:25:17 +00:00
Mervin Praison 94636251cd feat(tui): auto-trigger popups for backslash, @, and / commands
## Auto-Trigger Features (Claude Code-style UX)

### Backslash (\) Auto-Popup
- Typing \ immediately shows command popup
- Clears backslash from input
- No manual trigger needed

### @ File Autocomplete
- Typing @ shows file/directory popup
- Fuzzy search files in workspace
- Supports ~/ and absolute paths
- Reuses FileSearchService from at_mentions.py

### / Command Discovery
- Typing / shows command popup with filter
- Same unified command registry as backslash

## Queue Live Updates
- Queue panel updates IMMEDIATELY when message queued
- Updates on run completion and error
- Reactive queued_count and running_count

## Composer Never Disabled
- Input stays enabled during agent processing
- Users can queue multiple messages

## New Files
- widgets/file_popup.py: FilePopupWidget for @ autocomplete

## Tests
- 31 tests passing (10 new tests)
- TestAutoTriggerEvents: 4 tests
- TestFilePopup: 4 tests
- TestQueueLiveUpdates: 2 tests
2026-01-02 03:24:39 +00:00
Mervin Praison f0f3d22d79 docs(tui): update help screen with safe keyboard defaults and backslash commands
## Help Screen Updates
- Document backslash (\) command popup
- Show safe keyboard defaults (no Ctrl/Fn by default)
- Add command mode (: prefix) section
- Add slash commands (/ prefix) section
- Document optional Ctrl/Fn key env vars

## Keyboard Shortcuts Documented
- \ - Show command popup
- Enter - Send message
- Shift+Enter - New line
- q - Quit (when not typing)
- ? - Help
- : - Command mode
- / - Search mode
- Escape - Cancel/Close
2026-01-02 03:07:50 +00:00
Mervin Praison b6e73aaaf6 feat(tui): add backslash command popup for Claude Code-style UX
## New Features

### Command Popup Widget (command_popup.py)
- CommandPopupWidget: Overlay showing all available commands
- Triggered by backslash (\) key - matches Claude Code UX
- Searchable/filterable command list
- Keyboard navigation (arrows, Enter, Escape)
- 16 default commands with aliases

### MainScreen Integration
- Backslash binding shows command popup
- Escape dismisses popup or cancels input
- Command selection executes command
- Popup layer CSS for proper overlay positioning

## Commands Available
- help, clear, model, cost, tokens, queue
- cancel, settings, sessions, tools, exit
- plan, undo, diff, commit, map

## Tests
- 21 tests passing
- TestCommandPopup: 4 new tests
- TestMainScreenBackslash: 3 new tests

## Files Changed
- NEW: widgets/command_popup.py
- screens/main.py: Add popup integration
- tests/unit/tui/test_tui_widgets.py: Add tests
2026-01-02 03:06:44 +00:00
Mervin Praison 20a82bd597 feat(tui): command mode routing and safe keyboard defaults
## Changes

### Command System (: and / prefix)
- Both : and / now work as command prefixes
- Local command handling in MainScreen._handle_local_command()
- Commands: :quit, :clear, :help, :tools, :queue, :settings, :cancel
- Aliases work: :q, :cl, :h, :t, :qu

### Keyboard Defaults
- TUIApp bindings now hidden in footer (show=False)
- Ctrl+Q/C kept for emergency exit but not displayed
- MainScreen shows safe defaults: q, :, ?, Esc

### Help Text Updated
- Shows safe keyboard shortcuts
- Documents command mode usage
- Removed references to Ctrl/Fn keys

## Files Changed
- app.py: Hide Ctrl bindings in footer, update help text
- screens/main.py: Add _handle_local_command() for : commands
- widgets/composer.py: Support both / and : as command prefixes

## Tests
- 14 tests passing
- Command parsing verified
- TUI app startup verified
2026-01-02 02:48:50 +00:00
Mervin Praison 261cc5fd32 feat(tui): comprehensive UX fixes - safe keyboard defaults, auto-scroll, tools panel
BREAKING CHANGE: Keyboard shortcuts changed to safe defaults

## Changes

### 1. Auto-scroll Fix
- Use call_after_refresh() to ensure scroll happens after DOM updates
- Fixed in ChatWidget.add_message() and update_streaming()

### 2. Tools Panel Fix
- Added ScrollableContainer for tools list (no more truncation)
- Shows count of available tools
- All 13 tools now visible with scrolling

### 3. Safe Keyboard Defaults (NO Ctrl/Fn keys by default)
- Single-char shortcuts: q (quit), : (command mode), ? (help)
- Command mode: :quit, :clear, :help, :tools, :queue, :settings
- Ctrl keys (^Q, ^C, ^L) - DISABLED by default (opt-in)
- Function keys (F1-F5) - DISABLED by default (opt-in)

### 4. Configuration System
- New TUIConfig class in config.py
- Environment variables:
  - PRAISONAI_TUI_CTRL_KEYS=1 (enable Ctrl keys)
  - PRAISONAI_TUI_FN_KEYS=1 (enable Fn keys)
  - PRAISONAI_TUI_LEADER=; (custom leader key)

### 5. Non-blocking Input
- Queue accepts messages while agents are running
- Already implemented in previous commit

## Files Changed
- widgets/chat.py - Auto-scroll fix
- widgets/tool_panel.py - ScrollableContainer, show all tools
- widgets/composer.py - set_text() method for command mode
- screens/main.py - Safe default bindings, command mode actions
- config.py - NEW: TUIConfig, command parsing, help text

## Tests
- 14 tests passing
- New tests for TUIConfig and safe bindings
2026-01-02 02:39:16 +00:00
Mervin Praison 2cdb1846f2 feat(tui): fix help screen, Enter key, and add TDD tests
Fixes:
- Add HelpScreen for F1 key (was missing, caused KeyError)
- Fix Enter key to send message using custom SubmitTextArea class
- Fix Shift+Enter to insert newline properly
- Register HelpScreen in TUIApp.SCREENS

Tests:
- Add TDD test suite for TUI widgets (12 tests)
- Test Enter key submission
- Test Shift+Enter newline
- Test F1 help screen
- Test Ctrl key bindings

All 13 default tools (ACP, LSP, Basic) load correctly.
Queue system tested and working with real API keys.
2026-01-02 02:23:02 +00:00
Mervin Praison 3cf7919bba feat(tui): improve TUI usability and add tools panel display
- Enter key now sends message (was Ctrl+Enter)
- Shift+Enter inserts newline without backslash
- Allow typing while response is generating (queue multiple messages)
- Display available tools in Tools panel
- Add edit/delete functionality to queue panel
- Auto-scroll already working in chat widget

TUI Architecture:
- TUIApp -> QueueManager -> WorkerPool -> Agent (from praisonaiagents)
- Tools stored in runtime registry to avoid JSON serialization issues
2026-01-02 02:08:22 +00:00
Mervin Praison be82da65bb fix: use 'llm' parameter instead of 'model' for Agent initialization in queue worker
- Agent class uses 'llm' parameter, not 'model'
- This fixes 'unexpected keyword argument model' error in TUI mode
2026-01-01 19:57:31 +00:00
Mervin Praison 21ae15b6e0 Release v3.0.1 2025-12-31 19:29:02 +00:00
Mervin Praison 738542086e Release v3.0.0 2025-12-31 18:55:59 +00:00
Mervin Praison 6afe96aa48 Release v2.9.2 2025-12-31 17:17:17 +00:00
Mervin Praison bc6801b799 Release v2.9.1 2025-12-31 16:42:54 +00:00
Mervin Praison 38f8733ad7 Release v2.9.0 2025-12-31 15:49:07 +00:00
Mervin Praison 16063130ef Release v2.8.9 2025-12-31 14:05:30 +00:00
Mervin Praison b6cc7234a5 Release v2.8.8 2025-12-31 12:46:10 +00:00
Mervin Praison 2258268f6f Release v2.8.7 2025-12-31 12:28:44 +00:00
Mervin Praison d946bf5ef9 Release v2.8.6 2025-12-31 12:27:20 +00:00
Mervin Praison a6eb5c5bbf Release v2.8.5 2025-12-31 12:00:29 +00:00
Mervin Praison 27f3cdd84f Release v2.8.4 2025-12-31 11:39:37 +00:00
Mervin Praison d8e958f2d2 Release v2.8.3 2025-12-31 11:02:57 +00:00
Mervin Praison 2bad9a508b feat: bump version to 1.4.0 and add AI SDK integration dependencies
- Update package.json version from 1.3.6 to 1.4.0
- Update FEATURE_PARITY_TRACKER.json to v1.3.0 (Phase 5 Complete)
- Add AI SDK wrapper features: generateText, streamText, generateObject, streamObject, generateImage, embed, embedMany
- Add server adapters for http, express, hono, fastify, nest
- Add Next.js integration with createRouteHandler and createPagesHandler
- Add MCP client tools: createMCP, getMCPClient, mcpToolsToAITools
2025-12-31 01:39:39 +00:00
Mervin Praison 3598f05d45 Release v2.8.2 2025-12-30 23:17:48 +00:00
Mervin Praison a645f15b2d Release v2.8.1 2025-12-30 17:47:16 +00:00
Mervin Praison f901cf963d chore: remove completed AI SDK verification doc and bump version to 1.3.6
- Remove ai-sdk-backbone-verification.md (all tasks completed)
- Update package.json version from 1.3.5 to 1.3.6
- Refactor agent classes to use lazy-loaded AI SDK backend via resolveBackend()
- Convert direct createProvider() calls to async getProvider() pattern
- Add provider promise caching to prevent duplicate backend initialization
- Update ContextAgent, EnhancedAgent, ImageAgent, and PromptExpanderAgent classes
2025-12-30 17:15:40 +00:00
Mervin Praison 0150468abc feat: add AI SDK backend support and embedding capabilities to Agent class
- Add AI SDK backend resolution with lazy initialization via getBackend()
- Add embed() method supporting single/batch text embeddings
- Add getBackendSource() to check backend type (ai-sdk/native/custom/legacy)
- Add getModel() to retrieve agent's model string
- Parse model string to extract provider/model ID for backend selection
- Use AI SDK backend for non-OpenAI providers (streaming and non-streaming)
- Export backend resolver an
2025-12-30 16:52:46 +00:00
Mervin Praison 3131c1078f Merge remote-tracking branch 'origin/pr-1097-fixes' 2025-12-30 16:15:49 +00:00
Mervin Praison ef667c545b test: add comprehensive ImportError tests for MCP optional import
- Add test for MCP class ImportError when mcp package unavailable
- Add test for SSEMCPClient ImportError when mcp unavailable
- Add test for HTTPStreamMCPClient ImportError when mcp unavailable
- Add test for HTTPStreamMCPClient ImportError when aiohttp unavailable
- Fix unused import lint warnings (remove sys, add noqa for MCP)

These tests verify that actionable error messages with install instructions
are shown when users try to use MCP functionality without the mcp package.
2025-12-30 16:14:15 +00:00
Mervin Praison fff67a96de feat: improve rate limiting with retry wrappers and uncapped token wait times
- Add _completion_with_retry() and _acompletion_with_retry() convenience wrappers
- Remove max_retry_delay cap from internal token wait times to ensure correct rate limiting
- Add max_delay cap (300s default) to _parse_retry_delay() to prevent unbounded sleep from API errors
- Improve retry delay regex patterns (non-greedy matching, HTTP Retry-After header)
- Add documentation notes about large token requests exceeding burst capacity
2025-12-30 16:10:24 +00:00
Mervin Praison f56098f40f Merge pull request #1096 from majiayu000/fix/issue-1091-mcp-optional-import
fix: make MCP package import optional to prevent errors when not installed
2025-12-30 16:09:06 +00:00
Mervin Praison b52708f3f6 Release v1.3.4 2025-12-30 15:10:46 +00:00
Mervin Praison ba37ce39d3 Release v2.8.0 2025-12-30 15:08:22 +00:00
majiayu000 519ad56e2b feat: add tokens_per_minute rate limiting and 429 error auto-retry
- Enhance RateLimiter class to support tokens_per_minute limiting
- Add acquire_tokens() method for token-based rate limiting
- Add wait_for_retry() methods for handling rate limit delays
- Add _call_with_retry() methods in LLM class for auto-retry on 429 errors
- Parse retry delay from API error responses (e.g., "retryDelay: 58s")
- Add rate_limiter, max_retries, retry_delay settings to LLM class

Closes #1086

Signed-off-by: majiayu000 <[email protected]>
2025-12-30 20:00:05 +08:00
majiayu000 98c5e8f175 fix: make MCP package import optional to prevent errors when not installed
Wrap mcp imports in try/except blocks in mcp.py, mcp_sse.py, and
mcp_http_stream.py. Add MCP_AVAILABLE flag to check availability at runtime.
When MCP class is instantiated without the mcp package installed, raise a
clear ImportError with installation instructions.

Closes #1091

Signed-off-by: majiayu000 <[email protected]>
2025-12-30 19:53:45 +08:00
Mervin Praison bf3fdd10f1 Release v2.7.9 2025-12-30 11:15:36 +00:00
Mervin Praison 4fdc51c6ed Add provider registry system with custom provider support
Implements extensible provider registry allowing users to register custom providers (e.g., Cloudflare, Ollama) alongside built-in providers. Updates `providers` CLI command to show registered/builtin/custom providers with `list` and `info` subcommands. Enhances `createProvider()` to accept provider instances, spec objects, or strings. Updates `hasApiKey()` to support provider aliases and custom env vars. Exports registry functions (`register
2025-12-30 11:04:31 +00:00
Mervin Praison ce5026fd30 Release v2.7.8 2025-12-30 08:49:10 +00:00
Mervin Praison 4428e98a16 Remove temporary debug workflow - tests now passing 2025-12-30 08:01:05 +00:00
Mervin Praison b934cc61ba Make unit tests continue on error to allow workflow completion 2025-12-30 07:44:10 +00:00
Mervin Praison 3bd2903877 Simplify debug workflow to show only failed tests 2025-12-30 07:28:35 +00:00
Mervin Praison 985a612273 Release v2.7.7 2025-12-30 07:28:15 +00:00
Mervin Praison 9b4cc1d472 Fix: Add async cleanup fixtures to suppress aiohttp unclosed session warnings 2025-12-30 07:12:24 +00:00
Mervin Praison ad5377900b Split test run and output display for better visibility 2025-12-30 07:06:12 +00:00
Mervin Praison a0f2d9d11a Fix debug workflow to properly capture pytest exit code with PIPESTATUS 2025-12-30 06:59:59 +00:00
Mervin Praison 7428bed13f Simplify debug workflow to show full test output 2025-12-30 06:54:04 +00:00
Mervin Praison fbc191c2a2 Update debug workflow to show detailed failure info 2025-12-30 06:47:55 +00:00
Mervin Praison 8a474d680d Fix debug workflow to properly show test failures 2025-12-30 06:41:50 +00:00
Mervin Praison eb120376f7 Update debug workflow to capture full test output with artifact 2025-12-30 06:35:52 +00:00
Mervin Praison d376d88d74 Update debug workflow to capture all test failures 2025-12-30 06:29:42 +00:00
Mervin Praison f0c31ba8ec Add quick debug workflow to identify failing tests 2025-12-30 06:23:46 +00:00
Mervin Praison 439bf42eec Fix: Add pytest_plugins for pytest-asyncio support in conftest.py 2025-12-29 20:50:17 +00:00
Mervin Praison fcaeba6894 Fix: Add sse-starlette dependency and fix JobExecutor event loop issue 2025-12-29 20:43:50 +00:00
Mervin Praison 8a4c2c2c43 Release v2.7.6 2025-12-29 17:28:44 +00:00
Mervin Praison 0b2e6ff69b examples 2025-12-29 16:25:23 +00:00
Mervin Praison 1050d66970 Release v2.7.5 2025-12-29 14:31:52 +00:00
Mervin Praison bf483f3bd6 Release v2.7.4 2025-12-29 13:01:04 +00:00
Mervin Praison 00ee8eb2f3 Release v2.7.3 2025-12-29 12:19:58 +00:00
Mervin Praison 9a5a432d96 Release v2.7.2 2025-12-29 11:40:55 +00:00
Mervin Praison 8cb5bbb605 Release v2.7.2 - update doctor examples with improved check listing and CI formatting
- Add doctor examples to main README with documentation link
- Sort checks by category in list_available_checks()
- Update registry method call from list_checks() to get_all_checks()
- Remove unused results variable in run_environment_checks()
- Fix f-string formatting in CI integration print statement
2025-12-29 02:19:16 +00:00
Mervin Praison 952514d73c Release v2.7.1 2025-12-29 02:15:51 +00:00
Mervin Praison 6e1dc34864 Release v2.7.0 2025-12-29 01:33:40 +00:00
Mervin Praison 820d5c2995 Release v2.6.8 2025-12-29 00:42:47 +00:00
Mervin Praison 0b1b3d3b3e Release v2.6.7 2025-12-29 00:22:52 +00:00
Mervin Praison 59107addc3 Release v2.6.6 2025-12-28 23:51:03 +00:00
Mervin Praison b460ded5e0 Release v2.6.5 2025-12-28 23:02:27 +00:00
Mervin Praison a8967ed200 Release v1.3.1 - add Router class with simplified keyword/pattern-based routing and agent session management
- Bump praisonai-ts version from 1.3.0 to 1.3.1
- Add Router class with simplified keyword/pattern-based routing API (5-line usage)
- Export Router, RouterAgent, createRouter, routeConditions from agent module
- Add SimpleRouterConfig and SimpleRouteConfig types for simplified configuration
- Support both Agent and EnhancedAgent types in router (AnyAgent union type)
- Add Router.chat() method for direct routing
2025-12-28 22:53:04 +00:00
Mervin Praison 9189f42470 Release v2.6.4 2025-12-28 21:47:32 +00:00
Mervin Praison c86f660f66 Release v2.6.3 2025-12-28 07:31:42 +00:00
Mervin Praison a2d181dd74 Release v2.6.2 2025-12-27 07:58:18 +00:00
Mervin Praison 7411fdbb52 Release v2.6.1 2025-12-26 19:41:45 +00:00
Mervin Praison e7a8ce8eb7 Release v2.6.0 2025-12-26 19:31:15 +00:00
Mervin Praison 61fb094306 Release v1.2.3 - add comprehensive CLI feature exports and command definitions
- Bump praisonai-ts version from 1.2.2 to 1.2.3
- Add 18 new command definitions to CLI spec: query-rewrite, prompt-expand, router, context, handoff, vector, observability, voice, reranker, graph-rag, cache, db, scheduler, jobs, checkpoints, fast-context, autonomy, sandbox, repo-map, git, n8n, external-agents, flow, cost, interactive
- Export FileMemory and AutoMemory classes with factory functions and types from memory module
- Export
2025-12-26 18:41:37 +00:00
Mervin Praison 018e8c78ab refactor(ts): update CLI to v1.0.0 spec and change default model to gpt-4o-mini
- Change default agent model from gpt-5-nano to gpt-4o-mini in simple.ts
- Refactor CLI to implement CLI Spec v1.0.0 with lazy command loading
- Add parseArgs() function for spec-compliant argument parsing
- Add executeCommand() for dynamic command module loading
- Add comprehensive command definitions: memory, session, knowledge, skills, mcp, auto, image, research, guardrail, telemetry, planning
- Export CLI_SPEC_VERSION,
2025-12-26 14:07:05 +00:00
Mervin Praison f0f0f653fe Release v2.5.7 2025-12-26 13:31:45 +00:00
Mervin Praison 98a4ff8450 Release v2.5.6 2025-12-26 13:11:09 +00:00
Mervin Praison d6333aaf33 Release v1.2.1 - refactor TypeScript tools to use generic BaseTool
- Bump praisonai-ts version from 1.2.0 to 1.2.1
- Refactor BaseTool to use generics for type-safe input/output parameters
- Update ArxivSearchTool and ArxivDownloadTool to extend generic BaseTool with typed params
- Update MCPTool to extend generic BaseTool
- Change tool method from execute() to run() for consistency
- Export ToolResult, ToolValidationError, validateTool, createTool from base module
- Remove Tool interface export
2025-12-26 11:47:17 +00:00
Mervin Praison 8005094267 update 2025-12-26 08:39:22 +00:00
Mervin Praison 08b21dabe3 Release v2.5.5 2025-12-26 08:16:54 +00:00
Mervin Praison 8c70d840df docs: add knowledge export/import CLI commands to README
- Add knowledge export/import row to features table with CLI link
- Document `praisonai knowledge export <file.json>` command
- Document `praisonai knowledge import <file.json>` command
2025-12-26 06:53:20 +00:00
Mervin Praison d8e944c1d3 Release v2.5.4 2025-12-26 06:49:33 +00:00
Mervin Praison 79b2b88f72 Release v2.5.3 2025-12-26 05:54:09 +00:00
Mervin Praison f5dfbd5670 fix: resolve Core Tests failures in knowledge/reranker integration
- Fix #1: MemoryConfig Pydantic validation - add _prepare_mem0_config() to strip
  PraisonAI-specific reranker fields (enabled, default_rerank) before passing to
  mem0, which only accepts provider and config fields

- Fix #2: LLM Reranker 'Chat' object not callable - check if client.chat is
  callable, not just if it exists. OpenAI client has chat as namespace object.
  Also handle max_completion_tokens vs max_tokens for different model versions.

- Fix #3: Chroma vector store metadata validation - ensure non-empty metadata
  dicts by adding placeholder key when metadata is empty or None

- Fix test file issues: add user_id parameter (required by mem0 API), handle
  dict return type from knowledge.search, use gpt-4o-mini for reranker test
  (gpt-5-nano returns empty responses with max_completion_tokens=10)
2025-12-26 05:52:46 +00:00
Mervin Praison aa6aa5933d fix: update test files to use gpt-5-nano for cheaper CI runs
- Update test_workflow_patterns.py to use gpt-5-nano instead of gpt-4o/gpt-4o-mini
- Also set OPENAI_MODEL_NAME=gpt-5-nano as CI secret
2025-12-26 05:26:40 +00:00
Mervin Praison ff3a4f2016 Release v2.5.2 2025-12-26 05:25:08 +00:00
Mervin Praison 0d5444fc23 fix: add missing praisonai.db module to git
- Add praisonai/db/ module that was being ignored by *.db pattern
- This fixes ModuleNotFoundError: No module named 'praisonai.db' in CI tests
2025-12-26 04:54:05 +00:00
Mervin Praison d7d5dab17b fix: add missing db module to git and update .gitignore
- Add praisonaiagents/db/ module that was being ignored by *.db pattern
- Add exception in .gitignore for the db module directory
- This fixes ModuleNotFoundError: No module named 'praisonaiagents.db' in CI
2025-12-26 04:49:31 +00:00
Mervin Praison 05678394e6 fix: remove sys.exit() at module level in test files causing pytest INTERNALERROR
- test_mini_agents_fix.py: Convert module-level sys.exit(1) to pytest.mark.skipif pattern
- test_xai_fix.py: Convert to proper pytest test function with cleanup

These sys.exit() calls at module level caused pytest to crash during test collection
with INTERNALERROR, breaking all CI pipelines.
2025-12-26 04:46:58 +00:00
Mervin Praison 54cddc09b4 Release v2.5.1 2025-12-26 04:23:51 +00:00
Mervin Praison 9cbab01785 Release v2.5.0 2025-12-26 02:20:59 +00:00
Mervin Praison de9d4bd3c6 Release v2.4.4 2025-12-26 01:21:26 +00:00
Mervin Praison aba2265e5e Release v2.4.3 2025-12-26 01:01:30 +00:00
Mervin Praison ebb9b24bff Release v2.4.2 2025-12-25 00:29:49 +00:00
Mervin Praison 759ef2c655 Update database initialization to use db() shortcut and expand tools table with 100+ tools 2025-12-25 00:24:48 +00:00
Mervin Praison cb4318f6e8 Release v2.4.1 2025-12-24 15:00:45 +00:00
Mervin Praison d9bb869d5e Add documentation for 6 new features: Shadow Git Checkpoints, Background Tasks, Policy Engine, Thinking Budgets, Output Styles, and Context Compaction 2025-12-24 08:02:48 +00:00
Mervin Praison 34b6aeb76b Release v2.4.0 2025-12-24 07:47:53 +00:00
Mervin Praison 078b7801e1 Add 'response' field to workflow API for consistency with single-agent endpoint 2025-12-23 17:50:07 +00:00
Mervin Praison a970e849b4 Release v2.3.87 2025-12-23 16:08:35 +00:00
Mervin Praison 8e68f4e71c Release v2.3.86 2025-12-23 15:23:31 +00:00
Mervin Praison 308758cdc2 Release v2.3.85 2025-12-23 15:07:46 +00:00
Mervin Praison f8fa61b082 Release v2.3.84 2025-12-23 14:57:15 +00:00
Mervin Praison 955d236924 Release v2.3.84 2025-12-23 13:20:08 +00:00
Mervin Praison d9d63c3a13 Release v2.3.83 2025-12-23 13:06:42 +00:00
Mervin Praison 5bee6eb470 Release v2.3.83 2025-12-23 11:42:47 +00:00
Mervin Praison 7cb1676b7c Release v2.3.82 2025-12-23 09:41:09 +00:00
Mervin Praison e2e9c3f9ee Release v2.3.81 2025-12-23 08:11:31 +00:00
Mervin Praison cbe8beeca6 Release v2.3.80 2025-12-23 07:54:07 +00:00
Mervin Praison f7b66a52b7 Release v2.3.79 2025-12-23 07:27:35 +00:00
Mervin Praison 6dbf194312 Release v2.3.78 2025-12-23 06:46:15 +00:00
Mervin Praison 335e8d7e47 Release v2.3.77 2025-12-23 06:28:26 +00:00
Mervin Praison d65840e092 Release v2.3.76 2025-12-23 05:40:52 +00:00
Mervin Praison 5a13571fdd Release v2.3.75 2025-12-22 19:11:32 +00:00
Mervin Praison e3b48c2526 Release v2.3.74 2025-12-22 17:01:50 +00:00
Mervin Praison 8d32238b4c Release v2.3.73 2025-12-22 15:47:51 +00:00
Mervin Praison c17b1298bb Reorganize README feature table with improved categorization and hierarchy 2025-12-22 14:50:37 +00:00
Mervin Praison ec6c150315 Release v2.3.72 2025-12-22 13:44:48 +00:00
Mervin Praison 3d26cedd5d Release v2.3.71 2025-12-22 11:59:12 +00:00
Mervin Praison 8c735a60b2 Release v2.3.70 2025-12-22 10:43:48 +00:00
Mervin Praison 2f5f2f1c13 Release v2.3.69 2025-12-22 10:40:53 +00:00
Mervin Praison 0253073c68 Release v2.3.68 2025-12-22 10:35:45 +00:00
Mervin Praison 7f0e334e8c Release v2.3.67 2025-12-22 09:14:33 +00:00
Mervin Praison cacf1097ef Release v2.3.66 2025-12-22 08:50:02 +00:00
Mervin Praison 09f01919d2 Fix duplicate --max-retries argument conflict in CLI parser 2025-12-21 05:19:08 +00:00
Mervin Praison 92397615f8 Release v2.3.65 2025-12-20 21:49:04 +00:00
Mervin Praison 4b21943a53 Release v2.3.64 2025-12-20 19:57:39 +00:00
3171 changed files with 625583 additions and 24621 deletions

No files matched your search

@@ -5,6 +5,9 @@ inputs:
anthropic_api_key:
description: "Anthropic API key"
required: false
claude_code_oauth_token:
description: "Claude Code OAuth Token for Claude Pro"
required: false
github_token:
description: "GitHub token for Claude to operate with"
required: false
@@ -212,6 +215,13 @@ runs:
- Documentation updates
- Testing and deployment
CRITICAL INSTRUCTION: If your task involves modifying codebase files to add a feature or fix a bug:
1. ALWAYS create a new git branch appropriately named (e.g. \`feature/issue-<number>\`).
2. MANDATORY: Before writing any code, you MUST carefully read "src/praisonai-agents/AGENTS.md" to understand this repository's extremely specific Architecture, Protocol-First design rules, and Agent-Centric Philosophy.
3. Make your necessary code changes honoring the rules in AGENTS.md.
4. Commit your changes and push the branch to the remote repository.
5. Use the GitHub CLI (\`gh pr create --title "..." --body "Fixes #<number>"\`) to open a Pull Request containing your work.
Respond naturally and helpfully to the user's request using the available tools.
EOF
@@ -253,4 +263,5 @@ runs:
echo "✅ Claude Code execution completed"
env:
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
GITHUB_TOKEN: ${{ inputs.github_token }}
@@ -6,8 +6,8 @@ inputs:
description: "Timeout in minutes for execution"
required: false
default: "5"
anthropic_api_key:
description: "Anthropic API key"
claude_code_oauth_token:
description: "Claude Code OAuth token for Pro subscription access"
required: true
github_token:
description: "GitHub token with repo and issues permissions"
@@ -21,7 +21,8 @@ runs:
with:
fetch-depth: 0
- name: Create prompt file
- name: Create prompt
id: generate_prompt
shell: bash
run: |
mkdir -p /tmp/claude-prompts
@@ -75,13 +76,16 @@ runs:
- Your ONLY action should be to apply labels using mcp__github__update_issue
- It's okay to not add any labels if none are clearly applicable
EOF
echo "PROMPT<<DELIMITER" >> $GITHUB_OUTPUT
cat /tmp/claude-prompts/claude-issue-triage-prompt.txt >> $GITHUB_OUTPUT
echo "DELIMITER" >> $GITHUB_OUTPUT
- name: Run Claude Code
uses: ./.github/actions/claude-code-action
with:
prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt
direct_prompt: ${{ steps.generate_prompt.outputs.PROMPT }}
allowed_tools: "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"
install_github_mcp: "true"
timeout_minutes: ${{ inputs.timeout_minutes }}
anthropic_api_key: ${{ inputs.anthropic_api_key }}
claude_code_oauth_token: ${{ inputs.claude_code_oauth_token }}
github_token: ${{ inputs.github_token }}
+8 -1
View File
@@ -22,6 +22,12 @@ inputs:
To enable observability with Google Cloud, include:
{"telemetry": {"enabled": true, "target": "gcp"}, "sandbox": false}
required: false
model:
description: |
The Gemini model to use. Options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite.
Use flash-lite for highest free-tier quota (1,000 RPD).
required: false
default: 'gemini-3.1-flash-lite-preview'
version:
description: |
The version of @google/gemini-cli to execute.
@@ -70,10 +76,11 @@ runs:
- name: Run Gemini CLI
run: |
gemini --yolo --prompt "$PROMPT"
gemini --yolo --model "$GEMINI_MODEL" --prompt "$PROMPT"
shell: bash
env:
GEMINI_API_KEY: ${{ inputs.GEMINI_API_KEY }}
GEMINI_MODEL: ${{ inputs.model }}
PROMPT: ${{ inputs.prompt }}
branding:
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 429 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 872 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 168 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

+31 -11
View File
@@ -1,26 +1,46 @@
name: Auto Issue Comment with PR Creation
name: Auto Issue Comment
on:
issues:
types: [opened]
workflow_dispatch:
# issues:
# types: [opened]
jobs:
add-comment:
# Trigger Claude by adding the 'claude' label (only if not already labeled)
# Note: @claude in comments only works from human users (not bots)
# The claude.yml workflow listens for issues:labeled event with 'claude' label
trigger-claude:
# Skip if issue was already created with 'claude' label to avoid double-trigger
if: |
!contains(toJSON(github.event.issue.labels), 'claude')
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
pull-requests: write
actions: read
steps:
- name: Add automated comment
- name: Add claude label to trigger analysis
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
github.rest.issues.createComment({
// Check if 'claude' label already exists on this issue
const labels = context.payload.issue.labels.map(l => l.name);
if (labels.includes('claude')) {
console.log('Issue already has claude label, skipping');
return;
}
// Add label to trigger claude.yml via issues:labeled event
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@claude review this issue and do a detailed analysis and fix this if the existing code doesn\'t have the solution implemented. Making sure it has backward compatibility, no existing features removed. After making those changes, again review the applied changes. Use @web to search if you dont know any information or to find the latest documentation or to find the latest version. Run the code if you think you need to run it to test it. Minimal code change to start with if required any changes. MAINLY IT SHOULD NOT IMPACT ON THE CURRENT SPEED OF EXECUTION of existing features, not increasing the overhead. **Please create a PR using gh tool with your changes**.'
})
labels: ['claude']
});
// Also post instructions as a comment for context
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🤖 Auto-triaging with Claude. Analyzing issue and implementing a fix...\n\nClaude will:\n1. Classify this issue\n2. Search codebase for root cause\n3. Implement a minimal fix following AGENTS.md\n4. Create a PR with the changes'
});
+123 -4
View File
@@ -1,23 +1,142 @@
name: Auto PR Comment
# Review chain: CodeRabbit/Qodo/Gemini review first → THEN trigger Copilot
# For human PRs: CodeRabbit/Qodo auto-review → this workflow triggers Copilot
# For bot PRs: CodeRabbit/Qodo skip bots, so we trigger them explicitly first
#
# IMPORTANT: @copilot ignores bot comments. All @copilot mentions must use
# PAT_TOKEN so the comment posts as MervinPraison (a real user).
on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
pull_request:
types: [opened]
jobs:
add-comment:
# ================================================================
# HUMAN PRs: Trigger @copilot AFTER CodeRabbit posts its summary
# ================================================================
copilot-after-coderabbit:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
github.event.comment.user.login == 'coderabbitai[bot]' &&
contains(github.event.comment.body, 'summary by coderabbit')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add automated comment
- name: Post Copilot review request (as user via PAT)
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
// Check for duplicates — posted by MervinPraison (PAT) or github-actions[bot] (legacy)
const alreadyPosted = comments.data.some(c =>
c.body.includes('@copilot') &&
(c.user.login === 'MervinPraison' || c.user.login === 'github-actions[bot]')
);
if (alreadyPosted) {
console.log('Copilot already triggered, skipping');
return;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@claude review this pull request and do a detailed analysis and fix this if the existing code doesn\'t have the solution implemented. Making sure it has backward compatibility, no existing features removed. After making those changes, again review the applied changes. Use @web to search if you dont know any information or to find the latest documentation or to find the latest version. Run the code if you think you need to run it to test it. Minimal code change to start with if required any changes. MAINLY IT SHOULD NOT IMPACT ON THE CURRENT SPEED OF EXECUTION of existing features, not increasing the overhead.'
})
body: '@copilot Do a thorough review of this PR. Read ALL existing reviewer comments above from Qodo, Coderabbit, and Gemini first — incorporate their findings.\n\nReview areas:\n1. **Bloat check**: Are changes minimal and focused? Any unnecessary code or scope creep?\n2. **Security**: Any hardcoded secrets, unsafe eval/exec, missing input validation?\n3. **Performance**: Any module-level heavy imports? Hot-path regressions?\n4. **Tests**: Are tests included? Do they cover the changes adequately?\n5. **Backward compat**: Any public API changes without deprecation?\n6. **Code quality**: DRY violations, naming conventions, error handling?\n7. **Address reviewer feedback**: If Qodo, Coderabbit, or Gemini flagged valid issues, include them in your review\n8. Suggest specific improvements with code examples where possible'
})
# Fallback: Trigger @copilot after Qodo review (if Coderabbit doesn't fire)
copilot-after-qodo:
if: |
github.event_name == 'pull_request_review' &&
github.event.review.user.login == 'qodo-code-review[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Post Copilot review request (as user via PAT)
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
const alreadyPosted = comments.data.some(c =>
c.body.includes('@copilot') &&
(c.user.login === 'MervinPraison' || c.user.login === 'github-actions[bot]')
);
if (alreadyPosted) {
console.log('Copilot already triggered, skipping');
return;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@copilot Do a thorough review of this PR. Read ALL existing reviewer comments above first.\n\nReview areas:\n1. **Bloat check**: Are changes minimal and focused?\n2. **Security**: Any hardcoded secrets, unsafe eval/exec, missing input validation?\n3. **Performance**: Any module-level heavy imports? Hot-path regressions?\n4. **Tests**: Are tests included? Do they cover the changes adequately?\n5. **Backward compat**: Any public API changes without deprecation?\n6. **Code quality**: DRY violations, naming conventions, error handling?\n7. Suggest specific improvements with code examples where possible'
})
# ================================================================
# BOT PRs: CodeRabbit/Qodo skip bot-authored PRs by default.
# Trigger them explicitly. Do NOT trigger Copilot here — it will
# be triggered by copilot-after-coderabbit/qodo when they finish.
# ================================================================
bot-pr-trigger-reviews:
if: |
github.event_name == 'pull_request' &&
github.event.action == 'opened' &&
(
github.event.pull_request.user.login == 'github-actions[bot]' ||
github.event.pull_request.user.login == 'praisonai-triage-agent[bot]' ||
github.event.pull_request.user.type == 'Bot'
)
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Trigger CodeRabbit, Qodo, and Gemini reviews
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const pr = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
// 1. Trigger CodeRabbit review
await github.rest.issues.createComment({
issue_number: pr, owner, repo,
body: '@coderabbitai review'
});
console.log(`Triggered CodeRabbit for bot PR #${pr}`);
// 2. Trigger Qodo review
await github.rest.issues.createComment({
issue_number: pr, owner, repo,
body: '/review'
});
console.log(`Triggered Qodo for bot PR #${pr}`);
// 3. Trigger Gemini review
await github.rest.issues.createComment({
issue_number: pr, owner, repo,
body: '@gemini review this PR'
});
console.log(`Triggered Gemini for bot PR #${pr}`);
// NOTE: @copilot is NOT triggered here.
// It will be triggered by copilot-after-coderabbit or copilot-after-qodo
// once those bots finish, ensuring Copilot always reviews LAST.
console.log('Copilot will be triggered after CodeRabbit/Qodo complete.');
+145
View File
@@ -0,0 +1,145 @@
name: Performance Benchmarks
on:
workflow_dispatch:
inputs:
iterations:
description: 'Number of benchmark iterations'
required: false
default: '100'
fail_on_regression:
description: 'Fail if performance regresses'
required: false
default: 'true'
jobs:
benchmark:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e src/praisonai-agents[all]
pip install agno crewai langgraph
- name: Run Import Time Benchmark
id: import_time
run: |
cd src/praisonai-agents
python benchmarks/import_time.py 2>&1 | tee import_time_output.txt
# Extract import time
IMPORT_TIME=$(grep -oP 'Median:\s+\K[\d.]+' import_time_output.txt || echo "0")
echo "import_time=$IMPORT_TIME" >> $GITHUB_OUTPUT
# Check threshold (200ms)
if (( $(echo "$IMPORT_TIME > 200" | bc -l) )); then
echo "::warning::Import time ${IMPORT_TIME}ms exceeds 200ms threshold"
if [ "${{ inputs.fail_on_regression }}" == "true" ]; then
echo "import_passed=false" >> $GITHUB_OUTPUT
fi
else
echo "import_passed=true" >> $GITHUB_OUTPUT
fi
- name: Run Memory Usage Benchmark
id: memory
run: |
cd src/praisonai-agents
python benchmarks/memory_usage.py 2>&1 | tee memory_output.txt
# Extract peak memory
PEAK_MEMORY=$(grep -oP 'Peak:\s+\K[\d.]+' memory_output.txt || echo "0")
echo "peak_memory=$PEAK_MEMORY" >> $GITHUB_OUTPUT
# Check threshold (30MB)
if (( $(echo "$PEAK_MEMORY > 30" | bc -l) )); then
echo "::warning::Memory usage ${PEAK_MEMORY}MB exceeds 30MB threshold"
if [ "${{ inputs.fail_on_regression }}" == "true" ]; then
echo "memory_passed=false" >> $GITHUB_OUTPUT
fi
else
echo "memory_passed=true" >> $GITHUB_OUTPUT
fi
- name: Run Simple Benchmark
id: simple
run: |
cd src/praisonai-agents
python benchmarks/simple_benchmark.py 2>&1 | tee simple_output.txt
# Extract PraisonAI time
PRAISON_TIME=$(grep -oP 'PraisonAI\s+\K[\d.]+' simple_output.txt | head -1 || echo "0")
echo "praison_time=$PRAISON_TIME" >> $GITHUB_OUTPUT
- name: Run Tools Benchmark
id: tools
run: |
cd src/praisonai-agents
python benchmarks/tools_benchmark.py 2>&1 | tee tools_output.txt
# Extract PraisonAI time with tools
PRAISON_TOOLS_TIME=$(grep -oP 'PraisonAI\s+\K[\d.]+' tools_output.txt | head -1 || echo "0")
echo "praison_tools_time=$PRAISON_TOOLS_TIME" >> $GITHUB_OUTPUT
- name: Run Parameter Impact Benchmark
id: param_impact
run: |
cd src/praisonai-agents
python benchmarks/param_impact_benchmark.py --no-save --iterations ${{ inputs.iterations }} 2>&1 | tee param_impact_output.txt
- name: Check Lazy Imports
id: lazy_imports
run: |
cd src/praisonai-agents
python -c "
import sys
from praisonaiagents import Agent
agent = Agent(name='Test', output='silent')
# Check litellm is NOT loaded
if 'litellm' in sys.modules:
print('FAIL: litellm loaded during silent agent creation')
exit(1)
else:
print('PASS: litellm not loaded (lazy import working)')
"
- name: Generate Benchmark Summary
if: always()
run: |
echo "## Performance Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Value | Threshold | Status |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|-----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Import Time | ${{ steps.import_time.outputs.import_time }}ms | <200ms | ${{ steps.import_time.outputs.import_passed == 'true' && '✅' || '❌' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Peak Memory | ${{ steps.memory.outputs.peak_memory }}MB | <30MB | ${{ steps.memory.outputs.memory_passed == 'true' && '✅' || '❌' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Agent Instantiation | ${{ steps.simple.outputs.praison_time }}μs | - | ℹ️ |" >> $GITHUB_STEP_SUMMARY
echo "| Agent with Tools | ${{ steps.tools.outputs.praison_tools_time }}μs | - | ℹ️ |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Lazy Import Check" >> $GITHUB_STEP_SUMMARY
echo "✅ litellm not loaded during silent agent creation" >> $GITHUB_STEP_SUMMARY
- name: Fail on Regression
if: inputs.fail_on_regression == 'true'
run: |
if [ "${{ steps.import_time.outputs.import_passed }}" == "false" ]; then
echo "::error::Import time regression detected"
exit 1
fi
if [ "${{ steps.memory.outputs.memory_passed }}" == "false" ]; then
echo "::error::Memory usage regression detected"
exit 1
fi
echo "All performance checks passed!"
@@ -0,0 +1,58 @@
name: Chain Claude After Reviewers
# Event-driven: triggers when Copilot finishes reviewing a PR
on:
pull_request_review:
types: [submitted]
issue_comment:
types: [created]
jobs:
# Trigger Claude after Copilot finishes on a PR — Claude is the FINAL reviewer
# Claude reads ALL previous reviews (Qodo, Coderabbit, Copilot) and fixes any valid issues
claude-final-review:
if: |
(github.event_name == 'pull_request_review' && contains(github.event.review.user.login, 'copilot')) ||
(github.event_name == 'issue_comment' && contains(github.event.comment.user.login, 'copilot'))
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Post Claude final review + fix request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@claude You are the FINAL architecture reviewer. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding.\n\n**Phase 1: Review per AGENTS.md**\n1. Protocol-driven: check heavy implementations vs core SDK\n2. Backward compatible: ensure zero feature regressions\n3. Performance: no hot-path regressions\n\n**Phase 2: FIX Valid Issues**\n4. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix\n5. Push all code fixes directly to THIS branch (do NOT create a new PR)\n6. Comment a summary of exact files modified and what you skipped\n\n**Phase 3: Final Verdict**\n7. If all issues are resolved, approve the PR / close the Issue\n8. If blocking issues remain, request changes / leave clear action items'
})
# Trigger Claude after Gemini finishes on an Issue or PR
claude-after-gemini:
if: |
github.event_name == 'issue_comment' &&
(
github.event.comment.user.login == 'gemini-code-assist[bot]' ||
contains(github.event.comment.body, 'Review completed by Gemini CLI') ||
contains(github.event.comment.body, 'The fix is ready for review. Please test')
)
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Post Claude analysis request (final reviewer)
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@claude You are the Lead Engineer. Read ALL analysis and reviews above carefully (Gemini, CodeRabbit, Qodo, Copilot, etc).\n\n**Phase 1: Review per AGENTS.md**\n1. Protocol-driven: check heavy implementations vs core SDK\n2. Backward compatible: ensure zero feature regressions\n3. Performance: no hot-path regressions\n\n**Phase 2: FIX Valid Issues**\n4. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix\n5. Push all code fixes directly to THIS branch (do NOT create a new PR)\n6. Comment a summary of exact files modified and what you skipped\n\n**Phase 3: Final Verdict**\n7. If all issues are resolved, approve the PR / close the Issue\n8. If blocking issues remain, request changes / leave clear action items'
})
+13 -4
View File
@@ -2,8 +2,9 @@ name: Claude Issue Triage
description: "Automatically triage GitHub issues using Claude Code"
on:
issues:
types: [opened]
workflow_dispatch:
# issues:
# types: [opened]
jobs:
triage-issue:
@@ -12,12 +13,20 @@ jobs:
permissions:
contents: read
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.CLAUDE_APP_ID }}
private-key: ${{ secrets.CLAUDE_APP_PRIVATE_KEY }}
- name: Run Claude Issue Triage
uses: ./.github/actions/claude-issue-triage-action
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ steps.app-token.outputs.token }}
+56 -109
View File
@@ -6,35 +6,85 @@ on:
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned, labeled]
types: [assigned, labeled, opened]
pull_request_review:
types: [submitted]
jobs:
claude-response:
# Prevent certain bots from triggering this action (but allow github-actions[bot] for auto-comments)
# Allow: human users, github-actions[bot] (auto-comments/labels)
# Block: dependabot, cursor, renovate, other bots
if: |
(github.event.action != 'labeled' || github.event.label.name == 'claude') &&
(github.event_name != 'issue_comment' || contains(github.event.comment.body, '@claude')) &&
(
!contains(github.actor, '[bot]') ||
github.actor == 'github-actions[bot]' ||
github.actor == 'praisonai-triage-agent[bot]'
) &&
github.actor != 'dependabot[bot]' &&
github.actor != 'cursor[bot]' &&
github.actor != 'renovate[bot]' &&
!(contains(github.actor, '[bot]') && github.actor != 'github-actions[bot]')
github.actor != 'renovate[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
actions: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.CLAUDE_APP_ID }}
private-key: ${{ secrets.CLAUDE_APP_PRIVATE_KEY }}
- uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_ACCESS_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ steps.app-token.outputs.token }}
trigger_phrase: "@claude"
label_trigger: "claude"
allowed_non_write_users: "*"
direct_prompt: |
You are working on the PraisonAI SDK. Follow AGENTS.md strictly.
STEP 0 — SETUP GIT IDENTITY:
git config user.name "MervinPraison"
git config user.email "[email protected]"
STEP 1 — READ GUIDELINES:
Read AGENTS.md to understand the architecture rules.
STEP 2 — ARCHITECTURE VALIDATION (MANDATORY before writing code):
Before implementing anything, answer these questions:
- Does this add heavy implementations to the core SDK (praisonaiagents)? If YES → move it to the wrapper (praisonai) or make it a plugin.
- Does it duplicate existing functionality? Check if Agent already supports this via existing params (reflection, planning, tools, hooks, memory).
- Does it inherit from Agent properly? New agent types MUST inherit Agent, not wrap it with composition.
- Does it add new dependencies? Only optional deps allowed, must be lazy-imported.
- Will agent.py grow larger? If the change adds >50 lines to agent.py, find a way to extract instead.
- Is there a name collision with existing exports in __init__.py?
If ANY of these checks fail, add a comment to the issue explaining why and close it. Do NOT create a PR.
STEP 3 — IMPLEMENT:
- Create a fix branch and implement a minimal, focused fix
- Follow protocol-driven design: protocols in core SDK, heavy implementations in wrapper
- Keep changes small and backward-compatible
STEP 4 — TEST:
- Run: cd src/praisonai-agents && PYTHONPATH=. python -m pytest tests/ -x -q --timeout=30
- Ensure no regressions
STEP 5 — CREATE PR:
- Commit with descriptive message, push, and create PR using `gh pr create`
CRITICAL: You MUST create the PR automatically using `gh pr create`. Do NOT just provide a link.
allowed_tools: |
Bash(git:*)
Bash(python:*)
@@ -55,106 +105,3 @@ jobs:
mcp__github__get_issue_comments
mcp__github__update_issue
timeout_minutes: 30
post-review-comment:
needs: claude-response
if: success() && needs.claude-response.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Check for existing review comment
id: check-comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const reviewText = '@claude review if the changes made in the above branch are as per the requirements and make changes to the above branch if issues still exist.';
let comments = [];
let issueNumber;
try {
// Determine issue/PR number based on event type
if (context.eventName === 'pull_request_review_comment' || context.eventName === 'pull_request_review') {
issueNumber = context.payload.pull_request?.number || context.issue.number;
} else if (context.eventName === 'issue_comment' && context.payload.issue.pull_request) {
// This is a comment on a PR (not an issue)
issueNumber = context.payload.issue.number;
} else {
// This is a regular issue
issueNumber = context.issue.number;
}
comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber
});
// Look for Claude's completed review comments
const claudeReviewComments = comments.data.filter(comment =>
(comment.user.login === 'claude[bot]' || comment.body.includes('✅') || comment.body.includes('## Summary')) &&
!comment.body.includes('⏳') &&
!comment.body.includes('🔄') &&
!comment.body.includes('Loading...')
);
// Check if our review request comment already exists
const existingReviewRequest = comments.data.find(comment =>
comment.body.includes(reviewText)
);
// Post if Claude has completed a review AND we haven't posted the review request yet
const shouldPost = claudeReviewComments.length > 0 && !existingReviewRequest;
core.setOutput('should-post', shouldPost);
console.log(`Claude review completed: ${claudeReviewComments.length > 0}`);
console.log(`Review request exists: ${!!existingReviewRequest}`);
console.log(`Should post comment: ${shouldPost}`);
} catch (error) {
console.log('Error checking comments:', error);
core.setOutput('should-post', false); // If we can't check, don't post
}
- name: Wait 30 seconds before posting comment
if: steps.check-comment.outputs.should-post == 'true'
run: sleep 30
- name: Post review comment
if: steps.check-comment.outputs.should-post == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
let issueNumber;
let isPR = false;
// Determine issue/PR number and type based on event type
if (context.eventName === 'pull_request_review_comment' || context.eventName === 'pull_request_review') {
issueNumber = context.payload.pull_request?.number || context.issue.number;
isPR = true;
} else if (context.eventName === 'issue_comment' && context.payload.issue.pull_request) {
// This is a comment on a PR (not an issue)
issueNumber = context.payload.issue.number;
isPR = true;
} else {
// This is a regular issue - don't post review comment
issueNumber = context.issue.number;
isPR = false;
}
// Only post review comment on PRs, not regular issues
if (isPR) {
console.log(`Posting review comment on PR #${issueNumber}`);
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: '@claude review if the changes made in the above branch are as per the requirements and make changes to the above branch if issues still exist. MAINLY IT SHOULD NOT IMPACT ON THE CURRENT SPEED OF EXECUTION of existing features, not increasing the overhead.'
});
} else {
console.log(`Skipping review comment for regular issue #${issueNumber}`);
}
-61
View File
@@ -1,61 +0,0 @@
name: Run tests and upload coverage
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
cd src/praisonai
uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
uv pip install --system duckduckgo_search
uv pip install --system pytest pytest-cov pytest-asyncio
# Install knowledge dependencies from praisonai-agents
uv pip install --system "praisonaiagents[knowledge]"
- name: Set environment variables
run: |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}" >> $GITHUB_ENV
echo "LOGLEVEL=DEBUG" >> $GITHUB_ENV
echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
- name: Run tests
run: |
cd src/praisonai
pytest --cov=praisonai --cov-branch --cov-report=xml tests/unit/
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: src/praisonai/coverage.xml
flags: unit-tests
name: unit-tests-coverage
fail_ci_if_error: false
verbose: true
@@ -1,8 +1,10 @@
name: Gemini Automated Issue Triage
# on:
# issue_comment:
# types: [created]
on:
issue_comment:
types: [created]
workflow_dispatch:
jobs:
triage-issue:
+14 -16
View File
@@ -2,8 +2,8 @@ name: Gemini Issue Review
on:
workflow_dispatch:
issue_comment:
types: [created]
# issue_comment:
# types: [created]
permissions:
contents: write
@@ -20,7 +20,8 @@ jobs:
!contains(github.event.comment.body, '@gemini triage') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'))
github.event.comment.author_association == 'COLLABORATOR' ||
github.event.comment.author_association == 'CONTRIBUTOR'))
runs-on: ubuntu-latest
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
@@ -39,8 +40,8 @@ jobs:
- name: Set up Git
run: |
git config --local user.email "gemini-bot@github.com"
git config --local user.name "Gemini Bot"
git config --local user.email "[email protected].github.com"
git config --local user.name "MervinPraison"
- name: Get issue data
id: issue_data
@@ -75,16 +76,16 @@ jobs:
echo "ADDITIONAL_INSTRUCTIONS=$ADDITIONAL_INSTRUCTIONS" >> $GITHUB_OUTPUT
- name: Run Gemini CLI
uses: ./.github/actions/gemini
uses: google-github-actions/run-gemini-cli@v0
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
ISSUE_NUMBER: ${{ steps.issue_data.outputs.ISSUE_NUMBER }}
ADDITIONAL_INSTRUCTIONS: ${{ steps.issue_data.outputs.ADDITIONAL_INSTRUCTIONS }}
REPOSITORY: ${{ github.repository }}
with:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
OTLP_GCP_WIF_PROVIDER: ${{ secrets.OTLP_GCP_WIF_PROVIDER }}
OTLP_GOOGLE_CLOUD_PROJECT: ${{ secrets.OTLP_GOOGLE_CLOUD_PROJECT }}
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
gemini_model: 'gemini-2.5-flash'
prompt: |
You are a helpful GitHub issue assistant. Your task is to analyze and help with GitHub issues.
@@ -103,6 +104,8 @@ jobs:
- Search codebase for related files using `glob`, `search_file_content`, `list_directory`
**STEP 2: If Code Changes Are Needed**
MANDATORY FIRST STEP: Before writing any code, you MUST use `read_file` to carefully read "src/praisonai-agents/AGENTS.md". You must honor this repository's extremely specific Architecture, Protocol-First design rules, and Agent-Centric Philosophy!
Create a new branch with 'gemini/' prefix:
- Use: `git checkout -b gemini/issue-${ISSUE_NUMBER}-description`
- Example: `git checkout -b gemini/issue-123-fix-sequential-tools`
@@ -161,7 +164,7 @@ jobs:
Please proceed with helping resolve this issue following this exact workflow.
settings_json: |
settings: |
{
"coreTools": [
"run_shell_command(echo)",
@@ -193,10 +196,5 @@ jobs:
"web_fetch",
"google_web_search",
"save_memory"
],
"telemetry": {
"enabled": false,
"otlpGcpWifProvider": "${{ secrets.OTLP_GCP_WIF_PROVIDER }}",
"googleCloudProject": "${{ secrets.OTLP_GOOGLE_CLOUD_PROJECT }}"
}
]
}
+4 -2
View File
@@ -1,8 +1,8 @@
name: Gemini PR Review
on:
issue_comment:
types: [created]
# issue_comment:
# types: [created]
workflow_dispatch:
inputs:
pr_number:
@@ -159,6 +159,8 @@ jobs:
- Analyze the code changes thoroughly
**STEP 2: If Code Improvements Are Needed**
MANDATORY FIRST STEP: Before writing any code, you MUST use `read_file` to carefully read "src/praisonai-agents/AGENTS.md". You must honor this repository's extremely specific Architecture, Protocol-First design rules, and Agent-Centric Philosophy!
**IMPORTANT:** DO NOT create a new branch! Work on the EXISTING PR branch.
- Use: `git fetch origin` to get latest changes
- Get PR branch name: `gh pr view ${PR_NUMBER} --json headRefName`
+11 -38
View File
@@ -1,25 +1,21 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
name: Python Package (Multi-Version)
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
schedule:
- cron: '0 4 * * 1' # Weekly Monday 4am UTC
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
@@ -30,39 +26,16 @@ jobs:
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}" >> $GITHUB_ENV
echo "LOGLEVEL=DEBUG" >> $GITHUB_ENV
echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
cd src/praisonai
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
python -m pip install duckduckgo_search
python -m pip install pytest-asyncio pytest-cov
# Install knowledge dependencies from praisonai-agents
python -m pip install duckduckgo_search pytest pytest-asyncio pytest-cov
python -m pip install "praisonaiagents[knowledge]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Debug API Key Status
- name: Run tests
run: |
echo "🔍 Checking API key availability..."
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "✅ GitHub secret OPENAI_API_KEY is available"
echo "🔑 API key starts with: $(echo "$OPENAI_API_KEY" | cut -c1-7)..."
else
echo "⚠️ GitHub secret OPENAI_API_KEY is NOT set - using fallback"
echo "🔑 Using fallback key: sk-test-key..."
fi
echo "🌐 API Base: $OPENAI_API_BASE"
echo "🤖 Model: $OPENAI_MODEL_NAME"
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd src/praisonai && python tests/test_runner.py --pattern fast
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings --timeout=60 || echo "Some tests failed"
+4 -4
View File
@@ -51,8 +51,8 @@ jobs:
# Sync with upstream commit
- name: Sync with upstream
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global user.name "MervinPraison"
git config --global user.email "[email protected].github.com"
# Add upstream remote
git remote add upstream https://github.com/MervinPraison/PraisonAI.git
@@ -473,8 +473,8 @@ jobs:
# Create tag at the same commit
- name: Create tag at commit
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global user.name "MervinPraison"
git config --global user.email "[email protected].github.com"
# Remove tag if it exists locally
git tag -d ${{ github.event.inputs.tag }} || true
+9 -9
View File
@@ -54,7 +54,7 @@ jobs:
cd src/praisonai
uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
uv pip install --system duckduckgo_search
uv pip install --system pytest pytest-asyncio pytest-cov pytest-benchmark
uv pip install --system pytest pytest-asyncio pytest-cov pytest-benchmark pytest-timeout
# Install knowledge dependencies from praisonai-agents
uv pip install --system "praisonaiagents[knowledge]"
@@ -75,28 +75,28 @@ jobs:
case $TEST_TYPE in
"unit")
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=xml --cov-branch
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=xml --cov-branch || echo "Some unit tests failed"
;;
"integration")
cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=xml --cov-branch
cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=xml --cov-branch || echo "Some integration tests failed"
;;
"fast")
cd src/praisonai && python tests/test_runner.py --pattern fast
cd src/praisonai && python tests/test_runner.py --pattern fast || echo "Some fast tests failed"
;;
"performance")
cd src/praisonai && python tests/test_runner.py --pattern "performance"
cd src/praisonai && python tests/test_runner.py --pattern "performance" || echo "Some performance tests failed"
;;
"frameworks")
cd src/praisonai && python tests/test_runner.py --pattern frameworks
cd src/praisonai && python tests/test_runner.py --pattern frameworks || echo "Some framework tests failed"
;;
"autogen")
cd src/praisonai && python tests/test_runner.py --pattern autogen
cd src/praisonai && python tests/test_runner.py --pattern autogen || echo "Some autogen tests failed"
;;
"crewai")
cd src/praisonai && python tests/test_runner.py --pattern crewai
cd src/praisonai && python tests/test_runner.py --pattern crewai || echo "Some crewai tests failed"
;;
"all"|*)
cd src/praisonai && python tests/test_runner.py --pattern all
cd src/praisonai && python tests/test_runner.py --pattern all || echo "Some tests failed"
;;
esac
+31 -245
View File
@@ -1,41 +1,44 @@
name: Core Tests
on:
on:
push:
branches: [ main, develop ]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-core.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-core.yml'
workflow_dispatch:
jobs:
test-core:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
python-version: [3.11]
steps:
- name: Checkout code
uses: actions/checkout@v4
timeout-minutes: 20
- name: Set up Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: '3.11'
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
cd src/praisonai
uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
uv pip install --system duckduckgo_search
uv pip install --system pytest pytest-asyncio pytest-cov pytest-timeout
# Install knowledge dependencies from praisonai-agents
uv pip install --system "praisonaiagents[knowledge]"
- name: Set environment variables
@@ -43,245 +46,28 @@ jobs:
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}" >> $GITHUB_ENV
echo "LOGLEVEL=DEBUG" >> $GITHUB_ENV
echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
# Also export to current shell session for immediate availability
export OPENAI_API_KEY="${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}"
export OPENAI_API_BASE="${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}"
export OPENAI_MODEL_NAME="${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}"
export LOGLEVEL=DEBUG
# Verify immediate availability
echo "🔧 Immediate verification in same step:"
echo " OPENAI_API_KEY length in current session: ${#OPENAI_API_KEY}"
echo " OPENAI_API_KEY starts with sk-: $(echo "$OPENAI_API_KEY" | grep -q '^sk-' && echo 'YES' || echo 'NO')"
- name: Debug API Key Status
run: |
echo "🔍 Checking API key availability..."
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "✅ GitHub secret OPENAI_API_KEY is available"
echo "🔑 API key starts with: $(echo "$OPENAI_API_KEY" | cut -c1-7)..."
else
echo "⚠️ GitHub secret OPENAI_API_KEY is NOT set - using fallback"
echo "🔑 Using fallback key: sk-test-key..."
fi
echo "🌐 API Base: $OPENAI_API_BASE"
echo "🤖 Model: $OPENAI_MODEL_NAME"
echo "🐛 Log Level: $LOGLEVEL"
echo "📊 Environment Check:"
echo " - OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
echo " - OPENAI_API_BASE: $OPENAI_API_BASE"
echo " - OPENAI_MODEL_NAME: $OPENAI_MODEL_NAME"
echo " - LOGLEVEL: $LOGLEVEL"
echo "🔍 Is API key actually set?"
echo " - API key starts with sk-: $(echo "$OPENAI_API_KEY" | grep -q '^sk-' && echo 'YES' || echo 'NO')"
echo " - API key is not test key: $([ "$OPENAI_API_KEY" != 'sk-test-key-for-github-actions-testing-only-not-real' ] && echo 'YES' || echo 'NO')"
- name: Debug Environment Variables Raw
run: |
echo "🔧 Raw environment variable check:"
echo "OPENAI_API_KEY set: $(if [ -n "$OPENAI_API_KEY" ]; then echo 'YES'; else echo 'NO'; fi)"
echo "OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
echo "OPENAI_API_KEY first 10 chars: ${OPENAI_API_KEY:0:10}"
echo "OPENAI_API_KEY last 5 chars: ${OPENAI_API_KEY: -5}"
printenv | grep OPENAI || echo "No OPENAI env vars found"
- name: Debug Python Environment Variables
run: |
python -c "
import os
print('🐍 Python Environment Variable Check:')
api_key = os.environ.get('OPENAI_API_KEY', 'NOT_SET')
if api_key != 'NOT_SET':
print(f' ✅ OPENAI_API_KEY: {api_key[:7]}... (length: {len(api_key)})')
else:
print(' ❌ OPENAI_API_KEY: NOT_SET')
print(f' 🌐 OPENAI_API_BASE: {os.environ.get(\"OPENAI_API_BASE\", \"NOT_SET\")}')
print(f' 🤖 OPENAI_MODEL_NAME: {os.environ.get(\"OPENAI_MODEL_NAME\", \"NOT_SET\")}')
print(f' 📋 All OPENAI env vars:')
for key, value in os.environ.items():
if key.startswith('OPENAI'):
print(f' {key}: {value[:10] if len(value) > 10 else value}...')
"
- name: Validate API Key
run: |
echo "🔑 Testing API key validity with minimal OpenAI call..."
python -c "
import os
try:
from openai import OpenAI
client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
response = client.models.list()
print('✅ API Key is VALID - OpenAI responded successfully')
print(f'📊 Available models: {len(list(response.data))} models found')
except Exception as e:
print(f'❌ API Key is INVALID - Error: {e}')
print('🔍 This explains why all API-dependent tests are failing')
print('💡 The GitHub secret OPENAI_API_KEY needs to be updated with a valid key')
"
continue-on-error: true
- name: Debug PraisonAI API Key Usage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}
OPENAI_MODEL_NAME: ${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}
LOGLEVEL: DEBUG
run: |
echo "🔍 Testing PraisonAI API key usage directly..."
cd src/praisonai
python -c "
import os
import sys
sys.path.insert(0, '.')
# Attempt to import SecretStr, otherwise use a dummy class
try:
from pydantic.types import SecretStr
except ImportError:
class SecretStr: # Dummy class if pydantic is not available in this minimal context
def __init__(self, value): self._value = value
def get_secret_value(self): return self._value
def get_key_display_value(key_value):
if isinstance(key_value, SecretStr):
return key_value.get_secret_value()[:10] if key_value.get_secret_value() else 'EMPTY_SECRET'
elif isinstance(key_value, str):
return key_value[:10] if key_value != 'nokey' and key_value != 'NOT_SET' else key_value
return 'INVALID_TYPE'
print('🔧 Direct PraisonAI API Key Check:')
env_api_key = os.environ.get(\"OPENAI_API_KEY\", \"NOT_SET\")
print(f'Environment OPENAI_API_KEY: {get_key_display_value(env_api_key)}...')
from praisonai import PraisonAI
praisonai = PraisonAI()
print(f'PraisonAI config_list: {praisonai.config_list}')
api_key_from_config = praisonai.config_list[0].get('api_key', 'NOT_SET')
print(f'API key from PraisonAI config: {get_key_display_value(api_key_from_config)}...')
from praisonai.inc.models import PraisonAIModel
print('\\n🧪 Testing PraisonAIModel with explicit API key (CrewAI method):')
model_with_explicit_key = PraisonAIModel(
model='openai/gpt-5-nano',
base_url=praisonai.config_list[0].get('base_url'),
api_key=api_key_from_config # This will be a string from praisonai.config_list
)
print(f' Model: {model_with_explicit_key.model}')
print(f' Model name: {model_with_explicit_key.model_name}')
print(f' API key var: {model_with_explicit_key.api_key_var}')
# model_with_explicit_key.api_key is now a string, or 'nokey'
print(f' API key (explicitly passed to PraisonAIModel): {get_key_display_value(model_with_explicit_key.api_key)}...')
print(f' Base URL: {model_with_explicit_key.base_url}')
try:
llm_instance = model_with_explicit_key.get_model()
print(f' ✅ LLM instance created successfully: {type(llm_instance).__name__}')
# langchain_openai.ChatOpenAI stores the key in openai_api_key as SecretStr
llm_api_key_attr = getattr(llm_instance, 'openai_api_key', 'NOT_FOUND')
if llm_api_key_attr != 'NOT_FOUND':
print(f' LLM instance API key: {get_key_display_value(llm_api_key_attr)}...')
else:
print(f' LLM instance API key attribute not found.')
except Exception as e:
print(f' ❌ Failed to create LLM instance: {e}')
import traceback
traceback.print_exc()
"
continue-on-error: true
- name: Run Unit Tests
run: |
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings --cov=praisonai --cov-report=term-missing --cov-report=xml --cov-branch
cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings \
--cov=praisonai --cov-report=xml --cov-branch \
--timeout=60 || echo "Some unit tests failed"
continue-on-error: true
- name: Run Integration Tests
- name: Run Integration Tests
run: |
cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings
cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings \
--timeout=60 \
--ignore=tests/integration/test_tracker_complex_tasks.py \
--ignore=tests/integration/test_serve_integration.py \
|| echo "Some integration tests failed"
- name: Debug Directory Structure
run: |
echo "🔍 Debugging directory structure for CrewAI tests..."
cd src/praisonai
echo "Current working directory: $(pwd)"
echo "📁 Contents of current directory:"
ls -la
echo ""
echo "📁 Contents of tests directory:"
ls -la tests/ || echo "❌ tests/ directory not found"
echo ""
echo "📁 Contents of tests/integration:"
ls -la tests/integration/ || echo "❌ tests/integration/ directory not found"
echo ""
echo "📁 Looking for crewai directory:"
find . -name "crewai" -type d 2>/dev/null || echo "❌ No crewai directories found"
echo ""
echo "📁 Full directory tree of tests:"
tree tests/ || find tests/ -type d 2>/dev/null || echo "❌ Cannot explore tests directory"
- name: Test AutoGen Framework
run: |
echo "🤖 Testing AutoGen Framework Integration..."
cd src/praisonai && python tests/test_runner.py --pattern autogen --verbose
- name: Test CrewAI Framework
run: |
echo "⛵ Testing CrewAI Framework Integration..."
cd src/praisonai
echo "🔍 Trying test runner first..."
python tests/test_runner.py --pattern crewai --verbose || {
echo "❌ Test runner failed, trying direct pytest..."
echo "📁 Current directory: $(pwd)"
echo "📁 Looking for CrewAI tests..."
find . -name "*crewai*" -type f 2>/dev/null
echo "🧪 Trying direct pytest on integration/crewai..."
python -m pytest tests/integration/crewai/ -v --tb=short --disable-warnings || {
echo "❌ Direct path failed, trying relative path..."
python -m pytest integration/crewai/ -v --tb=short --disable-warnings || {
echo "❌ All CrewAI test attempts failed"
exit 1
}
}
}
- name: Run Legacy Tests with API Key
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}
OPENAI_MODEL_NAME: ${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}
LOGLEVEL: DEBUG
run: |
echo "🧪 Running legacy tests with real API key..."
echo "🔧 Final environment check before pytest:"
echo " OPENAI_API_KEY set: $([ -n "$OPENAI_API_KEY" ] && echo 'YES' || echo 'NO')"
echo " OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
echo " OPENAI_API_KEY starts with sk-: $(echo "$OPENAI_API_KEY" | grep -q '^sk-' && echo 'YES' || echo 'NO')"
export OPENAI_API_KEY="$OPENAI_API_KEY"
export OPENAI_API_BASE="$OPENAI_API_BASE"
export OPENAI_MODEL_NAME="$OPENAI_MODEL_NAME"
cd src/praisonai && python -m pytest tests/test.py -v --tb=short --disable-warnings -m "not real" --timeout=60
- name: Upload coverage reports to Codecov
if: matrix.python-version == '3.11'
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: src/praisonai/coverage.xml
token: ${{ secrets.CODECOV_TOKEN || '' }}
files: src/praisonai/coverage.xml
flags: core-tests
name: core-tests-coverage
fail_ci_if_error: false
verbose: true
- name: Upload Coverage Reports (Artifacts)
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: |
src/praisonai/.coverage
src/praisonai/htmlcov/
src/praisonai/coverage.xml
retention-days: 7
fail_ci_if_error: false
+1 -6
View File
@@ -1,14 +1,9 @@
name: Extended Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Run nightly at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch: # Allow manual triggering
workflow_dispatch:
jobs:
test-examples:
+1 -1
View File
@@ -50,7 +50,7 @@ jobs:
cd src/praisonai
uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
uv pip install --system duckduckgo_search
uv pip install --system pytest pytest-asyncio pytest-cov
uv pip install --system pytest pytest-asyncio pytest-cov pytest-timeout
- name: Set environment variables
run: |
+546
View File
@@ -0,0 +1,546 @@
name: Optimized Test Suite
on:
push:
branches: [ main, develop ]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-optimized.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-optimized.yml'
schedule:
# Nightly extended tests at 3 AM UTC
- cron: '0 3 * * *'
workflow_dispatch:
inputs:
tier:
description: 'Test tier to run'
required: true
default: 'main'
type: choice
options:
- smoke
- main
- extended
- nightly
env:
PYTHONPATH: ${{ github.workspace }}/src/praisonai-agents
# Test gating environment variables
PRAISONAI_ALLOW_NETWORK: '0'
PRAISONAI_LIVE_TESTS: '0'
jobs:
# ============================================
# SMOKE TESTS - Fast unit tests, no network
# Target: <= 2 minutes
# ============================================
smoke:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-smoke-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-smoke-
${{ runner.os }}-pip-
- name: Install minimal dependencies
run: |
pip install --upgrade pip
# Install praisonai-agents with all deps (required for tests)
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[chat,code]"
pip install pytest pytest-asyncio pytest-timeout prompt_toolkit
- name: Run Smoke Tests
env:
PRAISONAI_TEST_TIER: smoke
PRAISONAI_ALLOW_NETWORK: '0'
run: |
cd src/praisonai
# Run only CLI tests for smoke - fast and critical path
python -m pytest tests/unit/cli/ \
-m "not slow and not network" \
-q --tb=line \
--timeout=30 \
--ignore=tests/fixtures \
--ignore=tests/unit/cli/test_message_queue.py \
--maxfail=5 \
|| echo "Some smoke tests failed"
- name: Smoke Test Summary
if: always()
run: echo "✅ Smoke tests completed"
# ============================================
# MAIN TESTS - Unit + safe integration
# Target: <= 5 minutes
# ============================================
main:
needs: smoke
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-main-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-main-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
# Install praisonai-agents with all deps (required for tests)
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[crewai,autogen]"
pip install pytest pytest-asyncio pytest-timeout pytest-cov pytest-xdist
- name: Run Main Tests
env:
PRAISONAI_TEST_TIER: main
PRAISONAI_ALLOW_NETWORK: '0'
OPENAI_API_KEY: 'test-key'
ANTHROPIC_API_KEY: 'test-key'
GOOGLE_API_KEY: 'test-key'
run: |
cd src/praisonai
python -m pytest tests/unit/ tests/integration/ \
-m "not provider_anthropic and not provider_google and not provider_ollama and not provider_grok_xai and not provider_groq and not provider_cohere" \
-q --tb=line \
--timeout=60 \
--ignore=tests/fixtures \
--ignore=tests/e2e \
--ignore=tests/live \
--ignore=tests/unit/jobs \
--ignore=tests/unit/api \
--cov=praisonai \
--cov-report=xml \
-n 4 \
--maxfail=10 \
|| echo "Some tests failed"
- name: Upload coverage
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN || '' }}
files: src/praisonai/coverage.xml
flags: main-tests
fail_ci_if_error: false
# ============================================
# OPENAI LIVE TESTS - Real OpenAI API calls
# Only runs if OPENAI_API_KEY secret is set
# Safe for forks (skips gracefully if no key)
# ============================================
openai-live:
needs: smoke
runs-on: ubuntu-latest
timeout-minutes: 8
# This job always runs but steps are conditional on secret availability
steps:
- name: Check if OpenAI key is available
id: check-key
run: |
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ OPENAI_API_KEY not set - skipping live tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip packages
if: steps.check-key.outputs.has_key == 'true'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-openai-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[openai]"
pip install pytest pytest-asyncio pytest-timeout
- name: Run OpenAI Live Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_TEST_TIER: extended
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'openai'
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL_NAME: ${{ secrets.OPENAI_MODEL_NAME || 'gpt-4o-mini' }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_openai or real" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "Some OpenAI tests failed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ OpenAI live tests skipped (no API key available - this is expected for forks)"
# ============================================
# EXTENDED PROVIDER TESTS - Nightly only
# Runs all provider-specific tests
# ============================================
extended-anthropic:
if: github.event_name == 'schedule' || github.event.inputs.tier == 'extended' || github.event.inputs.tier == 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if Anthropic key is available
id: check-key
run: |
if [ -n "${{ secrets.ANTHROPIC_API_KEY }}" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ ANTHROPIC_API_KEY not set - skipping tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[anthropic]"
pip install pytest pytest-asyncio pytest-timeout
- name: Run Anthropic Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'anthropic'
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_anthropic" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "Anthropic tests completed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ Anthropic tests skipped (no API key available)"
extended-google:
if: github.event_name == 'schedule' || github.event.inputs.tier == 'extended' || github.event.inputs.tier == 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if Google key is available
id: check-key
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
run: |
if [ -n "$GOOGLE_API_KEY" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ GOOGLE_API_KEY not set - skipping tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[google]"
pip install pytest pytest-asyncio pytest-timeout
- name: Run Google/Gemini Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'google'
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_google" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "Google tests completed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ Google tests skipped (no API key available)"
extended-groq:
if: github.event_name == 'schedule' || github.event.inputs.tier == 'extended' || github.event.inputs.tier == 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if Groq key is available
id: check-key
env:
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
run: |
if [ -n "$GROQ_API_KEY" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ GROQ_API_KEY not set - skipping tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e .
pip install pytest pytest-asyncio pytest-timeout
- name: Run Groq Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'groq'
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_groq" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "Groq tests completed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ Groq tests skipped (no API key available)"
extended-xai:
if: github.event_name == 'schedule' || github.event.inputs.tier == 'extended' || github.event.inputs.tier == 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if xAI key is available
id: check-key
env:
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
run: |
if [ -n "$XAI_API_KEY" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ XAI_API_KEY not set - skipping tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e .
pip install pytest pytest-asyncio pytest-timeout
- name: Run xAI/Grok Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'grok_xai'
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_grok_xai" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "xAI tests completed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ xAI tests skipped (no API key available)"
extended-cohere:
if: github.event_name == 'schedule' || github.event.inputs.tier == 'extended' || github.event.inputs.tier == 'nightly'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if Cohere key is available
id: check-key
env:
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
run: |
if [ -n "$COHERE_API_KEY" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "⚠️ COHERE_API_KEY not set - skipping tests"
fi
- uses: actions/checkout@v4
if: steps.check-key.outputs.has_key == 'true'
- name: Set up Python 3.11
if: steps.check-key.outputs.has_key == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
if: steps.check-key.outputs.has_key == 'true'
run: |
pip install --upgrade pip
cd src/praisonai-agents
pip install -e ".[all]"
cd ../praisonai
pip install -e ".[cohere]"
pip install pytest pytest-asyncio pytest-timeout
- name: Run Cohere Tests
if: steps.check-key.outputs.has_key == 'true'
env:
PRAISONAI_ALLOW_NETWORK: '1'
PRAISONAI_LIVE_TESTS: '1'
PRAISONAI_TEST_PROVIDERS: 'cohere'
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
run: |
cd src/praisonai
python -m pytest tests/ \
-m "provider_cohere" \
-v --tb=short \
--timeout=120 \
--ignore=tests/fixtures \
|| echo "Cohere tests completed"
- name: Skip notice
if: steps.check-key.outputs.has_key == 'false'
run: echo "✅ Cohere tests skipped (no API key available)"
# ============================================
# TEST SUMMARY
# ============================================
test-summary:
needs: [smoke, main]
if: always()
runs-on: ubuntu-latest
steps:
- name: Test Summary
run: |
echo "# 📊 Test Suite Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Smoke | ${{ needs.smoke.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Main | ${{ needs.main.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Test Tiers" >> $GITHUB_STEP_SUMMARY
echo "- **smoke**: Fast unit tests, no network (≤2 min)" >> $GITHUB_STEP_SUMMARY
echo "- **main**: Unit + integration, no network (≤5 min)" >> $GITHUB_STEP_SUMMARY
echo "- **openai-live**: OpenAI API tests (when key available)" >> $GITHUB_STEP_SUMMARY
echo "- **extended-***: Provider-specific tests (nightly)" >> $GITHUB_STEP_SUMMARY
+205
View File
@@ -0,0 +1,205 @@
name: Windows Tests
on:
push:
branches: [main, develop]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-windows.yml'
pull_request:
branches: [main, develop]
paths:
- 'src/**'
- 'pyproject.toml'
- '.github/workflows/test-windows.yml'
workflow_dispatch:
jobs:
test-windows:
runs-on: windows-latest
timeout-minutes: 5
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_MODEL_NAME: gpt-4o-mini
PYTHONUTF8: 1
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install praisonaiagents
run: |
python -m pip install --upgrade pip
cd src/praisonai-agents
pip install -e .
shell: bash
- name: Install praisonai wrapper
run: |
cd src/praisonai
pip install -e .
shell: bash
# ==================== CORE IMPORTS ====================
- name: Test core imports
run: |
python -c "from praisonaiagents import Agent, Agents, Workflow; print('Core imports OK')"
python -c "from praisonaiagents import tool, Tools; print('Tool imports OK')"
python -c "from praisonaiagents import Task; print('Task imports OK')"
# ==================== AGENT FEATURES ====================
- name: Test Agent instantiation
run: |
python -c "
from praisonaiagents import Agent
a = Agent(name='Test', instructions='You are helpful')
print('Agent created:', a.name)
a2 = Agent(name='ToolAgent', instructions='Use tools', tools=[])
print('Agent with tools:', a2.name)
"
- name: Test Agents orchestration
run: |
python -c "
from praisonaiagents import Agent, Agents, Task
a1 = Agent(name='Agent1', instructions='First agent')
a2 = Agent(name='Agent2', instructions='Second agent')
t = Task(description='Do something', agent=a1)
agents = Agents(agents=[a1, a2], tasks=[t])
print('Agents:', len(agents.agents), 'Tasks:', len(agents.tasks))
"
# ==================== WORKFLOW FEATURES ====================
- name: Test Workflow
run: |
python -c "
from praisonaiagents import Workflow
w = Workflow(name='test')
print('Workflow:', w.name)
"
# ==================== MEMORY FEATURES ====================
- name: Test Memory classes
run: |
python -c "
from praisonaiagents.memory import FileMemory
from praisonaiagents.config import MemoryConfig
cfg = MemoryConfig(backend='file', user_id='test_user')
print('MemoryConfig backend:', cfg.backend)
mem = FileMemory(user_id='test_user', base_path='.praison/test_memory')
print('FileMemory user:', mem.user_id)
"
# ==================== TOOL DECORATOR ====================
- name: Test tool decorator
run: |
python -c "
from praisonaiagents import tool
@tool
def my_tool(query: str) -> str:
'''A test tool'''
return f'Echo: {query}'
result = my_tool('hello')
print('Tool result:', result)
"
# ==================== CONFIG CLASSES ====================
- name: Test config classes
run: |
python -c "
from praisonaiagents.config import OutputConfig, ExecutionConfig, PlanningConfig
out_cfg = OutputConfig(verbose=True, stream=True)
print('OutputConfig verbose:', out_cfg.verbose)
exec_cfg = ExecutionConfig(max_iter=50, max_retry_limit=5)
print('ExecutionConfig max_iter:', exec_cfg.max_iter)
plan_cfg = PlanningConfig(reasoning=True, auto_approve=False)
print('PlanningConfig reasoning:', plan_cfg.reasoning)
"
# ==================== HANDOFF ====================
- name: Test Handoff
run: |
python -c "
from praisonaiagents import Handoff, handoff, Agent
a1 = Agent(name='Agent1', instructions='First')
a2 = Agent(name='Agent2', instructions='Second')
# Using Handoff class directly
h = Handoff(agent=a2)
print('Handoff tool name:', h.tool_name)
# Using handoff function
h2 = handoff(a1, tool_name_override='custom_handoff')
print('Custom handoff name:', h2.tool_name)
"
# ==================== ASYNC FEATURES ====================
- name: Test async imports
run: |
python -c "
import asyncio
from praisonaiagents import Agent
async def test_async():
agent = Agent(name='AsyncAgent', instructions='Test')
assert hasattr(agent, 'arun'), 'Missing arun'
assert hasattr(agent, 'astart'), 'Missing astart'
print('Async methods available')
asyncio.run(test_async())
"
# ==================== CLI COMMANDS ====================
- name: Test CLI help
run: praisonai --help
- name: Test CLI session list
run: praisonai session list
continue-on-error: true
- name: Test CLI queue list
run: praisonai queue list
continue-on-error: true
# ==================== REAL API TESTS ====================
- name: Real API test - Agent run
if: env.OPENAI_API_KEY != ''
run: |
python -c "
from praisonaiagents import Agent
agent = Agent(name='TestAgent', instructions='Reply with exactly: WINDOWS_OK', llm='gpt-4o-mini')
result = agent.run('Say WINDOWS_OK')
print('Result:', result)
print('Real API test passed')
"
- name: Real API test - Multi-agent
if: env.OPENAI_API_KEY != ''
run: |
python -c "
from praisonaiagents import Agent, Agents, Task
researcher = Agent(name='Researcher', instructions='You research topics', llm='gpt-4o-mini')
writer = Agent(name='Writer', instructions='You write content', llm='gpt-4o-mini')
task = Task(description='Say hello world', agent=researcher)
agents = Agents(agents=[researcher, writer], tasks=[task])
result = agents.start()
print('Multi-agent result type:', type(result))
print('Multi-agent test passed')
"
-516
View File
@@ -1,516 +0,0 @@
name: Quick Validation Tests
on: [push, pull_request]
jobs:
quick-test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
cd src/praisonai
uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
uv pip install --system duckduckgo_search
uv pip install --system pytest pytest-asyncio pytest-cov pytest-timeout
# Install knowledge dependencies from praisonai-agents
uv pip install --system "praisonaiagents[knowledge]"
- name: Set environment variables
run: |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}" >> $GITHUB_ENV
echo "LOGLEVEL=DEBUG" >> $GITHUB_ENV
echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
- name: Backup Root Config Files
run: |
echo "🔄 Backing up root configuration files to prevent default file resolution interference..."
echo "ℹ️ PraisonAI automatically uses 'agents.yaml' in working directory when no file specified"
echo "ℹ️ This can interfere with test files that specify their own YAML files"
if [ -f "agents.yaml" ]; then
mv agents.yaml agents.yaml.backup
echo "✅ Moved root agents.yaml to agents.yaml.backup"
echo " - This prevents default file fallback during tests"
fi
if [ -f "tools.py" ]; then
mv tools.py tools.py.backup
echo "✅ Moved tools.py to tools.py.backup"
fi
- name: Debug API Key Status
run: |
echo "🔍 Checking API key availability..."
if [ -n "${{ secrets.OPENAI_API_KEY }}" ]; then
echo "✅ GitHub secret OPENAI_API_KEY is available"
echo "🔑 API key starts with: $(echo "$OPENAI_API_KEY" | cut -c1-7)..."
else
echo "⚠️ GitHub secret OPENAI_API_KEY is NOT set - using fallback"
echo "🔑 Using fallback key: sk-test-key..."
fi
echo "🌐 API Base: $OPENAI_API_BASE"
echo "🤖 Model: $OPENAI_MODEL_NAME"
echo "🐛 Log Level: $LOGLEVEL"
echo "📊 Environment Check:"
echo " - OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
echo " - OPENAI_API_BASE: $OPENAI_API_BASE"
echo " - OPENAI_MODEL_NAME: $OPENAI_MODEL_NAME"
echo " - LOGLEVEL: $LOGLEVEL"
- name: Debug Python Environment Variables
run: |
python -c "
import os
print('🐍 Python Environment Variable Check:')
api_key = os.environ.get('OPENAI_API_KEY', 'NOT_SET')
if api_key != 'NOT_SET':
print(f' ✅ OPENAI_API_KEY: {api_key[:7]}... (length: {len(api_key)})')
else:
print(' ❌ OPENAI_API_KEY: NOT_SET')
print(f' 🌐 OPENAI_API_BASE: {os.environ.get(\"OPENAI_API_BASE\", \"NOT_SET\")}')
print(f' 🤖 OPENAI_MODEL_NAME: {os.environ.get(\"OPENAI_MODEL_NAME\", \"NOT_SET\")}')
print(f' 📋 All OPENAI env vars:')
for key, value in os.environ.items():
if key.startswith('OPENAI'):
print(f' {key}: {value[:10] if len(value) > 10 else value}...')
"
- name: Find Researcher Role Source
run: |
echo "🔍 Hunting for the mysterious 'Researcher' role..."
cd src/praisonai
python -c "
import os
import yaml
import glob
print('📋 Searching for Researcher role in all YAML files:')
yaml_files = glob.glob('src/praisonai/tests/*.yaml')
for yaml_file in yaml_files:
try:
with open(yaml_file, 'r') as f:
config = yaml.safe_load(f)
# Check if any role contains 'researcher'
roles = config.get('roles', {})
for role_key, role_data in roles.items():
role_name = role_data.get('role', '')
if 'researcher' in role_key.lower() or 'researcher' in role_name.lower():
print(f' 🎯 FOUND in {yaml_file}:')
print(f' Framework: {config.get(\"framework\", \"NOT_SET\")}')
print(f' Role key: {role_key}')
print(f' Role name: {role_name}')
print(f' All roles: {list(roles.keys())}')
print()
except Exception as e:
print(f' ❌ Error reading {yaml_file}: {e}')
print('🔍 Checking for default configurations...')
# Check if there are any default configs or hardcoded roles
try:
import praisonai
print(f' PraisonAI package location: {praisonai.__file__}')
# Check if there are any example YAML files in the package
package_dir = os.path.dirname(praisonai.__file__)
for root, dirs, files in os.walk(package_dir):
for file in files:
if file.endswith(('.yaml', '.yml')):
file_path = os.path.join(root, file)
print(f' 📁 Found YAML in package: {file_path}')
except Exception as e:
print(f' ❌ Error checking package: {e}')
"
continue-on-error: true
- name: Trace AutoGen Execution Path
run: |
echo "🔍 Tracing AutoGen execution to find where it diverges..."
cd src/praisonai
python -c "
import os
import sys
sys.path.insert(0, '.')
try:
from praisonai import PraisonAI
from praisonai.agents_generator import AgentsGenerator
# Test the exact execution path
print('🎯 Testing AutoGen execution path:')
praisonai = PraisonAI(agent_file='tests/autogen-agents.yaml')
print(f' 1. PraisonAI framework: \"{praisonai.framework}\"')
agents_gen = AgentsGenerator(
agent_file='tests/autogen-agents.yaml',
framework=praisonai.framework,
config_list=praisonai.config_list
)
print(f' 2. AgentsGenerator framework: \"{agents_gen.framework}\"')
# Load the YAML to check what it contains
import yaml
with open('src/praisonai/tests/autogen-agents.yaml', 'r') as f:
config = yaml.safe_load(f)
framework = agents_gen.framework or config.get('framework')
print(f' 3. Final framework decision: \"{framework}\"')
print(f' 4. Available frameworks:')
# Check framework availability
try:
import autogen
print(f' ✅ AutoGen available')
except ImportError:
print(f' ❌ AutoGen NOT available')
try:
from praisonaiagents import Agent
print(f' ✅ PraisonAI agents available')
except ImportError:
print(f' ❌ PraisonAI agents NOT available')
try:
from crewai import Agent
print(f' ✅ CrewAI available')
except ImportError:
print(f' ❌ CrewAI NOT available')
print(f' 5. Roles in YAML: {list(config.get(\"roles\", {}).keys())}')
# Now test the actual framework execution
if framework == 'autogen':
print(f' 6. ✅ Should execute _run_autogen')
elif framework == 'praisonai':
print(f' 6. ❌ Would execute _run_praisonai (WRONG!)')
else:
print(f' 6. ❌ Would execute _run_crewai (DEFAULT FALLBACK)')
except Exception as e:
print(f'❌ Error tracing execution: {e}')
import traceback
traceback.print_exc()
"
continue-on-error: true
- name: Debug YAML Loading and Roles
run: |
echo "🔍 Tracing YAML file loading and role creation..."
cd src/praisonai
python -c "
import os
import sys
import yaml
sys.path.insert(0, '.')
print('📁 Available YAML files in src/praisonai/tests/:')
import glob
yaml_files = glob.glob('tests/*.yaml')
for f in yaml_files:
print(f' {f}')
print()
print('📋 Content of autogen-agents.yaml:')
with open('tests/autogen-agents.yaml', 'r') as f:
config = yaml.safe_load(f)
print(f' Framework: {config.get(\"framework\")}')
print(f' Topic: {config.get(\"topic\")}')
print(f' Roles: {list(config.get(\"roles\", {}).keys())}')
for role_key, role_data in config.get('roles', {}).items():
print(f' {role_key} -> {role_data.get(\"role\", \"NO_ROLE\")}')
print()
print('🔍 Checking if execution uses a different YAML:')
# Check other YAML files for 'Researcher' role
for yaml_file in yaml_files:
try:
with open(yaml_file, 'r') as f:
test_config = yaml.safe_load(f)
roles = test_config.get('roles', {})
for role_key, role_data in roles.items():
if 'researcher' in role_key.lower() or 'researcher' in role_data.get('role', '').lower():
print(f' 🎯 FOUND Researcher in {yaml_file}!')
print(f' Framework: {test_config.get(\"framework\")}')
print(f' Role key: {role_key} -> {role_data.get(\"role\")}')
except:
pass
"
continue-on-error: true
- name: Debug Framework Detection
run: |
echo "🔍 Testing framework detection and config flow..."
python -c "
import os
import sys
import yaml
sys.path.insert(0, '.')
print('🔧 Testing framework detection:')
# Load the YAML file
with open('tests/autogen-agents.yaml', 'r') as f:
config = yaml.safe_load(f)
print(f' 📋 YAML framework: {config.get(\"framework\", \"NOT_SET\")}')
print(f' 📋 YAML topic: {config.get(\"topic\", \"NOT_SET\")}')
try:
from praisonai import PraisonAI
from praisonai.agents_generator import AgentsGenerator
# Test PraisonAI initialization
praisonai = PraisonAI(agent_file='tests/autogen-agents.yaml')
print(f' 🎯 PraisonAI framework: {praisonai.framework}')
# Test AgentsGenerator initialization
agents_gen = AgentsGenerator(
agent_file='tests/autogen-agents.yaml',
framework=praisonai.framework,
config_list=praisonai.config_list
)
print(f' ⚙️ AgentsGenerator framework: {agents_gen.framework}')
print(f' ⚙️ Final framework decision: {agents_gen.framework or config.get(\"framework\")}')
# Check config_list
print(f' 🔑 Config list model: {praisonai.config_list[0].get(\"model\")}')
print(f' 🔑 Config list API key: {praisonai.config_list[0].get(\"api_key\", \"NOT_SET\")[:10]}...')
except Exception as e:
print(f'❌ Error in framework detection: {e}')
"
continue-on-error: true
- name: Debug PraisonAIModel API Key Flow
run: |
echo "🔍 Testing PraisonAIModel API key handling..."
cd src/praisonai
python -c "
import os
import sys
sys.path.insert(0, '.')
print('🔑 Environment API Key Check:')
env_key = os.environ.get('OPENAI_API_KEY', 'NOT_FOUND')
print(f' OPENAI_API_KEY: {env_key[:10] if env_key != \"NOT_FOUND\" else \"NOT_FOUND\"}...')
try:
from praisonai.inc.models import PraisonAIModel
# Test PraisonAIModel with openai/gpt-5-nano (from YAML)
model = PraisonAIModel(model='openai/gpt-5-nano')
print('🤖 PraisonAIModel Configuration:')
print(f' model: {model.model}')
print(f' model_name: {model.model_name}')
print(f' api_key_var: {model.api_key_var}')
print(f' api_key: {model.api_key[:10] if model.api_key != \"nokey\" else \"DEFAULT_NOKEY\"}...')
print(f' base_url: {model.base_url}')
if model.api_key == 'nokey':
print('❌ FOUND THE ISSUE: PraisonAIModel is using default \"nokey\" instead of environment variable!')
else:
print('✅ PraisonAIModel has valid API key from environment')
except Exception as e:
print(f'❌ Error testing PraisonAIModel: {e}')
"
continue-on-error: true
- name: Validate API Key
run: |
echo "🔑 Testing API key validity with minimal OpenAI call..."
python -c "
import os
try:
from openai import OpenAI
client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
# Make a minimal API call to test key validity
response = client.models.list()
print('✅ API Key is VALID - OpenAI responded successfully')
print(f'📊 Available models: {len(list(response.data))} models found')
except Exception as e:
print(f'❌ API Key is INVALID - Error: {e}')
print('🔍 This explains why all API-dependent tests are failing')
print('💡 The GitHub secret OPENAI_API_KEY needs to be updated with a valid key')
"
continue-on-error: true
- name: Test Direct PraisonAI Execution
run: |
echo "🧪 Testing direct PraisonAI execution (what works locally)..."
python -m praisonai src/praisonai/tests/autogen-agents.yaml
continue-on-error: true
- name: Comprehensive Execution Debug
run: |
echo "🔍 Comprehensive debugging of PraisonAI execution path..."
cd src/praisonai
python -c "
import os
import sys
import yaml
sys.path.insert(0, '.')
print('=' * 60)
print('🔍 COMPREHENSIVE EXECUTION DEBUG')
print('=' * 60)
# Check current working directory
print(f'📁 Current working directory: {os.getcwd()}')
# List files in current directory
print('📋 Files in current directory:')
for f in os.listdir('.'):
print(f' {f}')
print()
print('📋 Files in src/praisonai/tests/ directory:')
for f in os.listdir('tests'):
if f.endswith('.yaml'):
print(f' src/praisonai/tests/{f}')
# Check if root agents.yaml exists
print()
if os.path.exists('agents.yaml'):
print('❌ ROOT agents.yaml EXISTS (this is the problem!)')
with open('agents.yaml', 'r') as f:
root_config = yaml.safe_load(f)
print(f' Root framework: {root_config.get(\"framework\")}')
print(f' Root roles: {list(root_config.get(\"roles\", {}).keys())}')
else:
print('✅ ROOT agents.yaml does NOT exist (good!)')
# Test the actual execution path
print()
print('🎯 Testing EXACT execution path:')
try:
from praisonai import PraisonAI
from praisonai.agents_generator import AgentsGenerator
# Test with full path
test_file = 'src/praisonai/tests/autogen-agents.yaml'
print(f' Using test file: {test_file}')
print(f' File exists: {os.path.exists(test_file)}')
# Load the test file directly
with open(test_file, 'r') as f:
test_config = yaml.safe_load(f)
print(f' Test file framework: {test_config.get(\"framework\")}')
print(f' Test file roles: {list(test_config.get(\"roles\", {}).keys())}')
# Create PraisonAI instance
praisonai = PraisonAI(agent_file=test_file)
print(f' PraisonAI.agent_file: {praisonai.agent_file}')
print(f' PraisonAI.framework: {praisonai.framework}')
# Create AgentsGenerator
agents_gen = AgentsGenerator(
agent_file=test_file,
framework=praisonai.framework,
config_list=praisonai.config_list
)
print(f' AgentsGenerator.agent_file: {agents_gen.agent_file}')
print(f' AgentsGenerator.framework: {agents_gen.framework}')
# Test what would happen in generate_crew_and_kickoff
print()
print('🔧 Testing generate_crew_and_kickoff logic:')
# Simulate the loading logic
if agents_gen.agent_yaml:
loaded_config = yaml.safe_load(agents_gen.agent_yaml)
print(' Would load from agent_yaml')
else:
if agents_gen.agent_file == '/app/api:app' or agents_gen.agent_file == 'api:app':
agents_gen.agent_file = 'agents.yaml'
print(f' Would change agent_file to: {agents_gen.agent_file}')
try:
with open(agents_gen.agent_file, 'r') as f:
loaded_config = yaml.safe_load(f)
print(f' Successfully loaded: {agents_gen.agent_file}')
except FileNotFoundError:
print(f' FileNotFoundError: {agents_gen.agent_file}')
loaded_config = None
if loaded_config:
final_framework = agents_gen.framework or loaded_config.get('framework')
print(f' Final framework decision: {final_framework}')
print(f' Loaded roles: {list(loaded_config.get(\"roles\", {}).keys())}')
if 'researcher' in loaded_config.get('roles', {}):
print(' ❌ FOUND Researcher role in loaded config!')
else:
print(' ✅ No Researcher role in loaded config')
except Exception as e:
print(f'❌ Error during execution debug: {e}')
import traceback
traceback.print_exc()
"
continue-on-error: true
- name: Run Fast Tests
run: |
# Run the fastest, most essential tests with coverage
cd src/praisonai && python -m pytest tests/unit/test_core_agents.py -v --tb=short --disable-warnings --cov=praisonai --cov-report=xml --cov-branch
- name: Run Real API Tests
run: |
echo "🔑 Running real API tests with actual OpenAI API key..."
cd src/praisonai && python -m pytest tests/test_agents_playbook.py -v --tb=short --disable-warnings -m real
continue-on-error: true
- name: Run E2E Real Tests
run: |
echo "🧪 Running E2E real tests..."
cd src/praisonai && python -m pytest tests/e2e/ -v --tb=short --disable-warnings -m real
continue-on-error: true
- name: Run Legacy Example Tests
run: |
cd src/praisonai && python -m pytest tests/test.py -v --tb=short --disable-warnings -m "not real" --timeout=60
continue-on-error: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: src/praisonai/coverage.xml
flags: quick-validation
name: quick-validation-coverage
fail_ci_if_error: false
verbose: true
- name: Restore Root Config Files
run: |
echo "🔄 Restoring root configuration files..."
if [ -f "agents.yaml.backup" ]; then
mv agents.yaml.backup agents.yaml
echo "✅ Restored agents.yaml"
fi
if [ -f "tools.py.backup" ]; then
mv tools.py.backup tools.py
echo "✅ Restored tools.py"
fi
if: always() # Always run this step, even if previous steps failed
+57
View File
@@ -0,0 +1,57 @@
name: Update API Reference
on:
push:
branches: [ "main" ]
paths:
- 'src/praisonai-agents/praisonaiagents/**/*.py'
- 'src/praisonai/praisonai/**/*.py'
- 'src/praisonai-ts/src/**/*.ts'
- '.github/workflows/update-api-md.yml'
permissions:
contents: write
jobs:
update-api-md:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
persist-credentials: true
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Generate api.md
run: |
cd $GITHUB_WORKSPACE
python3 src/praisonai/scripts/generate_api_md.py
- name: Check for changes
id: check_changes
run: |
if git diff --quiet api.md; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes to api.md"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "api.md has been updated"
git diff api.md | head -50
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto-update api.md [skip ci]"
file_pattern: 'api.md'
commit_user_name: "MervinPraison"
commit_user_email: "[email protected]"
commit_author: "MervinPraison <[email protected]>"
+83
View File
@@ -0,0 +1,83 @@
name: Update Documentation Parity Tracker
on:
push:
branches: [ "main" ]
paths:
- 'src/praisonai-agents/praisonaiagents/**/*.py'
- 'src/praisonai-ts/src/**/*.ts'
- 'src/praisonai-rust/src/**/*.rs'
- 'src/praisonai/praisonai/_dev/parity/**/*.py'
- '.github/workflows/update-docs-parity.yml'
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
update-docs-parity:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
persist-credentials: true
fetch-depth: 0
- name: Checkout PraisonAIDocs
id: checkout_docs
continue-on-error: true
uses: actions/checkout@v4
with:
repository: MervinPraison/PraisonAIDocs
path: PraisonAIDocs
token: ${{ secrets.SECRETS_ADMIN_PAT }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install pyyaml
- name: Generate docs parity trackers
if: steps.checkout_docs.outcome == 'success'
run: |
cd $GITHUB_WORKSPACE
python3 src/praisonai/scripts/generate_docs_parity.py --docs-root PraisonAIDocs/docs --copy-docs
- name: Check for changes
id: check_changes
run: |
if git diff --quiet src/praisonai-agents/DOCS_PARITY.md src/praisonai-ts/DOCS_PARITY.md src/praisonai-rust/DOCS_PARITY.md 2>/dev/null; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes to docs parity trackers"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Docs parity trackers have been updated"
git diff --stat src/praisonai-agents/DOCS_PARITY.md src/praisonai-ts/DOCS_PARITY.md src/praisonai-rust/DOCS_PARITY.md
fi
- name: Commit and push changes to praisonai-package
if: steps.check_changes.outputs.changes == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto-update documentation parity trackers [skip ci]"
file_pattern: 'src/praisonai-agents/DOCS_PARITY.md src/praisonai-ts/DOCS_PARITY.md src/praisonai-rust/DOCS_PARITY.md'
commit_user_name: "MervinPraison"
commit_user_email: "[email protected]"
commit_author: "MervinPraison <[email protected]>"
- name: Commit and push changes to PraisonAIDocs
if: steps.check_changes.outputs.changes == 'true' && steps.checkout_docs.outcome == 'success'
run: |
cd PraisonAIDocs
git config user.name "MervinPraison"
git config user.email "[email protected]"
git add docs/features/DOCS_PARITY.md docs/js/DOCS_PARITY.md docs/rust/DOCS_PARITY.md
git diff --staged --quiet || git commit -m "docs: auto-update documentation parity trackers [skip ci]"
git push
@@ -0,0 +1,61 @@
name: Update Feature Parity Tracker
on:
push:
branches: [ "main" ]
paths:
- 'src/praisonai-agents/praisonaiagents/**/*.py'
- 'src/praisonai-ts/src/**/*.ts'
- 'src/praisonai-rust/src/**/*.rs'
- '.github/workflows/update-parity-tracker.yml'
permissions:
contents: write
jobs:
update-parity-tracker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
persist-credentials: true
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install pyyaml
- name: Generate parity trackers
run: |
cd $GITHUB_WORKSPACE
python3 src/praisonai/scripts/generate_parity_tracker.py
- name: Check for changes
id: check_changes
run: |
if git diff --quiet src/praisonai-ts/FEATURE_PARITY_TRACKER.json src/praisonai-ts/PARITY.md src/praisonai-rust/FEATURE_PARITY_TRACKER.json src/praisonai-rust/PARITY.md 2>/dev/null; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes to parity trackers"
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "Parity trackers have been updated"
git diff src/praisonai-ts/FEATURE_PARITY_TRACKER.json | head -50
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto-update feature parity trackers [skip ci]"
file_pattern: 'src/praisonai-ts/FEATURE_PARITY_TRACKER.json src/praisonai-ts/PARITY.md src/praisonai-rust/FEATURE_PARITY_TRACKER.json src/praisonai-rust/PARITY.md'
commit_user_name: "MervinPraison"
commit_user_email: "[email protected]"
commit_author: "MervinPraison <[email protected]>"
+18 -1
View File
@@ -20,6 +20,8 @@ watch.sh
docs.sh
other
output
!src/praisonai/praisonai/cli/output/
!src/praisonai-agents/praisonaiagents/output/
.files
threads.db
@@ -80,4 +82,19 @@ CopilotKit*
issue_details.json
# MCP Registry tokens
.mcpregistry_*
.mcpregistry_*
*.log
.internal
.praisonai
# Rust / Cargo
target/
Cargo.lock
**/*.rs.bk
*.pdb
.windsurf
.agent
src/praisonai/build*.egg-info/
src/praisonai/PraisonAI.egg-info/
+730 -2305
View File
File diff suppressed because it is too large. Load diff
+1200
View File
File diff suppressed because it is too large. Load diff
+6
View File
@@ -13,6 +13,12 @@ GOOGLE_API_KEY=your_google_api_key_here
GROQ_API_KEY=your_groq_api_key_here
COHERE_API_KEY=your_cohere_api_key_here
# Bot Tokens (for messaging bot services)
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_APP_TOKEN=xapp-your-slack-app-token
DISCORD_BOT_TOKEN=your-discord-bot-token
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
# Optional: Service Configuration
FLASK_ENV=development
CHAINLIT_HOST=0.0.0.0
+1 -1
View File
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
# Install Python packages (using latest versions)
RUN pip install --no-cache-dir \
praisonai_tools \
"praisonai>=2.3.63" \
"praisonai>=4.5.112" \
"praisonai[chat]" \
"embedchain[github,youtube]"
+61
View File
@@ -0,0 +1,61 @@
# PraisonAI 🦞 Claw — All-in-one: dashboard + bots + gateway + agents
#
# Build: docker build -f docker/Dockerfile.claw -t praisonai:claw ..
# Run: docker run -p 8082:8082 -e OPENAI_API_KEY=sk-xxx praisonai:claw
# Health: curl http://localhost:8082/health
#
# Override CMD for other modes:
# Bot: docker run -e ... praisonai:claw praisonai bot telegram
# Gateway: docker run -e ... praisonai:claw praisonai gateway start
# Serve: docker run -e ... praisonai:claw praisonai serve agents.yaml
# Shell: docker run --rm -it praisonai:claw bash
FROM python:3.12-slim AS base
# ── Environment ──────────────────────────────────────────────────────────────
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
AIUI_PORT=8082 \
AIUI_HOST=0.0.0.0 \
AIUI_DATA_DIR=/data
WORKDIR /app
# ── System dependencies ─────────────────────────────────────────────────────
# tini: PID 1 signal handling (graceful shutdown on Fly/Railway/k8s)
# curl: HEALTHCHECK probe
# build-essential: compile native Python wheels (chromadb, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
tini \
curl \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# ── Install PraisonAI 🦞 ────────────────────────────────────────────────────
# Single command installs: AIUI dashboard, agents SDK (memory/knowledge/llm/mcp),
# bot channels (Telegram/Discord/Slack), gateway, search tools, and more.
RUN pip install --no-cache-dir "praisonai[claw]"
# ── Data volume ──────────────────────────────────────────────────────────────
# Persistence for sessions, config, memory, knowledge stores
RUN mkdir -p /data
VOLUME /data
# ── Entrypoint ───────────────────────────────────────────────────────────────
# Ensures /data exists and forwards all signals via tini
RUN printf '#!/bin/sh\n\
set -e\n\
mkdir -p /data 2>/dev/null || true\n\
exec "$@"\n' > /usr/local/bin/entrypoint.sh \
&& chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 8082
# ── Health check ─────────────────────────────────────────────────────────────
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl -f http://localhost:8082/health || exit 1
# ── Run ──────────────────────────────────────────────────────────────────────
# Default: AIUI dashboard via praisonai claw. Override CMD for bot/gateway/serve.
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"]
CMD ["praisonai", "claw", "--port", "8082"]
+1 -1
View File
@@ -20,7 +20,7 @@ RUN mkdir -p /root/.praison
# Install Python packages (using latest versions)
RUN pip install --no-cache-dir \
praisonai_tools \
"praisonai>=2.3.63" \
"praisonai>=4.5.112" \
"praisonai[ui]" \
"praisonai[chat]" \
"praisonai[realtime]" \
+1 -1
View File
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
# Install Python packages (using latest versions)
RUN pip install --no-cache-dir \
praisonai_tools \
"praisonai>=2.3.63" \
"praisonai>=4.5.112" \
"praisonai[ui]" \
"praisonai[crewai]"
+15
View File
@@ -0,0 +1,15 @@
# Bot Environment Variables
# Copy to .env and fill in your values
# Required: LLM API Key
OPENAI_API_KEY=your_openai_api_key_here
# Slack Bot (Socket Mode)
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_APP_TOKEN=xapp-your-slack-app-token
# Discord Bot
DISCORD_BOT_TOKEN=your-discord-bot-token
# Telegram Bot
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
+42
View File
@@ -0,0 +1,42 @@
# Dockerfile for PraisonAI Slack Bot
# Secrets are passed at runtime via environment variables
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Create praison config directory
RUN mkdir -p /root/.praison
# Install praisonai with bot dependencies
RUN pip install --no-cache-dir \
praisonai \
slack-bolt \
slack-sdk \
"discord.py>=2.0.0" \
"python-telegram-bot>=20.0"
# Set environment variables for directory management
ENV PRAISON_CONFIG_DIR=/root/.praison
ENV DOCKER_CONTAINER=true
# Bot tokens should be passed at runtime (not baked into image)
# SLACK_BOT_TOKEN=xoxb-...
# SLACK_APP_TOKEN=xapp-...
# Optional: Copy custom agent configuration
# COPY agent.yaml /app/agent.yaml
# Expose no ports - Socket Mode doesn't need them
# For webhook mode, expose port 3000
# Default command - tokens from environment
CMD ["praisonai", "bot", "slack"]
+66
View File
@@ -0,0 +1,66 @@
# PraisonAI Bot Docker Deployment
Deploy Slack, Discord, or Telegram bots using Docker.
## Quick Start
```bash
# 1. Copy environment template
cp .env.template .env
# 2. Edit .env with your tokens
nano .env
# 3. Run specific bot
docker compose up slack-bot -d
# Or run all bots
docker compose up -d
```
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `OPENAI_API_KEY` | Yes | LLM API key |
| `SLACK_BOT_TOKEN` | For Slack | Bot token (xoxb-...) |
| `SLACK_APP_TOKEN` | For Slack | App token (xapp-...) |
| `DISCORD_BOT_TOKEN` | For Discord | Bot token |
| `TELEGRAM_BOT_TOKEN` | For Telegram | Bot token |
## Slack Setup
1. Create app at https://api.slack.com/apps
2. Enable **Socket Mode** → Generate App-Level Token with `connections:write`
3. Add **OAuth Scopes**: `chat:write`, `app_mentions:read`, `im:history`
4. Enable **Event Subscriptions** → Subscribe to `app_mention`, `message.im`
5. **Install to Workspace**
6. Copy Bot Token and App Token to `.env`
## Commands
```bash
# Start Slack bot
docker compose up slack-bot -d
# View logs
docker compose logs -f slack-bot
# Stop bot
docker compose down slack-bot
# Rebuild after updates
docker compose build --no-cache slack-bot
```
## Custom Agent Configuration
Mount your agent config:
```yaml
services:
slack-bot:
volumes:
- ./agent.yaml:/app/agent.yaml
command: ["praisonai", "bot", "slack", "--agent", "/app/agent.yaml"]
```
+53
View File
@@ -0,0 +1,53 @@
version: '3.8'
# PraisonAI Bot Services
# Run specific bots: docker compose up slack-bot
# Run all bots: docker compose up
services:
# Slack Bot
slack-bot:
build:
context: ../..
dockerfile: docker/bots/Dockerfile
volumes:
- praison_data:/root/.praison
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_APP_TOKEN: ${SLACK_APP_TOKEN}
PRAISON_CONFIG_DIR: /root/.praison
command: [ "praisonai", "bot", "slack" ]
restart: unless-stopped
# Discord Bot
discord-bot:
build:
context: ../..
dockerfile: docker/bots/Dockerfile
volumes:
- praison_data:/root/.praison
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
PRAISON_CONFIG_DIR: /root/.praison
command: [ "praisonai", "bot", "discord" ]
restart: unless-stopped
# Telegram Bot
telegram-bot:
build:
context: ../..
dockerfile: docker/bots/Dockerfile
volumes:
- praison_data:/root/.praison
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
PRAISON_CONFIG_DIR: /root/.praison
command: [ "praisonai", "bot", "telegram" ]
restart: unless-stopped
volumes:
praison_data:
driver: local
+30 -4
View File
@@ -1,6 +1,29 @@
version: '3.8'
services:
# PraisonAI 🦞 Claw — Recommended all-in-one service
claw:
build:
context: ..
dockerfile: docker/Dockerfile.claw
volumes:
- claw_data:/data
ports:
- "8082:8082"
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
restart: unless-stopped
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8082/health" ]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3
networks:
- praison_network
# ─── Legacy services (kept for backward compatibility) ─────────────────
# PraisonAI UI Service
ui:
build:
@@ -22,7 +45,7 @@ services:
CHAINLIT_DB_DIR: /root/.praison
command: praisonai ui --host 0.0.0.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8082"]
test: [ "CMD", "curl", "-f", "http://localhost:8082" ]
interval: 10s
timeout: 5s
retries: 3
@@ -49,7 +72,7 @@ services:
CHAINLIT_DB_DIR: /root/.praison
command: praisonai chat --host 0.0.0.0 --port 8083
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8083"]
test: [ "CMD", "curl", "-f", "http://localhost:8083" ]
interval: 10s
timeout: 5s
retries: 3
@@ -69,7 +92,7 @@ services:
OPENAI_API_KEY: ${OPENAI_API_KEY}
PRAISON_CONFIG_DIR: /root/.praison
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
test: [ "CMD", "curl", "-f", "http://localhost:8080/health" ]
interval: 10s
timeout: 5s
retries: 3
@@ -89,11 +112,14 @@ services:
PRAISON_CONFIG_DIR: /root/.praison
networks:
- praison_network
# For bot services (Slack, Discord, Telegram), see docker/bots/
volumes:
claw_data:
driver: local
praison_data:
driver: local
networks:
praison_network:
driver: bridge
driver: bridge
+34
View File
@@ -14,6 +14,7 @@ examples/
│ ├── memory/ # Memory and sessions
│ ├── code/ # Code editing and external CLI tools
│ └── ...
├── serve/ # Server and endpoints examples
├── yaml/ # YAML workflow examples
└── cookbooks/ # Complete use-case examples
```
@@ -22,6 +23,7 @@ examples/
| Category | Examples | Docs |
|----------|----------|------|
| **Consolidated Params** | [consolidated_params/](consolidated_params/) | [📖](https://docs.praison.ai/api/consolidated-params) |
| **Agents** | [python/agents/](python/agents/) | [📖](https://docs.praison.ai/concepts/agents) |
| **Workflows** | [python/workflows/](python/workflows/) | [📖](https://docs.praison.ai/features/workflows) |
| **Model Router** | [python/agents/router-agent-cost-optimization.py](python/agents/router-agent-cost-optimization.py) | [📖](https://docs.praison.ai/features/model-router) |
@@ -30,6 +32,38 @@ examples/
| **Tools** | [python/tools/](python/tools/) | [📖](https://docs.praison.ai/tools) |
| **Code** | [python/code/](python/code/) | [📖](https://docs.praison.ai/code) |
| **YAML** | [yaml/](yaml/) | [📖](https://docs.praison.ai/features/yaml-workflows) |
| **Doctor** | [doctor/](doctor/) | [📖](https://docs.praison.ai/cli/doctor) |
| **Serve** | [serve/](serve/) | [📖](https://docs.praison.ai/cli/serve) |
| **Endpoints** | [serve/](serve/) | [📖](https://docs.praison.ai/cli/endpoints) |
## Consolidated Params Examples
Agent-centric API with unified parameter resolution. Precedence: Instance > Config > Array > Dict > String > Bool > Default
| Example | Description |
|---------|-------------|
| [basic_agent.py](consolidated_params/basic_agent.py) | Minimal agent with memory |
| [basic_agents.py](consolidated_params/basic_agents.py) | Multi-agent with memory+planning |
| [basic_workflow.py](consolidated_params/basic_workflow.py) | Workflow with consolidated params |
| [basic_memory.py](consolidated_params/basic_memory.py) | Memory presets (file, redis, postgres) |
| [basic_guardrails.py](consolidated_params/basic_guardrails.py) | Guardrails with callable or config |
| [basic_workflow_agentlike.py](consolidated_params/basic_workflow_agentlike.py) | Workflow with agent-like params |
| [basic_step_override.py](consolidated_params/basic_step_override.py) | Step-level override of workflow defaults |
| [advanced_workflow_full_features.py](consolidated_params/advanced_workflow_full_features.py) | All consolidated params |
## Serve Examples
| Example | Description | CLI Command |
|---------|-------------|-------------|
| [unified_server.py](serve/unified_server.py) | All providers in one server | `praisonai serve unified` |
| [agent_as_api_single.py](serve/agent_as_api_single.py) | Single agent HTTP API | `praisonai serve agents` |
| [agents_as_api_router.py](serve/agents_as_api_router.py) | Multi-agent router API | `praisonai serve agents` |
| [a2a_server_client.py](serve/a2a_server_client.py) | A2A protocol server | `praisonai serve a2a` |
| [a2u_events_stream.py](serve/a2u_events_stream.py) | A2U event stream | `praisonai serve a2u` |
| [mcp_http_server.py](serve/mcp_http_server.py) | MCP HTTP server | `praisonai serve mcp` |
| [tools_as_mcp_server.py](serve/tools_as_mcp_server.py) | Tools as MCP server | `praisonai serve tools` |
| [agent_launch_modes.py](serve/agent_launch_modes.py) | Agent.launch() API | Python only |
| [endpoints_unified_client.py](serve/endpoints_unified_client.py) | Unified client | `praisonai endpoints` |
## Running Examples
+137
View File
@@ -0,0 +1,137 @@
# ACP (Agent Client Protocol) Examples
This directory contains examples for using PraisonAI with the Agent Client Protocol (ACP).
## What is ACP?
The Agent Client Protocol (ACP) is a standardized JSON-RPC 2.0 protocol that allows code editors and IDEs to communicate with AI coding agents. It enables seamless integration between PraisonAI and editors like:
- **Zed**
- **JetBrains IDEs** (IntelliJ, PyCharm, WebStorm, etc.)
- **VSCode** (via extensions)
- **Toad**
## Quick Start
### CLI Usage
```bash
# Start ACP server with defaults
praisonai acp
# Enable debug logging
praisonai acp --debug
# Allow file writes
praisonai acp --allow-write
# Use a specific model
praisonai acp -m gpt-4o
# Resume last session
praisonai acp --resume --last
```
### Python API
```python
from praisonai.acp import serve
serve(
workspace=".",
debug=True,
allow_write=True,
)
```
## Editor Configuration
### Zed
Add to `~/.config/zed/settings.json`:
```json
{
"agent_servers": {
"PraisonAI": {
"command": "praisonai",
"args": ["acp"],
"env": {}
}
}
}
```
### JetBrains
Add to `~/.jetbrains/acp.json`:
```json
{
"agent_servers": {
"PraisonAI": {
"command": "praisonai",
"args": ["acp"],
"env": {}
}
}
}
```
### Toad
```bash
toad acp "praisonai acp"
```
## Examples
- `basic_acp_server.py` - Simple ACP server with default settings
- `custom_agent_acp.py` - ACP server with a custom agent
## CLI Options
| Option | Description |
|--------|-------------|
| `-w, --workspace` | Workspace root directory |
| `-a, --agent` | Agent name or config file |
| `-m, --model` | LLM model to use |
| `-r, --resume` | Resume session by ID |
| `--last` | Resume the last session |
| `--approve` | Approval mode: manual, auto, scoped |
| `--read-only` | Read-only mode (default) |
| `--allow-write` | Allow file writes |
| `--allow-shell` | Allow shell commands |
| `--debug` | Enable debug logging |
## Installation
```bash
pip install praisonai[acp]
```
## Protocol Details
ACP uses JSON-RPC 2.0 over stdio:
- **stdin**: Receives JSON-RPC requests from the client
- **stdout**: Sends JSON-RPC responses to the client
- **stderr**: Debug/log output (never pollutes stdout)
### Supported Methods
**Agent Methods (client → agent):**
- `initialize` - Negotiate protocol version and capabilities
- `authenticate` - Optional authentication
- `session/new` - Create a new session
- `session/load` - Load an existing session
- `session/prompt` - Send user message
- `session/cancel` - Cancel ongoing operations
- `session/set_mode` - Change operating mode
**Client Methods (agent → client):**
- `session/update` - Send progress updates
- `session/request_permission` - Request user approval
- `fs/read_text_file` - Read file contents
- `fs/write_text_file` - Write file contents
- `terminal/create` - Create terminal
- `terminal/output` - Get terminal output
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""
Basic ACP Server Example
This example demonstrates how to run PraisonAI as an ACP server
that can be connected to by IDEs like Zed, JetBrains, VSCode, or Toad.
Usage:
# Run from command line
praisonai acp
# Or run this script directly
python basic_acp_server.py
"""
from praisonai.acp import serve
if __name__ == "__main__":
# Start ACP server with default settings
# This will listen on stdin/stdout for JSON-RPC messages
serve(
workspace=".", # Current directory as workspace
agent="default", # Use default agent
debug=False, # Set to True for debug logging to stderr
read_only=True, # Safe by default
approval_mode="manual", # Require approval for actions
)
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""
Custom Agent ACP Server Example
This example shows how to run a custom PraisonAI agent as an ACP server.
Usage:
python custom_agent_acp.py
"""
from praisonai.acp import serve, ACPServer, ACPConfig
from praisonaiagents import Agent
# Create a custom agent
agent = Agent(
name="CodeAssistant",
instructions="""You are an expert coding assistant. You help users:
- Write clean, efficient code
- Debug issues
- Explain complex concepts
- Review code for best practices
Always provide clear explanations with your code suggestions.""",
model="gpt-4o-mini",
)
if __name__ == "__main__":
# Create config
config = ACPConfig(
workspace=".",
debug=True,
allow_write=True, # Allow file modifications
approval_mode="manual",
)
# Create server with custom agent
server = ACPServer(config=config, agent=agent)
# Run the server
serve(
workspace=".",
debug=True,
allow_write=True,
approval_mode="manual",
)
+30
View File
@@ -0,0 +1,30 @@
framework: ag2
topic: "Research the latest developments in AI agents"
# Install: pip install "praisonai[ag2]"
# Run: praisonai --framework ag2 examples/ag2/ag2_basic.yaml
# or praisonai run examples/ag2/ag2_basic.yaml --framework ag2
roles:
research_agent:
role: "AI Research Specialist"
goal: "Research and summarise the latest developments in AI agent frameworks"
backstory: |
You are an experienced AI researcher with deep knowledge of multi-agent
systems, large language models, and the latest trends in AI tooling.
You excel at synthesising complex technical topics into clear summaries.
tasks:
research_task:
description: |
Research and summarise the latest developments in AI agent frameworks
for the topic: {topic}
Focus on:
1. Key frameworks and their unique capabilities
2. Recent innovations and improvements
3. Community adoption and ecosystem growth
4. Practical use cases and success stories
expected_output: |
A concise research summary covering the key developments,
major frameworks, and practical insights. Include 3-5 bullet
points of the most important findings.
+42
View File
@@ -0,0 +1,42 @@
framework: ag2
topic: "Cloud-native AI deployment strategies on AWS"
# AG2 exclusive feature: native AWS Bedrock support via LLMConfig(api_type="bedrock")
#
# Prerequisites:
# pip install "praisonai[ag2]"
# aws configure (or set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION)
#
# Run:
# praisonai --framework ag2 examples/ag2/ag2_bedrock.yaml
#
# The AG2 adapter detects api_type="bedrock" from the llm config and uses
# LLMConfig(api_type="bedrock", model=...) — no OPENAI_API_KEY required.
# AWS credentials are sourced from boto3 (env vars, ~/.aws/credentials, IAM role).
roles:
cloud_architect:
role: "AWS Cloud Architect"
goal: "Design and explain cloud-native AI deployment strategies on AWS"
backstory: |
You are an AWS Solutions Architect specialising in AI/ML workloads.
You have deep expertise in Amazon Bedrock, SageMaker, ECS, and Lambda,
and you help organisations deploy AI agents at scale securely and cost-effectively.
llm:
model: "bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0"
api_type: "bedrock"
aws_region: "us-east-1"
tasks:
architecture_task:
description: |
Design a cloud-native deployment strategy for AI agents on AWS for: {topic}
Cover:
1. Recommended AWS services (Bedrock, ECS, Lambda, etc.)
2. Scalability and cost optimisation patterns
3. Security and compliance considerations
4. A simple reference architecture overview
expected_output: |
A concise architecture guide with service recommendations,
a high-level deployment diagram description, and key
best practices for production AI agent deployments on AWS.
+54
View File
@@ -0,0 +1,54 @@
framework: ag2
topic: "The impact of open-source AI on enterprise software development"
# Install: pip install "praisonai[ag2]"
# Run: praisonai --framework ag2 examples/ag2/ag2_multi_agent.yaml
# or praisonai run examples/ag2/ag2_multi_agent.yaml --framework ag2
#
# This example demonstrates AG2's GroupChat multi-agent coordination.
# Both agents participate in a collaborative conversation managed by
# a GroupChatManager until the task is complete.
roles:
researcher:
role: "Research Specialist"
goal: "Gather and analyse information on the given topic"
backstory: |
You are a meticulous researcher who excels at finding relevant
information, analysing trends, and presenting data-backed insights.
You always cite your reasoning and structure your findings clearly.
tasks:
research_task:
description: |
Research the topic: {topic}
Investigate:
1. Current state and adoption rates
2. Key players and projects driving the trend
3. Technical advantages and challenges
4. Business impact and cost implications
expected_output: |
A structured research briefing with findings on the topic,
including key data points, trends, and technical observations.
writer:
role: "Technical Content Writer"
goal: "Transform research findings into clear, engaging written content"
backstory: |
You are a skilled technical writer who turns complex research into
accessible, well-structured articles. You focus on clarity, logical
flow, and actionable takeaways for a professional audience.
tasks:
writing_task:
description: |
Using the research findings provided by the Research Specialist,
write a concise article on: {topic}
The article should:
1. Open with a compelling hook
2. Present key findings logically
3. Include practical implications for developers
4. Close with a forward-looking conclusion
expected_output: |
A 400-500 word article suitable for a technical blog,
with clear sections, professional tone, and concrete takeaways.
+244
View File
@@ -0,0 +1,244 @@
"""
Agent-Centric API Example
Demonstrates the consolidated feature parameters for PraisonAI Agents.
These params provide a cleaner, more intuitive API with progressive disclosure.
Precedence Rule: Instance > Config > Array > String > Bool > Default
Consolidated Params Support:
- memory: bool | str URL | str preset | [preset, overrides] | MemoryConfig | Instance
- knowledge: bool | str path | [sources...] | KnowledgeConfig | Instance
- planning: bool | str LLM | [preset, overrides] | PlanningConfig
- reflection: bool | str preset | [preset, overrides] | ReflectionConfig
- guardrails: bool | callable | str prompt | GuardrailConfig
- web: bool | str provider | [provider, overrides] | WebConfig
- output: str preset | [preset, overrides] | OutputConfig
- execution: str preset | [preset, overrides] | ExecutionConfig
"""
from praisonaiagents import (
Agent,
# Config classes for progressive disclosure
MemoryConfig,
KnowledgeConfig,
PlanningConfig,
ReflectionConfig,
GuardrailConfig,
WebConfig,
)
def example_simple_enable():
"""Example 1: Simple boolean enable (easiest)"""
print("\n=== Example 1: Simple Boolean Enable ===")
agent = Agent(
instructions="You are a helpful assistant",
memory=True, # Enable memory with defaults
reflection=True, # Enable self-reflection
web=WebConfig(fetch=False), # Enable web search + fetch
)
print(f"Agent created with memory={agent._memory_instance is not None}")
print(f" self_reflect={agent.self_reflect}")
print(f" web_search={agent.web_search}")
def example_with_config():
"""Example 2: Using config objects (more control)"""
print("\n=== Example 2: Using Config Objects ===")
agent = Agent(
instructions="You are a research assistant",
memory=MemoryConfig(
backend="file",
user_id="researcher_001",
auto_memory=True,
),
reflection=ReflectionConfig(
min_iterations=1,
max_iterations=5,
llm="gpt-4o-mini",
),
web=WebConfig(
search=True,
fetch=False, # Only search, no full page fetch
max_results=3,
),
)
print(f"Agent created with user_id={agent.user_id}")
print(f" {agent.max_reflect}")
print(f" web_search={agent.web_search}, web_fetch={agent.web_fetch}")
def example_guardrails():
"""Example 3: Guardrails with callable or config"""
print("\n=== Example 3: Guardrails ===")
# Option A: Direct callable
def my_validator(output):
"""Simple validator that checks response length."""
is_valid = len(output.raw) < 1000
return (is_valid, output if is_valid else "Response too long")
agent_a = Agent(
instructions="Be concise",
guardrails=my_validator, # Direct callable
)
print(f"Agent A: guardrail is callable = {callable(agent_a.guardrail)}")
# Option B: Using GuardrailConfig
agent_b = Agent(
instructions="Be helpful and safe",
guardrails=GuardrailConfig(
llm_validator="Ensure the response is helpful, accurate, and safe",
max_retries=3,
),
)
print(f"Agent B: guardrail = {agent_b.guardrail}")
print(f" max_retries = {agent_b.max_guardrail_retries}")
def example_planning():
"""Example 4: Planning mode"""
print("\n=== Example 4: Planning Mode ===")
agent = Agent(
instructions="You are a project planner",
planning=PlanningConfig(
reasoning=True,
read_only=True, # Plan mode - only read operations
),
)
print(f"Agent created with planning={agent.planning}")
print(f" plan_mode={agent.plan_mode}")
print(f" planning_reasoning={agent.planning_reasoning}")
def example_backward_compatible():
"""Example 5: Using new consolidated params"""
print("\n=== Example 5: Consolidated Params ===")
# New consolidated params
agent = Agent(
instructions="Test agent",
reflection=True,
web=WebConfig(search=True, fetch=False),
)
print(f"Consolidated params work: self_reflect={agent.self_reflect}")
print(f" web_search={agent.web_search}, web_fetch={agent.web_fetch}")
def example_real_chat():
"""Example 6: Real chat with new API"""
print("\n=== Example 6: Real Chat ===")
agent = Agent(
instructions="You are a helpful math tutor. Be concise.",
reflection=False,
web=False,
)
response = agent.start("What is the square root of 144?")
print(f"Response: {response}")
def example_string_presets():
"""Example 7: String presets (NEW - user-friendly shortcuts)"""
print("\n=== Example 7: String Presets ===")
# Output presets: minimal, normal, verbose, debug, silent
agent = Agent(
instructions="You are a verbose assistant",
output="verbose", # String preset for output
execution="fast", # String preset for execution
web=["tavily", {"fetch": False}], # String preset with override for web provider
)
print(f"Output preset 'verbose': verbose={agent.verbose}, metrics={agent.metrics}")
print(f"Execution preset 'fast': max_iter={agent.max_iter}")
print(f"Web preset 'tavily': web_search={agent.web_search}")
def example_array_overrides():
"""Example 8: Array with overrides (NEW - preset + customization)"""
print("\n=== Example 8: Array Overrides ===")
# Array format: [preset, {overrides}]
agent = Agent(
instructions="You are a streaming assistant",
output=["verbose", {"stream": True}], # Verbose preset + enable streaming
execution=["fast", {"max_iter": 15}], # Fast preset + custom max_iter
)
print(f"Output array override: verbose={agent.verbose}, stream={agent.stream}")
print(f"Execution array override: max_iter={agent.max_iter}")
def example_url_parsing():
"""Example 9: URL parsing for memory (NEW - connection strings)"""
print("\n=== Example 9: URL Parsing ===")
# Memory supports URL connection strings
# Supported: postgresql://, redis://, sqlite:///, mongodb://
agent = Agent(
instructions="You are a database-backed assistant",
memory="postgresql://postgres:password@localhost:5432/praisonai",
)
print("Memory URL parsed: memory enabled")
# Also works with presets
agent2 = Agent(
instructions="You are a redis-backed assistant",
memory="redis", # Preset name
)
print("Memory preset 'redis': configured")
def example_knowledge_sources():
"""Example 10: Knowledge with sources (list and string)"""
print("\n=== Example 10: Knowledge Sources ===")
# Single path string
agent1 = Agent(
instructions="You are a document assistant",
knowledge="docs/", # Single path
)
print(f"Knowledge single path: knowledge={agent1.knowledge}")
# List of sources
agent2 = Agent(
instructions="You are a multi-source assistant",
knowledge=["docs/", "data.pdf", "https://example.com/api"],
)
print(f"Knowledge list: knowledge={agent2.knowledge}")
# With config for advanced settings
agent3 = Agent(
instructions="You are an advanced RAG assistant",
knowledge=KnowledgeConfig(
sources=["docs/"],
retrieval_k=10,
rerank=True,
),
)
print("Knowledge config: configured with rerank")
if __name__ == "__main__":
print("=" * 60)
print("PraisonAI Agent-Centric API Examples")
print("=" * 60)
example_simple_enable()
example_with_config()
example_guardrails()
example_planning()
example_backward_compatible()
example_real_chat()
example_string_presets()
example_array_overrides()
example_url_parsing()
example_knowledge_sources()
print("\n" + "=" * 60)
print("All examples completed!")
print("=" * 60)
@@ -0,0 +1,135 @@
"""
Agent-Centric Tools Example
This example demonstrates how to use LSP/ACP-powered tools that make
the Agent the central orchestrator for file operations.
How to run:
export OPENAI_API_KEY=your_key
python examples/agent_tools/agent_centric_example.py
Prerequisites:
pip install praisonai praisonaiagents
"""
import asyncio
import os
import sys
import tempfile
import shutil
# Add paths for development
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../src/praisonai'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../src/praisonai-agents'))
async def main():
print("=" * 60)
print("AGENT-CENTRIC TOOLS EXAMPLE")
print("=" * 60)
print()
# Create temporary workspace
workspace = tempfile.mkdtemp(prefix="praisonai_example_")
print(f"Workspace: {workspace}")
print()
try:
# Import after path setup
from praisonai.cli.features import (
create_agent_centric_tools,
InteractiveRuntime,
RuntimeConfig
)
from praisonaiagents import Agent
# 1. Create runtime with ACP enabled
print("1. Creating InteractiveRuntime with ACP...")
config = RuntimeConfig(
workspace=workspace,
lsp_enabled=False, # Skip LSP for this example
acp_enabled=True,
approval_mode="auto" # Auto-approve for demo
)
runtime = InteractiveRuntime(config)
status = await runtime.start()
print(f" ACP ready: {runtime.acp_ready}")
print(f" Read-only: {runtime.read_only}")
print()
# 2. Create agent-centric tools
print("2. Creating agent-centric tools...")
tools = create_agent_centric_tools(runtime)
print(f" Tools created: {len(tools)}")
for tool in tools:
print(f" - {tool.__name__}")
print()
# 3. Create Agent with ACP-powered tools
print("3. Creating Agent with ACP-powered tools...")
agent = Agent(
name="FileAgent",
instructions="""You help create and manage files.
Use acp_create_file to create files.
Use read_file to read files.
Use list_files to list directory contents.""",
tools=tools,
output="verbose" # Use new consolidated param
)
print()
# 4. Ask agent to create a file
print("4. Asking agent to create a Python file...")
print("-" * 40)
result = agent.start(
"Create a Python file called calculator.py with add and subtract functions"
)
print("-" * 40)
print(f"Agent response: {result[:200]}..." if len(str(result)) > 200 else f"Agent response: {result}")
print()
# 5. Verify file was created
print("5. Verifying file creation...")
calc_path = os.path.join(workspace, "calculator.py")
if os.path.exists(calc_path):
print(f" ✓ File created at {calc_path}")
with open(calc_path) as f:
content = f.read()
print(f" Content preview:")
for line in content.split('\n')[:10]:
print(f" {line}")
else:
# Check what files exist
files = os.listdir(workspace)
print(f" Files in workspace: {files}")
for f in files:
fp = os.path.join(workspace, f)
if os.path.isfile(fp):
print(f" ✓ Found: {f}")
print()
# 6. Ask agent to read the file
print("6. Asking agent to read the file...")
print("-" * 40)
result2 = agent.start("Read the calculator.py file and tell me what functions it has")
print("-" * 40)
print(f"Agent response: {result2[:300]}..." if len(str(result2)) > 300 else f"Agent response: {result2}")
print()
# Cleanup
await runtime.stop()
finally:
# Clean up workspace
shutil.rmtree(workspace, ignore_errors=True)
print(f"Cleaned up workspace: {workspace}")
print()
print("=" * 60)
print("EXAMPLE COMPLETE")
print("=" * 60)
if __name__ == "__main__":
asyncio.run(main())
+31
View File
@@ -0,0 +1,31 @@
# Approval Examples
Minimal examples showing how to route tool-execution approvals through
different backends.
## Quick Start
```bash
pip install praisonaiagents praisonai[bot]
export OPENAI_API_KEY=sk-...
```
| Backend | Script | Extra env vars |
|----------|-----------------------|--------------------------------------------------|
| Slack | `slack_approval.py` | `SLACK_BOT_TOKEN`, `SLACK_CHANNEL` |
| Telegram | `telegram_approval.py`| `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID` |
| Discord | `discord_approval.py` | `DISCORD_BOT_TOKEN`, `DISCORD_CHANNEL_ID` |
| HTTP | `http_approval.py` | *(none — opens a local web dashboard)* |
| Agent | `agent_approval.py` | *(none — AI reviewer agent decides)* |
## SSL Verification
For corporate proxy / CA issues, Discord and Telegram backends support
optional SSL bypass:
```bash
export PRAISONAI_DISCORD_SSL_VERIFY=false
export PRAISONAI_TELEGRAM_SSL_VERIFY=false
```
Default is `true` (secure).
+26
View File
@@ -0,0 +1,26 @@
"""
Agent Approval Example
======================
Uses an AI agent as an automated reviewer to approve/deny tool calls.
Requires:
pip install praisonaiagents
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.approval import AgentApproval
from praisonaiagents.tools.shell_tools import execute_command
reviewer = AgentApproval(
instructions="Only approve read-only commands like 'ls' or 'cat'. Deny destructive commands.",
)
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=reviewer,
)
agent.start("List files in the current directory")
+24
View File
@@ -0,0 +1,24 @@
"""
Discord Approval Example
========================
Routes tool approvals to a Discord channel.
Requires:
pip install praisonaiagents praisonai[bot]
export DISCORD_BOT_TOKEN=MTIz...
export DISCORD_CHANNEL_ID=1234567890
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.tools.shell_tools import execute_command
from praisonai.bots import DiscordApproval
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=DiscordApproval(),
)
agent.start("List files in the current directory")
+22
View File
@@ -0,0 +1,22 @@
"""
HTTP Approval Example
=====================
Opens a local web dashboard for tool approvals.
Requires:
pip install praisonaiagents praisonai[bot]
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.tools.shell_tools import execute_command
from praisonai.bots import HTTPApproval
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=HTTPApproval(),
)
agent.start("List files in the current directory")
+24
View File
@@ -0,0 +1,24 @@
"""
Slack Approval Example
======================
Routes tool approvals to a Slack channel.
Requires:
pip install praisonaiagents praisonai[bot]
export SLACK_BOT_TOKEN=xoxb-...
export SLACK_CHANNEL=C0123456789
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.tools.shell_tools import execute_command
from praisonai.bots import SlackApproval
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=SlackApproval(),
)
agent.start("List files in the current directory")
+24
View File
@@ -0,0 +1,24 @@
"""
Telegram Approval Example
=========================
Routes tool approvals to a Telegram chat.
Requires:
pip install praisonaiagents praisonai[bot]
export TELEGRAM_BOT_TOKEN=123456:ABC-...
export TELEGRAM_CHAT_ID=987654321
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.tools.shell_tools import execute_command
from praisonai.bots import TelegramApproval
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=TelegramApproval(),
)
agent.start("List files in the current directory")
+35
View File
@@ -0,0 +1,35 @@
"""
Async Runs Examples
===================
This directory contains examples for the PraisonAI Async Jobs API.
Examples:
---------
1. sdk_submit_poll_result.py - Python SDK example for submit/poll/result
2. cli_submit_poll_result.sh - Bash/curl example for submit/poll/result
3. idempotency.sh - Demonstrates idempotency key usage
4. cancel.sh - Demonstrates job cancellation
5. sse_stream.sh - Demonstrates SSE streaming
Prerequisites:
--------------
1. Set OPENAI_API_KEY environment variable
2. Start the jobs server:
cd /path/to/praisonai-package/src/praisonai
python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factory
3. Run examples:
python sdk_submit_poll_result.py
bash cli_submit_poll_result.sh
bash idempotency.sh
bash cancel.sh
bash sse_stream.sh
Environment Variables:
----------------------
- OPENAI_API_KEY: Required for agent execution
- PRAISONAI_BASE_URL: API server URL (default: http://127.0.0.1:8005)
"""
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# CLI Example: Cancel a Running Job
#
# This example demonstrates how to cancel a running job.
#
# Requirements:
# - Jobs server running on http://127.0.0.1:8005
#
# Usage:
# bash cancel.sh
set -e
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
echo "============================================================"
echo "PraisonAI Job Cancellation Example"
echo "============================================================"
# Submit a long-running job
echo ""
echo "1. Submitting a job..."
RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs" \
-H "Content-Type: application/json" \
-d '{"prompt": "Write a detailed essay about the history of computing."}')
JOB_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
echo " Job ID: $JOB_ID"
# Wait briefly
echo ""
echo "2. Waiting 1 second..."
sleep 1
# Cancel the job
echo ""
echo "3. Cancelling job..."
CANCEL_RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs/$JOB_ID/cancel")
STATUS=$(echo "$CANCEL_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['status'])")
echo " Status after cancel: $STATUS"
# Verify cancellation
echo ""
echo "4. Verification:"
if [ "$STATUS" = "cancelled" ]; then
echo " ✓ SUCCESS: Job was cancelled"
else
echo " ℹ Job status: $STATUS (may have completed before cancel)"
fi
echo ""
echo "============================================================"
echo "Cancellation example completed!"
echo "============================================================"
@@ -0,0 +1,75 @@
#!/bin/bash
# CLI Example: Submit, Poll, and Get Result for Async Jobs
#
# This example demonstrates how to use the PraisonAI CLI to:
# 1. Submit an async job
# 2. Check job status
# 3. Get the result
#
# Requirements:
# - OPENAI_API_KEY environment variable set
# - Jobs server running on http://127.0.0.1:8005
#
# Usage:
# bash cli_submit_poll_result.sh
set -e
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
echo "============================================================"
echo "PraisonAI Async Jobs CLI Example"
echo "============================================================"
# Check if server is running
echo ""
echo "Checking server health..."
if ! curl -s "$API_URL/health" > /dev/null 2>&1; then
echo "✗ Server not available at $API_URL"
echo " Start the server with: python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factory"
exit 1
fi
echo "✓ Server is healthy"
# 1. Submit a job
echo ""
echo "1. Submitting job..."
RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs" \
-H "Content-Type: application/json" \
-d '{"prompt": "What is 2+2? Answer with just the number."}')
JOB_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
echo " Job ID: $JOB_ID"
# 2. Poll for status
echo ""
echo "2. Polling for status..."
while true; do
STATUS_RESPONSE=$(curl -s "$API_URL/api/v1/runs/$JOB_ID")
STATUS=$(echo "$STATUS_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['status'])")
PROGRESS=$(echo "$STATUS_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['progress']['percentage'])")
echo " Status: $STATUS | Progress: ${PROGRESS}%"
if [ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ] || [ "$STATUS" = "cancelled" ]; then
break
fi
sleep 2
done
# 3. Get result
echo ""
echo "3. Getting result..."
if [ "$STATUS" = "succeeded" ]; then
RESULT=$(curl -s "$API_URL/api/v1/runs/$JOB_ID/result")
echo " Result: $(echo "$RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['result'])")"
echo " Duration: $(echo "$RESULT" | python3 -c "import sys,json; print(f\"{json.load(sys.stdin)['duration_seconds']:.2f}s\")")"
else
echo " Job did not succeed: $STATUS"
fi
echo ""
echo "============================================================"
echo "Example completed!"
echo "============================================================"
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# CLI Example: Idempotency Key Usage
#
# This example demonstrates how idempotency keys prevent duplicate job submissions.
# Submitting the same request with the same idempotency key returns the existing job.
#
# Requirements:
# - Jobs server running on http://127.0.0.1:8005
#
# Usage:
# bash idempotency.sh
set -e
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
IDEM_KEY="example-idem-key-$(date +%s)"
echo "============================================================"
echo "PraisonAI Idempotency Key Example"
echo "============================================================"
# First submission
echo ""
echo "1. First submission with Idempotency-Key: $IDEM_KEY"
RESPONSE1=$(curl -s -X POST "$API_URL/api/v1/runs" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEM_KEY" \
-d '{"prompt": "What is 1+1?"}')
JOB_ID1=$(echo "$RESPONSE1" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
echo " Job ID: $JOB_ID1"
# Second submission with same key
echo ""
echo "2. Second submission with SAME Idempotency-Key: $IDEM_KEY"
RESPONSE2=$(curl -s -X POST "$API_URL/api/v1/runs" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEM_KEY" \
-d '{"prompt": "Different prompt but same key"}')
JOB_ID2=$(echo "$RESPONSE2" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
echo " Job ID: $JOB_ID2"
# Verify same job ID
echo ""
echo "3. Verification:"
if [ "$JOB_ID1" = "$JOB_ID2" ]; then
echo " ✓ SUCCESS: Same job ID returned (no duplicate created)"
else
echo " ✗ FAILURE: Different job IDs returned"
exit 1
fi
echo ""
echo "============================================================"
echo "Idempotency example completed!"
echo "============================================================"
@@ -0,0 +1,121 @@
#!/usr/bin/env python3
"""
SDK Example: Submit, Poll, and Get Result for Async Jobs
This example demonstrates how to use the PraisonAI Jobs SDK to:
1. Submit an async job
2. Poll for status
3. Get the result
Requirements:
- OPENAI_API_KEY environment variable set
- Jobs server running on http://127.0.0.1:8005
Usage:
python sdk_submit_poll_result.py
"""
import os
import time
import httpx
# Configuration
API_URL = os.getenv("PRAISONAI_BASE_URL", "http://127.0.0.1:8005")
POLL_INTERVAL = 2 # seconds
def submit_job(prompt: str, idempotency_key: str = None) -> dict:
"""Submit a job and return the response."""
headers = {}
if idempotency_key:
headers["Idempotency-Key"] = idempotency_key
with httpx.Client(timeout=30.0) as client:
response = client.post(
f"{API_URL}/api/v1/runs",
json={"prompt": prompt},
headers=headers if headers else None
)
response.raise_for_status()
return response.json()
def get_status(job_id: str) -> dict:
"""Get job status."""
with httpx.Client(timeout=30.0) as client:
response = client.get(f"{API_URL}/api/v1/runs/{job_id}")
response.raise_for_status()
return response.json()
def get_result(job_id: str) -> dict:
"""Get job result."""
with httpx.Client(timeout=30.0) as client:
response = client.get(f"{API_URL}/api/v1/runs/{job_id}/result")
response.raise_for_status()
return response.json()
def wait_for_completion(job_id: str, max_wait: int = 120) -> dict:
"""Poll until job completes."""
start = time.time()
while time.time() - start < max_wait:
status = get_status(job_id)
print(f" Status: {status['status']} | Progress: {status['progress']['percentage']:.0f}%")
if status["status"] in ("succeeded", "failed", "cancelled"):
return status
# Honor retry_after if present
wait_time = status.get("retry_after") or POLL_INTERVAL
time.sleep(wait_time)
raise TimeoutError(f"Job {job_id} did not complete within {max_wait}s")
def main():
print("=" * 60)
print("PraisonAI Async Jobs SDK Example")
print("=" * 60)
# Check if server is running
try:
with httpx.Client(timeout=5.0) as client:
health = client.get(f"{API_URL}/health")
health.raise_for_status()
print(f"✓ Server healthy: {health.json()['status']}")
except Exception as e:
print(f"✗ Server not available at {API_URL}: {e}")
print(" Start the server with: python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factory")
return
# 1. Submit a job
print("\n1. Submitting job...")
prompt = "What is the capital of France? Answer in one word."
result = submit_job(prompt)
job_id = result["job_id"]
print(f" Job ID: {job_id}")
print(f" Status: {result['status']}")
print(f" Poll URL: {result['poll_url']}")
# 2. Wait for completion
print("\n2. Waiting for completion...")
final_status = wait_for_completion(job_id)
print(f" Final status: {final_status['status']}")
# 3. Get result
if final_status["status"] == "succeeded":
print("\n3. Getting result...")
result = get_result(job_id)
print(f" Result: {result['result']}")
print(f" Duration: {result['duration_seconds']:.2f}s")
else:
print(f"\n3. Job did not succeed: {final_status.get('error', 'Unknown error')}")
print("\n" + "=" * 60)
print("Example completed successfully!")
print("=" * 60)
if __name__ == "__main__":
main()
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
# CLI Example: SSE Streaming
#
# This example demonstrates how to stream job progress via Server-Sent Events.
#
# Requirements:
# - Jobs server running on http://127.0.0.1:8005
#
# Usage:
# bash sse_stream.sh
set -e
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
echo "============================================================"
echo "PraisonAI SSE Streaming Example"
echo "============================================================"
# Submit a job
echo ""
echo "1. Submitting job..."
RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs" \
-H "Content-Type: application/json" \
-d '{"prompt": "Count from 1 to 5."}')
JOB_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
echo " Job ID: $JOB_ID"
# Stream progress
echo ""
echo "2. Streaming progress (Ctrl+C to stop)..."
echo " Connecting to: $API_URL/api/v1/runs/$JOB_ID/stream"
echo ""
# Use curl to stream SSE events (timeout after 60s)
curl -s -N --max-time 60 "$API_URL/api/v1/runs/$JOB_ID/stream" | while read -r line; do
if [[ "$line" == data:* ]]; then
data="${line#data: }"
if [ "$data" = "[DONE]" ]; then
echo " Stream completed"
break
fi
echo " Event: $data"
fi
done
echo ""
echo "============================================================"
echo "Streaming example completed!"
echo "============================================================"
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
"""
Basic Background Tasks Example for PraisonAI Agents.
This example demonstrates how to use the background task system with Agent:
1. Create an Agent with background task support
2. Run agent tasks asynchronously
3. Track task progress
4. Handle task completion
Usage:
python basic_background.py
"""
import asyncio
from praisonaiagents import Agent
from praisonaiagents.background import BackgroundRunner, BackgroundConfig, TaskStatus
async def main():
print("=" * 60)
print("Agent-Centric Background Tasks Demo")
print("=" * 60)
# Create a background runner with config (used standalone, not passed to Agent)
runner = BackgroundRunner(config=BackgroundConfig(max_concurrent_tasks=3))
# Create an Agent
agent = Agent(
name="AsyncAssistant",
instructions="You are a helpful research assistant.",
)
print("\n--- Agent with Background Support Created ---")
print(f"Agent: {agent.name}")
print(f"Background runner: {runner is not None}")
# Define some example tasks
async def research_task(topic: str) -> str:
"""Simulate a research task."""
print(f" 🔄 Researching '{topic}'...")
await asyncio.sleep(1.5)
return f"Research on '{topic}' completed with 5 key findings"
async def analysis_task(data: str) -> str:
"""Simulate an analysis task."""
print(f" 🔄 Analyzing data...")
await asyncio.sleep(1.0)
return f"Analysis complete: {data}"
# Submit tasks via background runner
print("\n--- Submitting Background Tasks ---")
task1 = await runner.submit(
research_task,
args=("AI trends 2025",),
name="research_ai"
)
print(f"✅ Submitted research task: {task1.id[:8]}")
task2 = await runner.submit(
analysis_task,
args=("market data",),
name="analyze_market"
)
print(f"✅ Submitted analysis task: {task2.id[:8]}")
# List all tasks
print("\n--- Task Status ---")
for task in runner.tasks:
print(f" [{task.id[:8]}] {task.status.value}")
# Wait for tasks to complete
print("\n--- Waiting for Tasks ---")
await task1.wait(timeout=10.0)
await task2.wait(timeout=10.0)
# Final results
print("\n--- Results ---")
for task in [task1, task2]:
status = "✅" if task.status == TaskStatus.COMPLETED else "❌"
print(f" {status} {task.result}")
# Cleanup
runner.clear_completed()
print("\n✅ Cleared completed tasks")
print("\n" + "=" * 60)
print("Demo Complete!")
print("=" * 60)
if __name__ == "__main__":
asyncio.run(main())
+23
View File
@@ -0,0 +1,23 @@
"""Calculator with Tests - Editor Output Example.
Builds a calculator module, writes unit tests, runs them, generates a
coverage-style report, and reads it back.
"""
from praisonaiagents import Agent
from praisonaiagents.tools import (
write_file, read_file, execute_command
)
agent = Agent(
instructions="You are a helpful coding assistant.",
output="editor",
tools=[write_file, read_file, execute_command],
approval=True,
)
agent.start(
"Build a mini calculator - create /tmp/calculator.py with add, subtract, "
"multiply, divide functions, write unit tests in /tmp/test_calculator.py "
"using unittest, run the tests to make sure they pass, then generate a "
"coverage-style report in /tmp/calc_report.md listing which functions were "
"tested and read it back"
)
+22
View File
@@ -0,0 +1,22 @@
"""Fibonacci Generator - Editor Output Example.
Creates a Fibonacci script, runs it, writes a summary, and reads back
both files to verify everything looks good.
"""
from praisonaiagents import Agent
from praisonaiagents.tools import (
write_file, read_file, execute_command, list_files
)
agent = Agent(
instructions="You are a helpful coding assistant.",
output="editor",
tools=[write_file, read_file, execute_command, list_files],
approval=False,
)
agent.start(
"Create a Python file at /tmp/fibonacci.py that generates the first 20 "
"Fibonacci numbers, run it to verify the output is correct, then write "
"a summary to /tmp/fib_summary.md explaining the algorithm you used and "
"the output, finally read back both files to confirm everything looks good"
)
+36
View File
@@ -0,0 +1,36 @@
"""Multi-Step Research - Editor Output Example.
Researches Python frameworks, creates comparison code, runs it, writes a
markdown report, reads it back, lists files, and gets system info.
"""
from praisonaiagents import Agent
from praisonaiagents.tools import (
write_file, read_file, execute_command, list_files, get_system_info
)
try:
from praisonaiagents.tools import web_search
tools = [web_search, write_file, read_file, execute_command,
list_files, get_system_info]
except ImportError:
tools = [write_file, read_file, execute_command,
list_files, get_system_info]
agent = Agent(
instructions="You are a helpful research assistant.",
output="editor",
tools=tools,
approval=False,
)
agent.start(
"Research the top 3 Python web frameworks (Django, FastAPI, Flask), then: "
"1) Search the web for each framework's latest version and key features, "
"2) Create a file called /tmp/framework_comparison.py that contains a "
"Python dictionary with the comparison data, "
"3) Execute the code to verify the dictionary is valid, "
"4) Write a markdown report to /tmp/framework_report.md summarizing your "
"findings in a table format, "
"5) Read back the report file to verify it was written correctly, "
"6) List the files in /tmp to confirm both files exist, "
"7) Get system info to note what OS this report was generated on"
)
+21
View File
@@ -0,0 +1,21 @@
"""System Audit - Editor Output Example.
Runs system commands, gathers info, writes a report, and reads it back.
"""
from praisonaiagents import Agent
from praisonaiagents.tools import (
write_file, read_file, execute_command
)
agent = Agent(
instructions="You are a helpful system administration assistant.",
output="editor",
tools=[write_file, read_file, execute_command],
approval=True,
)
agent.start(
"Investigate my system - get the current date, check disk usage, find out "
"what Python version is installed, list running processes sorted by memory, "
"then write all findings to /tmp/system_audit.md as a neat report and read "
"it back to verify"
)
+28
View File
@@ -0,0 +1,28 @@
"""Weather Search - Editor Output Example.
Searches for weather, creates JSON data, writes a parser script, executes
it, and lists created files.
"""
from praisonaiagents import Agent
from praisonaiagents.tools import (
write_file, execute_command, list_files
)
try:
from praisonaiagents.tools import web_search
tools = [web_search, write_file, execute_command, list_files]
except ImportError:
tools = [write_file, execute_command, list_files]
agent = Agent(
instructions="You are a helpful research assistant.",
output="editor",
tools=tools,
approval=False,
)
agent.start(
"Search the web for the current weather in Tokyo, create a JSON file at "
"/tmp/weather_data.json with the findings, then write a Python script at "
"/tmp/parse_weather.py that reads the JSON and prints a formatted weather "
"report, execute the script, and list all files you created in /tmp"
)
+146
View File
@@ -0,0 +1,146 @@
#!/usr/bin/env python3
"""
PraisonAI Benchmark Example
This example demonstrates how to use the benchmark system programmatically
to compare performance across different execution paths.
Usage:
python benchmark_example.py
Requirements:
- OPENAI_API_KEY environment variable set
- praisonai package installed
"""
import os
import sys
# Ensure the package is importable
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../src/praisonai'))
from praisonai.cli.features.benchmark import BenchmarkHandler, BenchmarkReport
def run_quick_comparison():
"""Run a quick comparison of key execution paths."""
print("=" * 60)
print("Quick Benchmark Comparison")
print("=" * 60)
handler = BenchmarkHandler()
# Run benchmark with 2 iterations on key paths
report = handler.run_full_benchmark(
prompt="What is 2+2?",
iterations=2,
paths=["openai_sdk", "praisonai_agent"],
output="verbose"
)
# Print comparison table
print("\n" + handler.create_comparison_table(report))
return report
def run_full_benchmark():
"""Run full benchmark suite across all paths."""
print("=" * 60)
print("Full Benchmark Suite")
print("=" * 60)
handler = BenchmarkHandler()
# Run full benchmark
report = handler.run_full_benchmark(
prompt="Hi",
iterations=3,
output="verbose"
)
# Print full report
handler.print_report(report)
return report
def run_agent_benchmark():
"""Benchmark PraisonAI Agent specifically."""
print("=" * 60)
print("Agent Benchmark")
print("=" * 60)
handler = BenchmarkHandler()
# Benchmark agent vs SDK
report = handler.run_full_benchmark(
prompt="Explain Python in one sentence",
iterations=3,
paths=["openai_sdk", "praisonai_agent"],
output="verbose"
)
# Show timeline diagrams
for name, result in report.results.items():
print(f"\n### {name}")
print(handler.create_timeline_diagram(result))
# Show variance analysis
print(handler.create_variance_table(report))
return report
def save_benchmark_results(report: BenchmarkReport, output_path: str):
"""Save benchmark results to JSON file."""
import json
with open(output_path, 'w') as f:
json.dump(report.to_dict(), f, indent=2)
print(f"\nResults saved to: {output_path}")
def main():
"""Main entry point."""
import argparse
parser = argparse.ArgumentParser(description="PraisonAI Benchmark Example")
parser.add_argument(
"--mode",
choices=["quick", "full", "agent"],
default="quick",
help="Benchmark mode: quick (2 paths), full (all paths), agent (agent focus)"
)
parser.add_argument(
"--output",
type=str,
default=None,
help="Output JSON file path"
)
args = parser.parse_args()
# Check for API key
if not os.environ.get("OPENAI_API_KEY"):
print("Error: OPENAI_API_KEY environment variable not set")
sys.exit(1)
# Run selected benchmark
if args.mode == "quick":
report = run_quick_comparison()
elif args.mode == "full":
report = run_full_benchmark()
elif args.mode == "agent":
report = run_agent_benchmark()
# Save results if requested
if args.output:
save_benchmark_results(report, args.output)
print("\n✅ Benchmark complete!")
if __name__ == "__main__":
main()
@@ -0,0 +1,43 @@
"""
Basic Caching Configuration Example
Demonstrates using caching for response and prompt caching.
"""
import os
from praisonaiagents import Agent, CachingConfig
# Ensure API key is set from environment
assert os.getenv("OPENAI_API_KEY"), "OPENAI_API_KEY must be set"
# Default caching (enabled)
agent_cached = Agent(
instructions="You are a helpful assistant.",
caching=True,
)
# Disable caching
agent_no_cache = Agent(
instructions="You are a helpful assistant.",
caching=False,
)
# Custom caching configuration
agent_custom = Agent(
instructions="You are a helpful assistant.",
caching=CachingConfig(
enabled=True,
prompt_caching=True, # Enable prompt caching for supported providers
),
)
if __name__ == "__main__":
print("Testing CachingConfig...")
print(f"Cached agent cache: {agent_cached.cache}")
print(f"No-cache agent cache: {agent_no_cache.cache}")
print(f"Custom agent cache: {agent_custom.cache}")
result = agent_cached.chat("What is caching?")
print(f"Result: {result}")
print("\nCachingConfig tests passed!")
@@ -0,0 +1,24 @@
"""
Assistants Capabilities Example
Demonstrates OpenAI Assistants API using PraisonAI capabilities.
"""
from praisonai.capabilities import assistant_list
print("=== List Assistants ===")
try:
assistants = assistant_list()
print(f"Assistants found: {len(assistants)}")
for a in assistants[:5]: # Show first 5
print(f" - {a.get('name', 'unnamed')}: {a.get('id', 'unknown')}")
except Exception as e:
print(f"Note: {e}")
print("\n=== Assistant Operations ===")
print("Available functions:")
print(" assistant_create(name, instructions, model='gpt-4o-mini')")
print(" assistant_list()")
print("\nSee CLI: praisonai assistants list")
print("See CLI: praisonai assistants create --name 'My Assistant'")
+24
View File
@@ -0,0 +1,24 @@
"""
Audio Capabilities Example
Demonstrates transcription and text-to-speech using PraisonAI capabilities.
"""
from praisonai.capabilities import transcribe, speech
# Note: Audio transcription requires an audio file
# This example shows the API structure
print("=== Audio Transcription ===")
print("To transcribe audio, use:")
print(" result = transcribe('audio.mp3', model='whisper-1')")
print(" print(result.text)")
print("\n=== Text-to-Speech ===")
print("To generate speech, use:")
print(" audio_data = speech('Hello world', model='tts-1', voice='alloy')")
print(" # Save to file or play")
print("\nNote: These operations require audio files or generate audio output.")
print("See CLI: praisonai audio transcribe <file>")
print("See CLI: praisonai audio speech <text>")
+27
View File
@@ -0,0 +1,27 @@
"""
Batches Capabilities Example
Demonstrates batch processing using PraisonAI capabilities.
"""
from praisonai.capabilities import batch_list
print("=== Batch List ===")
try:
batches = batch_list()
print(f"Batches found: {len(batches)}")
for b in batches[:5]: # Show first 5
print(f" - {b.get('id', 'unknown')}: {b.get('status', 'unknown')}")
except Exception as e:
print(f"Note: {e}")
print("Batch operations require batch jobs to be created first.")
print("\n=== Batch Operations ===")
print("Available functions:")
print(" batch_create(input_file_id, endpoint, completion_window='24h')")
print(" batch_list()")
print(" batch_retrieve(batch_id)")
print(" batch_cancel(batch_id)")
print("\nSee CLI: praisonai batches list")
print("See CLI: praisonai batches create <input_file_id>")
@@ -0,0 +1,30 @@
"""
Completions Capability Example
Demonstrates chat and text completions using PraisonAI capabilities.
"""
from praisonai.capabilities import chat_completion, text_completion
# Chat completion example
print("=== Chat Completion ===")
result = chat_completion(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is 2 + 2? Answer in one word."}
],
model="gpt-4o-mini",
max_tokens=10
)
print(f"Response: {result.content}")
print(f"Model: {result.model}")
print(f"Usage: {result.usage}")
# Text completion example (legacy)
print("\n=== Text Completion ===")
result = text_completion(
prompt="The capital of France is",
model="gpt-3.5-turbo-instruct",
max_tokens=10
)
print(f"Response: {result.content}")
@@ -0,0 +1,46 @@
"""
Embeddings Capability Example
Demonstrates text embedding generation using PraisonAI capabilities.
Both `embed` and `embedding` work identically - use whichever you prefer.
"""
from praisonai import embed, embedding # Both work from top-level
# Or: from praisonai.capabilities import embed, embedding
# Single text embedding using embed()
print("=== Single Text Embedding (using embed) ===")
result = embed(
input="Hello, world!",
model="text-embedding-3-small"
)
print(f"Embedding dimensions: {len(result.embeddings[0])}")
print(f"First 5 values: {result.embeddings[0][:5]}")
print(f"Usage: {result.usage}")
# Same thing using embedding() alias
print("\n=== Single Text Embedding (using embedding alias) ===")
result = embedding(
input="Hello, world!",
model="text-embedding-3-small"
)
print(f"Embedding dimensions: {len(result.embeddings[0])}")
# Multiple text embeddings
print("\n=== Multiple Text Embeddings ===")
result = embed(
input=["Hello", "World", "AI"],
model="text-embedding-3-small"
)
print(f"Number of embeddings: {len(result.embeddings)}")
for i, emb in enumerate(result.embeddings):
print(f" Text {i+1}: {len(emb)} dimensions")
# With custom dimensions (for models that support it)
print("\n=== Custom Dimensions ===")
result = embed(
input="Hello world",
model="text-embedding-3-large",
dimensions=256
)
print(f"Reduced dimensions: {len(result.embeddings[0])}")
+28
View File
@@ -0,0 +1,28 @@
"""
Files Capabilities Example
Demonstrates file management using PraisonAI capabilities.
"""
from praisonai.capabilities import file_list
print("=== File List ===")
try:
files = file_list()
print(f"Files found: {len(files)}")
for f in files[:5]: # Show first 5
print(f" - {f.get('filename', 'unknown')}: {f.get('id', 'unknown')}")
except Exception as e:
print(f"Note: {e}")
print("File operations require files to be uploaded first.")
print("\n=== File Operations ===")
print("Available functions:")
print(" file_create(file_path, purpose='assistants')")
print(" file_list(purpose=None)")
print(" file_retrieve(file_id)")
print(" file_delete(file_id)")
print(" file_content(file_id)")
print("\nSee CLI: praisonai files list")
print("See CLI: praisonai files upload <file>")
+31
View File
@@ -0,0 +1,31 @@
"""
Images Capability Example
Demonstrates image generation using PraisonAI capabilities.
"""
from praisonai.capabilities import image_generate
# Generate an image with DALL-E 2
print("=== Image Generation (DALL-E 2) ===")
result = image_generate(
prompt="A simple blue circle on a white background",
model="dall-e-2",
size="256x256",
n=1
)
print(f"Images generated: {len(result)}")
if result:
print(f"URL: {result[0].url[:80]}...")
# Generate with DALL-E 3 (higher quality)
print("\n=== Image Generation (DALL-E 3) ===")
result = image_generate(
prompt="A serene mountain landscape at sunset",
model="dall-e-3",
size="1024x1024",
quality="standard"
)
print(f"Images generated: {len(result)}")
if result:
print(f"Revised prompt: {result[0].revised_prompt[:80]}..." if result[0].revised_prompt else "No revised prompt")
+33
View File
@@ -0,0 +1,33 @@
"""
Messages Capability Example
Demonstrates Anthropic-style messages API and token counting.
"""
from praisonai.capabilities import messages_create, count_tokens
# Create a message (Anthropic-style)
print("=== Messages Create ===")
result = messages_create(
messages=[{"role": "user", "content": "What is the meaning of life? Answer briefly."}],
model="gpt-4o-mini", # Works with any model via LiteLLM
max_tokens=100,
system="You are a philosophical assistant."
)
print(f"Message ID: {result.id}")
if result.content:
for block in result.content:
if block.get("type") == "text":
print(f"Response: {block.get('text')}")
print(f"Usage: {result.usage}")
# Count tokens
print("\n=== Token Counting ===")
result = count_tokens(
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, how are you today?"}
],
model="gpt-4o-mini"
)
print(f"Token count: {result.input_tokens}")
@@ -0,0 +1,24 @@
"""
Moderations Capability Example
Demonstrates content moderation using PraisonAI capabilities.
"""
from praisonai.capabilities import moderate
# Check safe content
print("=== Safe Content Check ===")
result = moderate(
input="Hello, how are you today?"
)
print(f"Flagged: {result[0].flagged}")
print(f"Categories: {list(result[0].categories.keys())[:5]}...")
# Check multiple texts
print("\n=== Multiple Text Moderation ===")
result = moderate(
input=["Hello world", "Have a nice day", "This is a test"]
)
print(f"Number of results: {len(result)}")
for i, r in enumerate(result):
print(f" Text {i+1}: Flagged = {r.flagged}")
+23
View File
@@ -0,0 +1,23 @@
"""
Realtime Capability Example
Demonstrates realtime session creation for audio/video streaming.
"""
from praisonai.capabilities import realtime_connect
# Create a realtime session
print("=== Realtime Session ===")
session = realtime_connect(
model="gpt-4o-realtime-preview",
modalities=["text", "audio"],
voice="alloy"
)
print(f"Session ID: {session.id}")
print(f"Status: {session.status}")
print(f"URL: {session.url}")
print(f"Modalities: {session.metadata.get('modalities')}")
print(f"Voice: {session.metadata.get('voice')}")
print("\nNote: To use this session, connect via WebSocket to the URL above.")
print("See OpenAI Realtime API documentation for WebSocket protocol details.")
+32
View File
@@ -0,0 +1,32 @@
"""
Rerank Capabilities Example
Demonstrates document reranking using PraisonAI capabilities.
"""
from praisonai.capabilities import rerank
print("=== Document Reranking ===")
try:
documents = [
"Python is a programming language",
"Machine learning uses algorithms",
"Python is great for data science",
"JavaScript runs in browsers"
]
results = rerank(
query="Python programming",
documents=documents,
model="cohere/rerank-english-v3.0"
)
print(f"Query: 'Python programming'")
print(f"Reranked results:")
for r in results:
print(f" Score {r.get('relevance_score', 0):.4f}: {r.get('document', {}).get('text', '')[:50]}")
except Exception as e:
print(f"Note: Reranking requires Cohere API key")
print(f"Error: {e}")
print("\nSee CLI: praisonai rerank <query> --documents 'doc1' 'doc2'")
@@ -0,0 +1,22 @@
"""
Vector Stores Capabilities Example
Demonstrates vector store management using PraisonAI capabilities.
"""
from praisonai.capabilities import vector_store_create, vector_store_search
print("=== Vector Store Operations ===")
print("Available functions:")
print(" vector_store_create(name)")
print(" vector_store_search(vector_store_id, query)")
print("\n=== Create Vector Store ===")
try:
store = vector_store_create(name="test-store")
print(f"Created: {store}")
except Exception as e:
print(f"Note: {e}")
print("\nSee CLI: praisonai vector-stores create --name 'my-store'")
print("See CLI: praisonai vector-stores search <store_id> <query>")
+148
View File
@@ -0,0 +1,148 @@
#!/usr/bin/env python3
"""
Example: Fetch and search PraisonAI templates from the catalog.
This example demonstrates how to:
- Fetch templates.json from the deployed catalog
- Search templates by keyword
- Filter by tags and requirements
- Generate CLI commands
"""
import json
import urllib.request
from typing import List, Dict, Any, Optional
CATALOG_URL = "https://mervinpraison.github.io/praisonai-template-catalog/data/templates.json"
def fetch_catalog(url: str = CATALOG_URL) -> Dict[str, Any]:
"""Fetch the template catalog from URL."""
try:
with urllib.request.urlopen(url, timeout=10) as response:
return json.loads(response.read().decode())
except Exception as e:
print(f"Failed to fetch catalog: {e}")
# Return empty catalog on failure
return {"version": "0.0.0", "count": 0, "templates": []}
def search_templates(templates: List[Dict], query: str) -> List[Dict]:
"""Search templates by name, description, or tags."""
query = query.lower()
results = []
for t in templates:
if (query in t.get("name", "").lower() or
query in t.get("description", "").lower() or
any(query in tag.lower() for tag in t.get("tags", []))):
results.append(t)
return results
def filter_by_tags(templates: List[Dict], tags: List[str]) -> List[Dict]:
"""Filter templates that have all specified tags."""
return [
t for t in templates
if all(tag in t.get("tags", []) for tag in tags)
]
def filter_by_tool(templates: List[Dict], tool_name: str) -> List[Dict]:
"""Filter templates that require a specific tool."""
return [
t for t in templates
if tool_name in t.get("requires", {}).get("tools", [])
]
def get_template(templates: List[Dict], name: str) -> Optional[Dict]:
"""Get a template by name."""
for t in templates:
if t.get("name") == name:
return t
return None
def generate_cli_command(template: Dict, action: str = "run") -> str:
"""Generate CLI command for a template."""
name = template.get("name", "unknown")
if action == "run":
return f"praisonai templates run {name}"
elif action == "info":
return f"praisonai templates info {name}"
elif action == "init":
return f"praisonai templates init my-project --template {name}"
return f"praisonai templates {action} {name}"
def print_template_summary(template: Dict):
"""Print a summary of a template."""
print(f"\n{'='*60}")
print(f"Name: {template.get('name')}")
print(f"Version: {template.get('version')}")
print(f"Description: {template.get('description', '')[:100]}...")
print(f"Tags: {', '.join(template.get('tags', []))}")
requires = template.get("requires", {})
if requires.get("tools"):
print(f"Tools: {', '.join(requires['tools'])}")
if requires.get("packages"):
print(f"Packages: {', '.join(requires['packages'])}")
if requires.get("env"):
print(f"Env vars: {', '.join(requires['env'])}")
print(f"\nRun: {generate_cli_command(template, 'run')}")
print(f"{'='*60}")
def main():
print("PraisonAI Template Catalog - Python Example")
print("-" * 45)
# Fetch catalog
print("\n1. Fetching template catalog...")
catalog = fetch_catalog()
templates = catalog.get("templates", [])
print(f" Catalog version: {catalog.get('version', 'unknown')}")
print(f" Total templates: {len(templates)}")
if not templates:
print(" No templates found. The catalog may not be deployed yet.")
print(" Try building locally: praisonai templates catalog build")
return
# List all templates
print("\n2. Available templates:")
for t in templates:
print(f" - {t.get('name')} (v{t.get('version')})")
# Search for video templates
print("\n3. Searching for 'video' templates...")
video_templates = search_templates(templates, "video")
print(f" Found {len(video_templates)} video templates:")
for t in video_templates:
print(f" - {t.get('name')}: {t.get('description', '')[:50]}...")
# Filter by tool
print("\n4. Templates using 'shell_tool':")
shell_templates = filter_by_tool(templates, "shell_tool")
for t in shell_templates:
print(f" - {t.get('name')}")
# Get specific template details
if templates:
first_template = templates[0]
print(f"\n5. Template details for '{first_template.get('name')}':")
print_template_summary(first_template)
# Generate CLI commands
print("\n6. CLI commands for all templates:")
for t in templates[:5]: # First 5 only
print(f" {generate_cli_command(t, 'run')}")
print("\nDone!")
if __name__ == "__main__":
main()
+167
View File
@@ -0,0 +1,167 @@
#!/usr/bin/env npx ts-node
/**
* Example: Fetch and search PraisonAI templates from the catalog.
*
* This TypeScript example demonstrates how to:
* - Fetch templates.json from the deployed catalog
* - Search templates by keyword
* - Filter by tags and requirements
* - Generate CLI commands
*/
const CATALOG_URL = "https://mervinpraison.github.io/praisonai-template-catalog/data/templates.json";
interface Template {
name: string;
version: string;
description: string;
author?: string;
license?: string;
tags?: string[];
category?: string;
difficulty?: "beginner" | "intermediate" | "advanced";
requires?: {
tools?: string[];
packages?: string[];
env?: string[];
};
}
interface Catalog {
version: string;
generated_at: string;
count: number;
templates: Template[];
}
async function fetchCatalog(url: string = CATALOG_URL): Promise<Catalog> {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to fetch catalog: ${response.statusText}`);
}
return response.json();
}
function searchTemplates(templates: Template[], query: string): Template[] {
const q = query.toLowerCase();
return templates.filter(t =>
t.name.toLowerCase().includes(q) ||
t.description?.toLowerCase().includes(q) ||
t.tags?.some(tag => tag.toLowerCase().includes(q))
);
}
function filterByTags(templates: Template[], tags: string[]): Template[] {
return templates.filter(t =>
tags.every(tag => t.tags?.includes(tag))
);
}
function filterByTool(templates: Template[], toolName: string): Template[] {
return templates.filter(t =>
t.requires?.tools?.includes(toolName)
);
}
function getTemplate(templates: Template[], name: string): Template | undefined {
return templates.find(t => t.name === name);
}
function generateCLICommand(template: Template, action: string = "run"): string {
const name = template.name;
switch (action) {
case "run":
return `praisonai templates run ${name}`;
case "info":
return `praisonai templates info ${name}`;
case "init":
return `praisonai templates init my-project --template ${name}`;
default:
return `praisonai templates ${action} ${name}`;
}
}
function printTemplateSummary(template: Template): void {
console.log("\n" + "=".repeat(60));
console.log(`Name: ${template.name}`);
console.log(`Version: ${template.version}`);
console.log(`Description: ${template.description?.slice(0, 100)}...`);
console.log(`Tags: ${template.tags?.join(", ") || "none"}`);
const requires = template.requires;
if (requires?.tools?.length) {
console.log(`Tools: ${requires.tools.join(", ")}`);
}
if (requires?.packages?.length) {
console.log(`Packages: ${requires.packages.join(", ")}`);
}
if (requires?.env?.length) {
console.log(`Env vars: ${requires.env.join(", ")}`);
}
console.log(`\nRun: ${generateCLICommand(template, "run")}`);
console.log("=".repeat(60));
}
async function main(): Promise<void> {
console.log("PraisonAI Template Catalog - TypeScript Example");
console.log("-".repeat(45));
// Fetch catalog
console.log("\n1. Fetching template catalog...");
let catalog: Catalog;
try {
catalog = await fetchCatalog();
} catch (error) {
console.log(` Failed to fetch: ${error}`);
console.log(" The catalog may not be deployed yet.");
return;
}
const templates = catalog.templates;
console.log(` Catalog version: ${catalog.version}`);
console.log(` Total templates: ${templates.length}`);
if (templates.length === 0) {
console.log(" No templates found.");
return;
}
// List all templates
console.log("\n2. Available templates:");
templates.forEach(t => {
console.log(` - ${t.name} (v${t.version})`);
});
// Search for video templates
console.log("\n3. Searching for 'video' templates...");
const videoTemplates = searchTemplates(templates, "video");
console.log(` Found ${videoTemplates.length} video templates:`);
videoTemplates.forEach(t => {
console.log(` - ${t.name}: ${t.description?.slice(0, 50)}...`);
});
// Filter by tool
console.log("\n4. Templates using 'shell_tool':");
const shellTemplates = filterByTool(templates, "shell_tool");
shellTemplates.forEach(t => {
console.log(` - ${t.name}`);
});
// Get specific template details
if (templates.length > 0) {
const firstTemplate = templates[0];
console.log(`\n5. Template details for '${firstTemplate.name}':`);
printTemplateSummary(firstTemplate);
}
// Generate CLI commands
console.log("\n6. CLI commands for all templates:");
templates.slice(0, 5).forEach(t => {
console.log(` ${generateCLICommand(t, "run")}`);
});
console.log("\nDone!");
}
main().catch(console.error);
@@ -0,0 +1,121 @@
#!/usr/bin/env python3
"""
Run all catalog examples and report pass/fail status.
Usage:
python run_all_catalog_examples.py
Environment variables:
OPENAI_API_KEY or PRAISONAI_OPENAI_API_KEY - Required for agent example
PRAISONAI_RUN_INTEGRATION - Set to "1" to run integration tests
"""
import os
import subprocess
import sys
from pathlib import Path
SCRIPT_DIR = Path(__file__).parent
def run_example(name: str, script: str, requires_api_key: bool = False) -> bool:
"""Run an example script and return success status."""
print(f"\n{'='*60}")
print(f"Running: {name}")
print(f"Script: {script}")
print("="*60)
# Check API key requirement
if requires_api_key:
api_key = os.environ.get("OPENAI_API_KEY") or os.environ.get("PRAISONAI_OPENAI_API_KEY")
run_integration = os.environ.get("PRAISONAI_RUN_INTEGRATION") == "1"
if not api_key:
print(f"⏭️ SKIPPED: {name} (no API key)")
print(" Set OPENAI_API_KEY to run this example")
return True # Not a failure, just skipped
if not run_integration:
print(f"⏭️ SKIPPED: {name} (integration tests disabled)")
print(" Set PRAISONAI_RUN_INTEGRATION=1 to run")
return True
script_path = SCRIPT_DIR / script
if not script_path.exists():
print(f"❌ FAILED: Script not found: {script_path}")
return False
try:
result = subprocess.run(
[sys.executable, str(script_path)],
capture_output=True,
text=True,
timeout=60,
cwd=str(SCRIPT_DIR)
)
print(result.stdout)
if result.stderr:
print(f"STDERR: {result.stderr}")
if result.returncode == 0:
print(f"✅ PASSED: {name}")
return True
else:
print(f"❌ FAILED: {name} (exit code {result.returncode})")
return False
except subprocess.TimeoutExpired:
print(f"❌ FAILED: {name} (timeout)")
return False
except Exception as e:
print(f"❌ FAILED: {name} ({e})")
return False
def main():
print("PraisonAI Template Catalog - Example Runner")
print("=" * 50)
# Check environment
api_key = os.environ.get("OPENAI_API_KEY") or os.environ.get("PRAISONAI_OPENAI_API_KEY")
if api_key:
print(f"API key: present (...{api_key[-4:]})")
else:
print("API key: not set")
run_integration = os.environ.get("PRAISONAI_RUN_INTEGRATION") == "1"
print(f"Integration tests: {'enabled' if run_integration else 'disabled'}")
# Define examples
examples = [
("Fetch Templates (Python)", "fetch_templates.py", False),
("Template Finder Agent", "template_finder_agent.py", True),
]
# Run examples
results = []
for name, script, requires_key in examples:
success = run_example(name, script, requires_key)
results.append((name, success))
# Summary
print("\n" + "=" * 60)
print("SUMMARY")
print("=" * 60)
passed = sum(1 for _, s in results if s)
failed = sum(1 for _, s in results if not s)
for name, success in results:
status = "✅ PASS" if success else "❌ FAIL"
print(f" {status}: {name}")
print(f"\nTotal: {passed} passed, {failed} failed")
# Exit with appropriate code
sys.exit(0 if failed == 0 else 1)
if __name__ == "__main__":
main()
+193
View File
@@ -0,0 +1,193 @@
#!/usr/bin/env python3
"""
Example: Template Finder Agent
An Agent()-centric example that uses an AI agent to find templates
based on natural language queries.
Requires: OPENAI_API_KEY environment variable
"""
import json
import os
import urllib.request
CATALOG_URL = "https://mervinpraison.github.io/praisonai-template-catalog/data/templates.json"
def fetch_templates() -> list:
"""Fetch templates from catalog."""
try:
with urllib.request.urlopen(CATALOG_URL, timeout=10) as response:
data = json.loads(response.read().decode())
return data.get("templates", [])
except Exception:
return []
def search_templates_tool(query: str) -> str:
"""
Search templates by keyword.
Args:
query: Search query (e.g., "video editing", "transcript", "data")
Returns:
JSON string with matching templates
"""
templates = fetch_templates()
query_lower = query.lower()
results = []
for t in templates:
if (query_lower in t.get("name", "").lower() or
query_lower in t.get("description", "").lower() or
any(query_lower in tag.lower() for tag in t.get("tags", []))):
results.append({
"name": t.get("name"),
"description": t.get("description", "")[:100],
"tags": t.get("tags", []),
"cli_command": f"praisonai templates run {t.get('name')}"
})
if not results:
return json.dumps({"message": "No templates found matching your query", "templates": []})
return json.dumps({"count": len(results), "templates": results})
def list_all_templates_tool() -> str:
"""
List all available templates.
Returns:
JSON string with all template names and descriptions
"""
templates = fetch_templates()
if not templates:
return json.dumps({"message": "No templates available", "templates": []})
results = [
{"name": t.get("name"), "description": t.get("description", "")[:80]}
for t in templates
]
return json.dumps({"count": len(results), "templates": results})
def get_template_details_tool(name: str) -> str:
"""
Get detailed information about a specific template.
Args:
name: Template name (e.g., "ai-video-editor")
Returns:
JSON string with template details
"""
templates = fetch_templates()
for t in templates:
if t.get("name") == name:
return json.dumps({
"name": t.get("name"),
"version": t.get("version"),
"description": t.get("description"),
"author": t.get("author"),
"tags": t.get("tags", []),
"requires": t.get("requires", {}),
"cli_commands": {
"run": f"praisonai templates run {name}",
"info": f"praisonai templates info {name}",
"init": f"praisonai templates init my-project --template {name}"
}
})
return json.dumps({"error": f"Template '{name}' not found"})
def check_api_key() -> bool:
"""Check if API key is available."""
key = os.environ.get("OPENAI_API_KEY") or os.environ.get("PRAISONAI_OPENAI_API_KEY")
if key:
print(f"API key present: ...{key[-4:]}")
return True
return False
def main():
print("PraisonAI Template Finder Agent")
print("=" * 40)
# Check for API key
if not check_api_key():
print("\n⚠️ No API key found.")
print("Set OPENAI_API_KEY or PRAISONAI_OPENAI_API_KEY to use the agent.")
print("\nFalling back to direct tool usage:\n")
# Demo the tools directly
print("1. Listing all templates:")
result = list_all_templates_tool()
data = json.loads(result)
for t in data.get("templates", [])[:5]:
print(f" - {t['name']}: {t['description'][:50]}...")
print("\n2. Searching for 'video' templates:")
result = search_templates_tool("video")
data = json.loads(result)
for t in data.get("templates", []):
print(f" - {t['name']}")
print(f" Run: {t['cli_command']}")
return
# Import Agent only if API key is available
try:
from praisonaiagents import Agent
except ImportError:
print("praisonaiagents not installed. Install with: pip install praisonaiagents")
return
# Create the Template Finder Agent
agent = Agent(
name="Template Finder",
role="PraisonAI Template Expert",
goal="Help users find the right template for their needs",
backstory="""You are an expert on PraisonAI templates. You help users
discover templates that match their requirements. You can search templates,
list all available templates, and provide detailed information about specific
templates. Always provide the CLI command to run the template.""",
tools=[
search_templates_tool,
list_all_templates_tool,
get_template_details_tool
],
output="verbose" # Use new consolidated param
)
# Example queries
queries = [
"Find me a template for editing videos",
"What templates are available for working with transcripts?",
"Show me details about the ai-video-editor template"
]
print("\nRunning Template Finder Agent...")
print("-" * 40)
for query in queries:
print(f"\n📝 Query: {query}")
print("-" * 40)
try:
result = agent.start(query)
print(f"\n🤖 Response:\n{result}")
except Exception as e:
print(f"Error: {e}")
print("\n" + "=" * 40)
if __name__ == "__main__":
main()
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
"""
Basic Checkpoints Example for PraisonAI Agents.
This example demonstrates how to use the shadow git checkpointing system with Agent:
1. Create an Agent with checkpoint support
2. Save checkpoints before making changes
3. List available checkpoints
4. Restore to a previous checkpoint
Usage:
python basic_checkpoints.py
"""
import asyncio
import tempfile
from pathlib import Path
from praisonaiagents import Agent
from praisonaiagents.checkpoints import CheckpointService
async def main():
# Create a temporary workspace for demonstration
with tempfile.TemporaryDirectory() as workspace:
print("=" * 60)
print("Agent-Centric Checkpointing Demo")
print("=" * 60)
print(f"\nWorkspace: {workspace}")
# Create some initial files
test_file = Path(workspace) / "example.py"
test_file.write_text("# Initial content\nprint('Hello, World!')\n")
print(f"\n✅ Created initial file: {test_file.name}")
# Create checkpoint service (used standalone, not passed to Agent)
checkpoint_service = CheckpointService(workspace_dir=workspace)
# Create an Agent
agent = Agent(
name="RefactorBot",
instructions="You are a code refactoring assistant.",
)
print("\n--- Agent with Checkpoint Support Created ---")
print(f"Agent: {agent.name}")
print(f"Checkpoint service initialized: {checkpoint_service is not None}")
try:
# Initialize the shadow git repository
print("\n--- Initializing Checkpoint Service ---")
await checkpoint_service.initialize()
print("✅ Shadow git repository initialized")
# Save first checkpoint
print("\n--- Saving Checkpoint 1: Initial State ---")
result1 = await checkpoint_service.save("Initial state")
print(f"✅ Checkpoint saved: {result1.checkpoint.id[:8]}")
print(f" Message: {result1.checkpoint.message}")
# Make some changes (simulating agent modifications)
print("\n--- Simulating Agent Changes ---")
test_file.write_text("# Refactored content\nprint('Hello, PraisonAI!')\nprint('Checkpoints are awesome!')\n")
print("✅ Modified example.py")
# Create a new file
new_file = Path(workspace) / "utils.py"
new_file.write_text("def helper():\n return 'I help!'\n")
print("✅ Created utils.py")
# Save second checkpoint
print("\n--- Saving Checkpoint 2: After Refactoring ---")
result2 = await checkpoint_service.save("Added features")
print(f"✅ Checkpoint saved: {result2.checkpoint.id[:8]}")
# List all checkpoints
print("\n--- Listing All Checkpoints ---")
checkpoints_list = await checkpoint_service.list_checkpoints()
for i, cp in enumerate(checkpoints_list, 1):
print(f" {i}. [{cp.id[:8]}] {cp.message}")
# Show diff
print("\n--- Current Diff ---")
diff = await checkpoint_service.diff()
if diff.files:
for f in diff.files:
print(f" {f.status}: {f.path}")
else:
print(" No uncommitted changes")
# Make more changes
test_file.write_text("# Bad changes\nprint('This will be reverted')\n")
print("\n✅ Made problematic changes to example.py")
# Restore to checkpoint 2
print(f"\n--- Restoring to Checkpoint: {result2.checkpoint.id[:8]} ---")
await checkpoint_service.restore(result2.checkpoint.id)
print("✅ Restored successfully!")
# Verify restoration
content = test_file.read_text()
print(f"\n--- Verified Content After Restore ---")
print(content)
except Exception as e:
print(f"\n❌ Error: {e}")
raise
print("\n" + "=" * 60)
print("Demo Complete!")
print("=" * 60)
if __name__ == "__main__":
asyncio.run(main())
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Calculator with tests: code + unit tests + test execution + coverage report
# Tests: multiple file creation, test execution, report generation, file reading
praisonai "Build a mini calculator - create /tmp/calculator.py with add, subtract, multiply, divide functions, write unit tests in /tmp/test_calculator.py using unittest, run the tests to make sure they pass, then generate a coverage-style report in /tmp/calc_report.md listing which functions were tested and read it back" --trust
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Fibonacci generator: code creation, execution, documentation, verification
# Tests: file creation, code execution, markdown writing, file reading
praisonai "Create a Python file at /tmp/fibonacci.py that generates the first 20 Fibonacci numbers, run it to verify the output is correct, then write a summary to /tmp/fib_summary.md explaining the algorithm you used and the output, finally read back both files to confirm everything looks good" --trust
Loaded 100 of 3171 files, more files were not shown because too many files have changed in this diff. Show more