Quick Start
How It Works
Two-Stage Process
Stage 1: Task Execution- DroidAgent performs device actions while collecting required information
- System prompt is automatically injected with your Pydantic schema
- Agent completes with natural language answer containing the data
StructuredOutputAgent
receives the final answer text- Uses LLM’s
astructured_predict()
to extract data into your model - Validates against schema and returns typed object or
None
Example: Invoice Extraction
Working with Results
Accessing Data
Exporting to JSON
Configuration
Custom Extraction LLM
By default, extraction uses thecodeact
LLM. Specify a dedicated structured_output
profile:
config.yaml:
Reasoning Mode
Works in both direct and reasoning modes:Best Practices
1. Add clear field descriptions - The LLM uses these to understand what to extract:Troubleshooting
Extraction returns None:- Verify
output_model
is passed toDroidAgent
- Check if task succeeded:
result.success
- Enable debug logging:
config.logging.debug = True
- Add more specific field descriptions
- Mention required fields explicitly in the goal
- Add
Optional
and defaults for uncertain fields
Advanced
Multiple Items
Extract lists of data using a model withList
fields:
Workflow Integration
Extraction happens automatically inDroidAgent.finalize()
: