# `Condukt.Session`
[🔗](https://github.com/tuist/condukt/blob/1.5.1/lib/condukt/session.ex#L1)

GenServer that manages an agent session.

The session maintains:
- Conversation history (messages)
- Current model configuration
- Available tools
- Streaming state

## The Agent Loop

When a prompt is received:

1. Add user message to history
2. Call LLM with system prompt, messages, and tools
3. If LLM returns tool calls:
   - Execute each tool
   - Add tool results to history
   - Go to step 2
4. If LLM returns text only, return response

# `abort`

Aborts the current operation.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `clear`

Clears the conversation history.

# `compact`

Runs the configured compactor against the current message history.

No-op when no compactor is configured. The compacted snapshot is
immediately persisted if a session store is configured.

# `follow_up`

Queues a follow-up message.

# `history`

Returns the conversation history.

# `id`

Returns the unique identifier for this session.

Sessions are identified by a UUIDv7 generated when the session starts, or by
the value passed via the `:id` option to `start_link/2` / `start/2`. The id
is included in telemetry metadata so subscribers can group all events
emitted by a single agentic run.

# `run`

Runs a prompt synchronously, returning the final response.

# `steer`

Injects a steering message.

# `stream`

Streams a prompt, returning an enumerable of events.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
