# Agent

The `Agent` class provides a convenient interface for the most important Rasa functionality.

This includes training, handling messages, loading a dialogue model, getting the next action, and handling a channel.

## Methods

### `create_processor(preprocessor=None)`
Instantiates a processor based on the set state of the agent.

**Return type**: `MessageProcessor`

### `_async execute_action(sender_id, action, output_channel, policy, confidence)`
Handle a single message.

**Return type**: [`DialogueStateTracker`](https://legacy-docs-v1.rasa.com/1.10.26/api/tracker/#rasa.core.trackers.DialogueStateTracker)

### `handle_channels(channels, http_port=5005, route='/webhooks/', cors=None)`
Start a webserver attaching the input channels and handling msgs.

**Return type**: `Sanic`

### `_async handle_message(message, message_preprocessor=None, **kwargs)`
Handle a single message.

**Return type**: `Optional[List[Dict[str, Any]]]`

### `_async handle_text(text_message, message_preprocessor=None, output_channel=None, sender_id='default')`
Handle a single message.

**Return type**: `Optional[List[Dict[str, Any]]]`

### `is_core_ready()`
Check if all necessary components and policies are ready to use the agent.

**Return type**: `bool`

### `is_ready()`
Check if all necessary components are instantiated to use agent.

**Return type**: `bool`

### `_classmethod load(model_path, interpreter=None, generator=None, tracker_store=None, lock_store=None, action_endpoint=None, model_server=None, remote_storage=None, path_to_model_archive=None)`
Load a persisted model from the passed path.

**Return type**: [`Agent`](https://legacy-docs-v1.rasa.com/1.10.26/api/agent/#rasa.core.agent.Agent)

## Example Code
```python
from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter
agent = Agent.load("examples/restaurantbot/models/current")
await agent.handle_text("hello")
```

**Return type**: `Optional[List[Dict[str, Any]]]`

### `train(training_trackers, **kwargs)`
Train the policies / policy ensemble using dialogue data from file.

### Images
