{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b7388610", "metadata": {}, "outputs": [], "source": [ "# ! pip install -r ../../../Installation/requirements.txt -U" ] }, { "cell_type": "code", "execution_count": 2, "id": "b4f4d0c7", "metadata": {}, "outputs": [], "source": [ "import os\n", "import asyncio\n", "from random import randint\n", "from typing import Annotated\n", "from dotenv import load_dotenv\n", "\n", "from agent_framework import Agent\n", "from agent_framework.foundry import FoundryChatClient\n", "from azure.identity.aio import AzureCliCredential\n", "from pydantic import Field" ] }, { "cell_type": "code", "execution_count": 3, "id": "8797600a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "load_dotenv()" ] }, { "cell_type": "code", "execution_count": 4, "id": "bc790a5f", "metadata": {}, "outputs": [], "source": [ "client = FoundryChatClient(credential=AzureCliCredential())" ] }, { "cell_type": "code", "execution_count": 5, "id": "afd1618d", "metadata": {}, "outputs": [], "source": [ "agent = Agent(\n", " client=client,\n", " name = \"FoundryAgent\",\n", " instructions=\"Write a haiku about Agent Framework\",\n", ")\n", " \n" ] }, { "cell_type": "code", "execution_count": 7, "id": "91d210ce", "metadata": {}, "outputs": [], "source": [ "query = \"Write a haiku about Agent Framework.\"\n", "response = await agent.run(query)" ] }, { "cell_type": "code", "execution_count": 9, "id": "2651d7de", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Silent agents weave \\nFrameworks guide their restless thoughts \\nTasks bloom into form'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.text" ] } ], "metadata": { "kernelspec": { "display_name": "agentdev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }