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

# error • AI Agent SDK

> error: Emit error event.

# error

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

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

Emit error event.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def error(message: str, tool_name: Optional[str], agent_name: Optional[str], agent_id: Optional[str], metadata: Optional[Dict[str, Any]]) -> None
```

## Parameters

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

<ParamField query="tool_name" type="Optional[str]" required={false}>
  No description available.
</ParamField>

<ParamField query="agent_name" type="Optional[str]" required={false}>
  No description available.
</ParamField>

<ParamField query="agent_id" type="Optional[str]" required={false}>
  No description available.
</ParamField>

<ParamField query="metadata" type="Optional" required={false}>
  No description available.
</ParamField>

## Uses

* `ActionEvent`
* `time.time`

## Used By

* [`DeepResearchAgent.research`](../functions/DeepResearchAgent-research)
* [`DeepResearchAgent.aresearch`](../functions/DeepResearchAgent-aresearch)
* [`Handoff.execute_programmatic`](../functions/Handoff-execute_programmatic)
* [`Handoff.to_tool_function`](../functions/Handoff-to_tool_function)
* [`TypedHandoff.execute_programmatic`](../functions/TypedHandoff-execute_programmatic)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/protocol.py#L341">
  `praisonaiagents/trace/protocol.py` at line 341
</Card>
