Learn how to use input and output with Agents.
str
input and str
output.
MovieScript
for us.
Structured Output example
Run the example
MovieScript
class, here’s how it looks:
use_json_mode=True
on the Agent.output_schema
. This returns the structured output as a single RunContent
event in the stream of events.
Streaming Structured Output example
Run the example
Agent.run()
or Agent.print_response()
as the input
parameter.
Structured Input example
Run the example
input_schema
on the Agent to validate the input. If you then pass the input as a dictionary, it will be automatically validated against the schema.
Validating the input example
Run the example
parser_model_prompt
to your Parser Model to customize the model’s instructions.
output_model_prompt
to your Output Model to customize the model’s instructions.