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

# generate • AI Agent SDK

> generate: Generate code from natural language description.

# generate

<div className="flex items-center gap-2">
  <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 from natural language description.

## Signature

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

## Parameters

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

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

### Returns

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

## Uses

* `completion`

## Used By

* [`CodeAgent.generate_code`](../functions/CodeAgent-generate_code)
* [`VideoAgent.start`](../functions/VideoAgent-start)
* [`VideoAgent.run`](../functions/VideoAgent-run)

## Source

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