/ examples / basic / fibonacci.py
fibonacci.py
 1  """Fibonacci Generator - Editor Output Example.
 2  
 3  Creates a Fibonacci script, runs it, writes a summary, and reads back
 4  both files to verify everything looks good.
 5  """
 6  from praisonaiagents import Agent
 7  from praisonaiagents.tools import (
 8      write_file, read_file, execute_command, list_files
 9  )
10  
11  agent = Agent(
12      instructions="You are a helpful coding assistant.",
13      output="editor",
14      tools=[write_file, read_file, execute_command, list_files],
15      approval=False,
16  )
17  agent.start(
18      "Create a Python file at /tmp/fibonacci.py that generates the first 20 "
19      "Fibonacci numbers, run it to verify the output is correct, then write "
20      "a summary to /tmp/fib_summary.md explaining the algorithm you used and "
21      "the output, finally read back both files to confirm everything looks good"
22  )