|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "id": "8a77ee2e-22f2-409c-837d-b994978b0aa2", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [ |
| 9 | + { |
| 10 | + "name": "stdout", |
| 11 | + "output_type": "stream", |
| 12 | + "text": [ |
| 13 | + "A function calls self, \n", |
| 14 | + "Unraveling layers deep, \n", |
| 15 | + "Base case ends the quest. \n", |
| 16 | + "\n", |
| 17 | + "Infinite loops lurk, \n", |
| 18 | + "Mind the base condition well, \n", |
| 19 | + "Or it will not work. \n", |
| 20 | + "\n", |
| 21 | + "Trees and lists unfold, \n", |
| 22 | + "Elegant solutions bloom, \n", |
| 23 | + "Recursion's art told.\n" |
| 24 | + ] |
| 25 | + } |
| 26 | + ], |
| 27 | + "source": [ |
| 28 | + "from agents import Agent, Runner\n", |
| 29 | + "\n", |
| 30 | + "agent = Agent(name=\"Assistant\", instructions=\"You are a helpful assistant\")\n", |
| 31 | + "\n", |
| 32 | + "# Intended for Jupyter notebooks where there's an existing event loop\n", |
| 33 | + "result = await Runner.run(agent, \"Write a haiku about recursion in programming.\") # type: ignore[top-level-await] # noqa: F704\n", |
| 34 | + "print(result.final_output)" |
| 35 | + ] |
| 36 | + } |
| 37 | + ], |
| 38 | + "metadata": { |
| 39 | + "language_info": { |
| 40 | + "name": "python" |
| 41 | + } |
| 42 | + }, |
| 43 | + "nbformat": 4, |
| 44 | + "nbformat_minor": 5 |
| 45 | +} |
0 commit comments