mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 12:47:55 -10:00
* fix(examples): resolve syntax errors and align with consolidated-params API * fix: correct TypeError in 3 example files by using proper parameter names - Fix MemoryConfig(memory=...) → user_id=... in agent_centric_api.py - Fix Session(memory=...) → user_id=... in session-example.py - Fix build_context_for_task(memory=...) → user_id=... in memory-quality-example.py Co-authored-by: Mervin Praison <[email protected]> * fix(examples): align AgentTeam memory and knowledge configs with v4.6.52 API * fix(examples): phase-3 API alignment for consolidated params on v4.6.52 * fix(examples): phase-4 API alignment for 40 validation failures on v4.6.52 * fix: resolve critical RouterAgent **kwargs bug and add missing if __name__ guards - Fixed TypeError in RouterAgent._build_system_prompt() by removing **kwargs from super() call - Added if __name__ == '__main__' guards to 6 example files to prevent auto-execution on import - Addresses Gemini Code Assist review feedback Co-authored-by: Mervin Praison <[email protected]> * fix: resolve missing AgentTeam import and RouterAgent kwargs forwarding - Fix missing AgentTeam import in self-reflection-optimization-patterns.py - Forward kwargs properly in RouterAgent._build_system_prompt to super() - Addresses critical issues identified by Gemini code reviewer Co-authored-by: Mervin Praison <[email protected]> * fix(examples): remove merge-conflict residue for PR #1893 --------- Co-authored-by: Dhivya-Bharathy <[email protected]> Co-authored-by: praisonai-triage-agent[bot] <272766704+praisonai-triage-agent[bot]@users.noreply.github.com> Co-authored-by: Mervin Praison <[email protected]> Co-authored-by: Mervin Praison <[email protected]>
Policy Packs Example
This example demonstrates how to use PraisonAI policy packs for managing tool permissions, data policies, and execution modes.
Features Demonstrated
- Creating and loading policy packs
- Tool permission checking (allow/deny)
- Policy modes (dev/prod)
- Merging policies
- Data and PII policies
Quick Start
python policy_example.py
CLI Commands
# Show default policy
praisonai recipe policy show
# Show policy from file
praisonai recipe policy show my-policy.yaml
# Create policy template
praisonai recipe policy init -o my-policy.yaml
# Validate policy file
praisonai recipe policy validate my-policy.yaml
Policy File Format
name: my-org-policy
version: "1.0"
tools:
allow:
- web.search
- db.query
deny:
- shell.exec
- file.write
network:
allow_domains:
- api.openai.com
deny_domains:
- localhost
pii:
mode: redact # allow, deny, redact
fields:
- email
- phone
data:
retention_days: 30
export_allowed: true
modes:
dev:
allow_interactive_prompts: true
strict_tool_enforcement: false
prod:
allow_interactive_prompts: false
strict_tool_enforcement: true
require_auth: true
Using Policy with Recipe Run
# Run with policy file
praisonai recipe run my-recipe --policy my-policy.yaml --mode prod