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

# Session • AI Agent SDK

> Session: A simple wrapper around PraisonAI's existing stateful capabilities.

# Session

> Defined in the [**session**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/session.md) module.

AI Agent

A simple wrapper around PraisonAI's existing stateful capabilities.

Provides a unified API for:

* Session management with persistent state
* Memory operations (short-term, long-term, user-specific)
* Knowledge base operations
* Agent state management
* Remote agent connectivity

## Constructor

**session\_id** `Optional`

No description available.

**user\_id** `Optional`

No description available.

**agent\_url** `Optional`

No description available.

**memory\_config** `Optional`

No description available.

**knowledge\_config** `Optional`

No description available.

**timeout** `int` (default: 30)

No description available.

## Methods

> [card] [memory()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-memory.md)
>
> Lazy-loaded memory instance

> [card] [knowledge()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-knowledge.md)
>
> Lazy-loaded knowledge instance

> [card] [Agent()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-Agent.md)
>
> Create an agent with session context.

> [card] [create\_agent()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-create_agent.md)
>
> Backward compatibility wrapper for Agent method

> [card] [save\_state()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-save_state.md)
>
> Save session state data to memory.

> [card] [restore\_state()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-restore_state.md)
>
> Restore session state from memory.

> [card] [get\_state()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-get_state.md)
>
> Get a specific state value

> [card] [set\_state()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-set_state.md)
>
> Set a specific state value

> [card] [increment\_state()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-increment_state.md)
>
> Increment a numeric state value

> [card] [add\_memory()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-add_memory.md)
>
> Add information to session memory.

> [card] [search\_memory()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-search_memory.md)
>
> Search session memory.

> [card] [add\_knowledge()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-add_knowledge.md)
>
> Add knowledge source to session.

> [card] [search\_knowledge()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-search_knowledge.md)
>
> Search session knowledge base.

> [card] [clear\_memory()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-clear_memory.md)
>
> Clear session memory.

> [card] [get\_context()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-get_context.md)
>
> Build context from session memory and knowledge.

> [card] [chat()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-chat.md)
>
> Send a message to the remote agent or handle local session.

> [card] [send\_message()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/Session-send_message.md)
>
> Alias for chat() method to match Google ADK pattern.

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Local session with agent
    session = Session(session_id="chat_123", user_id="user_456")
    agent = session.Agent(name="Assistant", role="Helpful AI")
    
    # Remote agent session (similar to Google ADK)
    session = Session(agent_url="192.168.1.10:8000/agent")
    response = session.chat("Hello from remote client!")
    
    # Save session state
    session.save_state({"conversation_topic": "AI research"})
```

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/session.py#L23)
>
> `praisonaiagents/session.py` at line 23

***

## Related Documentation

> [card] [Session Management](https://praison.ai/docs/concepts/session-management.md)

> [card] [Sessions Feature](https://praison.ai/docs/features/sessions.md)

> [card] [Session Persistence](https://praison.ai/docs/features/session-persistence.md)


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