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

# chat • AI Agent SDK

> chat: Send a message to the remote agent or handle local session.

# chat

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

> This is a method of the [**Session**](../classes/Session) class in the [**session**](../modules/session) module.

Send a message to the remote agent or handle local session.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def chat(message: str) -> str
```

## Parameters

<ParamField query="message" type="str" required={true}>
  The message to send to the agent \*\*kwargs: Additional parameters for the request
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  The agent's response
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    If this is not a remote session
  </Accordion>

  <Accordion title="ConnectionError">
    If unable to communicate with remote agent
  </Accordion>
</AccordionGroup>

## Uses

* `ValueError`
* `requests.post`
* `response.raise_for_status`
* `response.json`
* `ConnectionError`

## Used By

* [`Agent.run_autonomous`](../functions/Agent-run_autonomous)
* [`Agent.chat_with_context`](../functions/Agent-chat_with_context)
* [`Agent.run`](../functions/Agent-run)
* [`Agent.start`](../functions/Agent-start)
* [`Agent.execute`](../functions/Agent-execute)

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Chat Feature" icon="comments" href="/docs/features/chat" />

  <Card title="Conversation Stores" icon="database" href="/docs/databases/overview" />
</CardGroup>
