> ## 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.

# To Model Output • AI Agent SDK

> to_model_output: Optional hook returning a compact, model-facing view of ``result``.

# to\_model\_output

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**BaseTool**](../classes/BaseTool) class in the [**base**](../modules/base) module.

Optional hook returning a compact, model-facing view of `result`.

`result` is the tool's raw return **value** (the `output` channel),
not the enclosing :class:`ToolResult`. This is the single hook contract
used everywhere: `safe_run` and the agent executor both invoke it with
the output value. Override to feed the LLM a terse summary/diff instead
of the full tool output for context economy; the full `result` still
reaches display, hooks, and tracing. Return `None` (the default) to
keep today's behaviour where the model sees the full output.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def to_model_output(result: Any) -> Optional[Any]
```

## Parameters

<ParamField query="result" type="Any" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Optional[Any]">
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/tools/base.py#L270">
  `praisonaiagents/tools/base.py` at line 270
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Output Concept" icon="file-export" href="/docs/docs/concepts/output" />

  <Card title="Output Configuration" icon="gear" href="/docs/docs/configuration/output-config" />

  <Card title="Save Output" icon="floppy-disk" href="/docs/docs/features/save-output" />
</CardGroup>
