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

# block • AI Agents Framework

> block: Context manager for profiling a block of code.

# block

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

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

Context manager for profiling a block of code.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def block(name: str, category: str) -> Any
```

## Parameters

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

<ParamField query="category" type="str" required={false} default="'block'">
  No description available.
</ParamField>

### Returns

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

## Uses

* `time.time`
* `cls.record_timing`
* `cls.record_flow`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai/praisonai/profiler.py#L337">
  `praisonai/profiler.py` at line 337
</Card>
