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

# Run Autonomous Async • AI Agent SDK

> run_autonomous_async: Async variant of run_autonomous() for concurrent agent execution.

# run\_autonomous\_async

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

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

Async variant of run\_autonomous() for concurrent agent execution.

This method executes a task autonomously using async I/O, enabling
multiple agents to run concurrently without blocking. It handles:

* Progressive escalation based on task complexity
* Doom loop detection and recovery
* Iteration limits and timeouts
* Completion detection (keyword-based or promise-based)
* Optional context clearing between iterations

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def run_autonomous_async(prompt: str, max_iterations: Optional[int], timeout_seconds: Optional[float], completion_promise: Optional[str], clear_context: bool) -> Any
```

## Parameters

<ParamField query="prompt" type="str" required={true}>
  The task to execute
</ParamField>

<ParamField query="max_iterations" type="Optional" required={false}>
  Override max iterations (default from config)
</ParamField>

<ParamField query="timeout_seconds" type="Optional" required={false}>
  Timeout in seconds (default: no timeout)
</ParamField>

<ParamField query="completion_promise" type="Optional" required={false}>
  Optional string that signals completion when  wrapped in \<promise>TEXT\</promise> tags in the response
</ParamField>

<ParamField query="clear_context" type="bool" required={false} default="False">
  Whether to clear chat history between iterations (forces agent to rely on external state like files)
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  AutonomyResult with success status, output, and metadata
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    If autonomy is not enabled
  </Accordion>
</AccordionGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import asyncio

    async def main():
        agent = Agent(instructions="...", autonomy=True)
        result = await agent.run_autonomous_async(
            "Refactor the auth module",
            completion_promise="DONE",
            clear_context=True
        )
        if result.success:
            print(result.output)

    asyncio.run(main())
```

## Uses

* `ValueError`
* `time_module.time`
* `isoformat`
* `datetime.now`
* `get_recommended_stage`
* `AutonomyResult`
* `achat`
* `clear_history`
* `asyncio.sleep`

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Async Feature" icon="clock" href="/docs/features/async" />

  <Card title="Background Tasks" icon="spinner" href="/docs/features/background-tasks" />

  <Card title="Async Jobs" icon="list-check" href="/docs/features/async-jobs" />
</CardGroup>
