You are viewing v1 docs. For the latest documentation, visit docs.agno.com
import asyncio from typing import List from pydantic import BaseModel, Field from agno.agent import Agent from agno.models.meta import Llama class MovieScript(BaseModel): name: str = Field(..., description="Name of the movie.") setting: str = Field(..., description="Provide a setting for the movie.") ending: str = Field(..., description="Describe the movie ending.") genre: str = Field(..., description="Genre of the movie.") characters: List[str] = Field(..., description="List of characters.") storyline: str = Field(..., description="A 3-sentence storyline.") agent = Agent( model=Llama(id="Llama-3.3-70B"), response_model=MovieScript, markdown=True, ) asyncio.run( agent.aprint_response( "Generate a movie script outline for a sci-fi adventure." ) )
Create a virtual environment
Terminal
python3 -m venv .venv source .venv/bin/activate
Set your LLAMA API key
export LLAMA_API_KEY=YOUR_API_KEY
Install libraries
pip install llama-api-client agno
Run Agent
python cookbook/models/meta/async_structured_output.py
Was this page helpful?