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

# agenerate • AI Agent SDK

> agenerate: Generate code asynchronously.

# agenerate

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

> This is a method of the [**CodeAgent**](../classes/CodeAgent) class in the [**code\_agent**](../modules/code_agent) module.

Generate code asynchronously.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def agenerate(prompt: str, language: str) -> str
```

## Parameters

<ParamField query="prompt" type="str" required={true}>
  Natural language description
</ParamField>

<ParamField query="language" type="str" required={false} default="'python'">
  Target programming language \*\*kwargs: Additional arguments
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  Generated code as string
</ResponseField>

## Uses

* `acompletion`

## Used By

* [`VideoAgent.astart`](../functions/VideoAgent-astart)
* [`VideoAgent.arun`](../functions/VideoAgent-arun)

## Source

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