> ## Documentation Index
> Fetch the complete documentation index at: https://ikun.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent with Structured Outputs

## Code

```python cookbook/models/aws/bedrock/structured_output.py theme={null}
from typing import List

from agno.agent import Agent, RunResponse  # noqa
from agno.models.aws import AwsBedrock
from pydantic import BaseModel, Field
from rich.pretty import pprint  # noqa


class MovieScript(BaseModel):
    setting: str = Field(
        ..., description="提供一个适合大片的场景。"
    )
    ending: str = Field(
        ...,
        description="电影的结局。如果不可用，请提供一个快乐的结局。",
    )
    genre: str = Field(
        ...,
        description="电影的类型。如果不可用，请选择动作、惊悚或浪漫喜剧。",
    )
    name: str = Field(..., description="给这部电影起个名字")
    characters: List[str] = Field(..., description="这部电影的角色名字。")
    storyline: str = Field(
        ..., description="这部电影的3句故事梗概。要精彩！"
    )


movie_agent = Agent(
    model=AwsBedrock(id="mistral.mistral-large-2402-v1:0"),
    description="您帮助人们编写电影剧本。",
    response_model=MovieScript,
)

# Get the response in a variable
# movie_agent: RunResponse = movie_agent.run("New York")
# pprint(movie_agent.content)

movie_agent.print_response("New York")
```

## Usage

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

  <Step title="设置您的 AWS 凭证">
    ```bash theme={null}
    export AWS_ACCESS_KEY_ID=***
    export AWS_SECRET_ACCESS_KEY=***
    export AWS_REGION=***
    ```
  </Step>

  <Step title="安装库">
    ```bash theme={null}
    pip install -U boto3 agno
    ```
  </Step>

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/models/aws/bedrock/structured_output.py
      ```

      ```bash Windows theme={null}
      python cookbook/models/aws/bedrock/structured_output.py
      ```
    </CodeGroup>
  </Step>
</Steps>
