Skip to content

Amazon Nova (Bedrock) limitations with tool schema #1623

@chasewalden

Description

@chasewalden

Initial Checks

Description

Was trying to use one of the Nova foundation models on Bedrock, but ran into issues with tool-calling and structured output.

The Nova models seem to be a bit more strict (or less capable, depending who you ask) with regards to tool schemas. The top-level schema must be "type": "object" and the only fields allowed are "type", "properties", and "required". All other fields are disallowed and result in a hard API error.

See the second NOTE on the Nova docs page

Its a pretty annoying limitation, but means that many of the fields that Pydantic generates with the JSON Schema are not allowed. Most critically, `"$defs" are not allowed, so the schema would need to be transformed somehow to allow tool calling.

I know Nova is probably low-priority (and I seem to recall reading somewhere that Anthropic Bedrock was the main use-case for now), but there is nothing that would indicate that this wouldn't work. This might need to be called out in the docs and/or generate a warning/error when trying to use tools and structured output with a Nova model.

Example Code

class Something(BaseModel):
   foo: str
   bar: list[int]

class SomethingElse(BaseModel):
    something: Something
    extra: dict[str, str]

agent = Agent(
    model="bedrock:us.amazon.nova-pro-v1:0", 
    # model="bedrock:us.amazon.nova-lite-v1:0",   # or this
    # model="bedrock:us.amazon.nova-micro-v1:0",  # or this
    instructions="You are a helpful assistant.",
    output_type=Something,
)

@agent.tool_plain
def frobnicate(something_else: SomethingElse):
   print({something_else=!r})

_ = agent.run_sync("frobnicate, and then do what you need to do...")

Python, Pydantic AI & LLM client version

`python>=3.13`
`pydantic-ai==0.1.8`
`pydantic==2.11.3`
`boto3==1.38.4` (Bedrock)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions