Package com.tnsai.annotations
Annotation Interface OutputFormatSpec
Specifies the output format for structured responses from agents or actions.
Can be applied at:
- Type level (Role/Agent class): Sets default format for all actions
- Method level (Action): Overrides the class-level default for specific action
Example usage:
// Role level - all actions default to YAML
@OutputFormatSpec(com.tnsai.output.OutputFormat.YAML)
public class SpecManagerRole extends Role {
// Inherits YAML from class
@Action(description = "Get config")
public Spec getSpec() { ... }
// Override to CSV for this specific action
@Action(description = "Export metrics")
public List<Metric> exportMetrics() { ... }
}
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether to pretty-print the output (where applicable).Class<?> Optional schema hint for formats that support typed schemas (e.g., TONL).The output format to use.
-
Element Details
-
value
OutputFormat valueThe output format to use. Defaults to JSON for maximum compatibility.- Returns:
- the output format
- Default:
JSON
-
prettyPrint
boolean prettyPrintWhether to pretty-print the output (where applicable).- Returns:
- true for pretty-printed output
- Default:
true
-
schema
Class<?> schemaOptional schema hint for formats that support typed schemas (e.g., TONL). When empty, schema is inferred from the return type.- Returns:
- schema class or empty for auto-inference
- Default:
java.lang.Void.class
-