Skip to main content

Quick Start


How It Works

Two-Stage Process

Stage 1: Task Execution
  • MobileAgent 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
Stage 2: Extraction (Post-Completion)
  • 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 the structured_output LLM profile. If not configured, it falls back to the fast_agent LLM. You can specify a dedicated structured_output profile: config.yaml:
Programmatically:

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:
2. Provide defaults for optional fields - Prevents extraction failures:
3. Guide data collection in your goal:

Troubleshooting

Extraction returns None:
  • Verify output_model is passed to MobileAgent
  • Check if task succeeded: result.success
  • Enable debug logging: config.logging.debug = True
Partial or incorrect data:
  • Add more specific field descriptions
  • Mention required fields explicitly in the goal
Validation errors:
  • Add Optional and defaults for uncertain fields

Advanced

Multiple Items

Extract lists of data using a model with List fields:

Workflow Integration

Extraction happens automatically in MobileAgent.finalize():