Approve a tool run

Note: Run the Python sample in an interactive terminal. Pipes and CI deny dangerous tools by default with no prompt.

Safe by default

File writes and shell commands are risky. On an interactive terminal PraisonAI asks before they run.

In CI or a pipe, the same tools are denied unless you set an explicit policy.

Example

from praisonaiagents import Agent

agent = Agent(
    name="Dev Agent",
    instructions="Help with file ops",
    tools=["write_file", "execute_command"],
)
agent.start("create a hello.txt file")

Example explained

  • tools — High-risk tools trigger an approval prompt on a TTY.
  • agent.start — When the model picks a tool, you choose once, session, always, or no.

Deny in automation

For pipelines, turn off prompts and keep deny-by-default so a misconfigured runner cannot delete files silently.

Example

from praisonaiagents import Agent

agent = Agent(
    name="CI Agent",
    approval=False,
    tools=["write_file", "execute_command"],
)
agent.start("run tests and update report")

Example explained

  • approval=False — No prompt; dangerous tools stay denied off-TTY style.

Declarative rules

For YAML runs you can allow and deny patterns up front instead of clicking each time.

Example

praisonai run agents.yaml \
  --allow 'read:*' \
  --allow 'bash:git *' \
  --deny 'bash:rm *' \
  --permission-default ask

In the web console

When an agent runs code or another high-risk tool from Chat, the console should show an approval step before execution—same idea as the terminal prompt.

If nothing asks you, treat the run as misconfigured: check agent tool lists and security settings before approving in production.

Reference: documentation