> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Attributes

> Configuration options for the Chat class

## Constructor Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `session_id` | `str` | (required) | Unique identifier for this chat session |
| `user_id` | `str` | (required) | Unique identifier for the user |
| `agent` | `Agent` | (required) | The Agent instance to handle conversations |
| `storage` | `Storage` | `None` | Storage backend (defaults to InMemoryStorage) |
| `full_session_memory` | `bool` | `True` | Store full conversation history |
| `summary_memory` | `bool` | `False` | Enable conversation summarization |
| `user_analysis_memory` | `bool` | `False` | Enable user profile analysis |
| `user_profile_schema` | `type` | `None` | Custom Pydantic schema for user profiles |
| `dynamic_user_profile` | `bool` | `False` | Auto-generate profile schema from conversations |
| `num_last_messages` | `int` | `None` | Limit history to last N messages |
| `feed_tool_call_results` | `bool` | `False` | Include tool calls in memory |
| `user_memory_mode` | `'update' \| 'replace'` | `'update'` | How to update user profiles |
| `debug` | `bool` | `False` | Enable debug logging |
| `debug_level` | `int` | `1` | Debug verbosity (1=standard, 2=detailed) |
| `max_concurrent_invocations` | `int` | `1` | Maximum concurrent invoke calls |
| `retry_attempts` | `int` | `3` | Number of retry attempts for failed calls |
| `retry_delay` | `float` | `1.0` | Delay between retry attempts (seconds) |

## Instance Properties

| Property | Type | Description |
| - | - | - |
| `state` | `SessionState` | Current session state (IDLE, AWAITING\_RESPONSE, STREAMING, ERROR) |
| `all_messages` | `List[ChatMessage]` | All messages in the session |
| `usage` | `AggregatedUsage` | Read-only view over every model call recorded for this session — tokens, cost, requests, tool calls, timing. See [Metrics](/concepts/chat/metrics). |
| `start_time` | `float` | Session start time (Unix timestamp) |
| `end_time` | `float` | Session end time (None if active) |
| `duration` | `float` | Wall-clock session duration in seconds |
| `last_activity` | `float` | Time since last activity in seconds |
| `is_closed` | `bool` | Whether the session is closed |

## Example

```python theme={null}
import asyncio
from upsonic import Agent, Chat


async def main():
    agent = Agent("anthropic/claude-sonnet-4-5")

    chat = Chat(
        session_id="session1",
        user_id="user1",
        agent=agent,
        full_session_memory=True,
        summary_memory=True,
        num_last_messages=50,
        retry_attempts=3
    )

    response = await chat.invoke("Hello!")
    print(response)

    print(f"State: {chat.state.value}")
    if chat.usage.cost is not None:
        print(f"Cost: ${chat.usage.cost:.4f}")
    print(f"Tokens: {chat.usage.total_tokens}")


if __name__ == "__main__":
    asyncio.run(main())
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.