> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Async structured output

## Code

```python cookbook/models/meta/async_structured_output.py theme={null}
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."
    )
)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your LLAMA API key">
    ```bash theme={null}
    export LLAMA_API_KEY=YOUR_API_KEY
    ```
  </Step>

  <Step title="Install libraries">
    ```bash theme={null}
    pip install llama-api-client agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/models/meta/async_structured_output.py
      ```

      ```bash Windows theme={null}
      python cookbook/models/meta/async_structured_output.py
      ```
    </CodeGroup>
  </Step>
</Steps>
