@agent decorator marks a class as a deployable agent and configures its Ray Actor resources.
- Statefulness: Maintain state across requests
- Resource isolation: Guaranteed CPU, GPU, and memory allocation
- Horizontal scaling: Multiple replicas for high availability
Resource Options
| Option | Type | Default | Description |
|---|---|---|---|
num_cpus | int | 1 | CPU cores per replica |
num_gpus | int | 0 | GPUs per replica |
memory | str | ”2GB” | Memory per replica |
num_replicas | int | 1 | Number of replicas for scaling |
If your agent uses async operations, define
async def run() - RayAI automatically detects and awaits it.