> ## 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 Agents • AI Agents Framework

> run_agents: Runs the agents and returns the result.

# run\_agents

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

> This function is defined in the [**chainlit\_ui**](../modules/chainlit_ui) module.

Runs the agents and returns the result.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: run_agents"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def run_agents(agent_file: str, framework: str) -> Any
```

## Parameters

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

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

### Returns

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

## Uses

* `AgentsGenerator`
* `StringIO`
* `redirect_stdout`
* `agents_generator.generate_crew_and_kickoff`
* `stdout_buffer.getvalue`
* `cl.Step`
* `splitlines`
* `step.stream_token`
* `output`
* `cl.step`

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
