> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Small Model • AI Agent SDK

> get_small_model: Resolve the auxiliary/'small' model for cheap internal LLM calls.

# get\_small\_model

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**loader**](../modules/loader) module.

Resolve the auxiliary/"small" model for cheap internal LLM calls.

Resolution order:

1. `defaults.small_model` (or the equivalent `agent.small_model` CLI
   namespace) from the config file, if set.
2. The supplied `primary_model` (e.g. the running agent's model).
3. `defaults.model` (or `agent.model`) from the config file, if set.
4. `fallback` (preserves today's hardcoded behaviour when nothing else
   is configured).

Both the `defaults.*` (typed loader) and `agent.*` (CLI resolver / JSON
schema) namespaces are honoured because they read the same config file; a
user following schema autocomplete (`agent.small_model`) is therefore not
silently ignored.

This keeps internal calls (title generation, summarisation/compaction) on
a configured cheap model, and — when unset — on the primary model rather
than a hardcoded third-party default.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def get_small_model(primary_model: Optional[str], fallback: Optional[str]) -> Optional[str]
```

## Parameters

<ParamField query="primary_model" type="Optional[str]" required={false}>
  The primary model to fall back to when no auxiliary model is configured.
</ParamField>

<ParamField query="fallback" type="Optional[str]" required={false}>
  Final fallback used only when neither `small_model` nor a primary model is available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Optional[str]">
  The resolved auxiliary model identifier, or `fallback`.
</ResponseField>

## Uses

* `get_default`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/config/loader.py#L463">
  `praisonaiagents/config/loader.py` at line 463
</Card>
