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

# What is an Agent?

> Understanding stateful agents and their role in the Clinia platform

In the context of the Clinia platform, an **agent** is an intelligent service that interacts with users, calls tools, and manages its own state. Agents are designed to handle complex medical workflows, build long‑term relationships with users and other agents, and deliver accurate clinical recommendations.

A key design question in any agentic system is whether the agent is **stateful** or **stateless**—that is, whether it can remember past interactions.

## Stateful versus Stateless Systems

At the heart of the stateful/stateless debate is **memory** and **context management**.

## Stateless Systems

A stateless platform processes each request independently and treats every interaction as a brand‑new conversation. This makes stateless systems:

✅ **Simple to deploy and scale**\
❌ **Limited in personalization and context**\
❌ **Require client applications to manage conversation history**

<Note>
  Stateless APIs—such as the familiar ChatCompletions endpoint—require client applications to keep track of conversation history and user personalization on their own.
</Note>

## Stateful Systems

By contrast, a stateful platform retains information across interactions. This allows an agent to:

✅ **Remember past conversations and user preferences**\
✅ **Maintain clinical context for personalized experiences**\
✅ **Excel in multi‑step workflows and complex use cases**\
❌ **Require more resources and architectural complexity**

## Clinia's Approach

Clinia agents are built on a **stateful architecture**. Instead of forcing client applications to manage memory, the platform persists an agent's state—including conversation history, core memory, and tool configuration—on the server.

This design ensures that each agent can:

* 🧠 **Learn from previous interactions**
* 📈 **Continuously improve recommendations**
* 🔄 **Maintain context across sessions**

<Info>
  Clinia's stateful approach contrasts with stateless chat APIs, where context and personalization must be reassembled on every call.
</Info>

## Why State Matters in Healthcare

Healthcare workflows often involve **long‑running engagements** and **sensitive context**.

### Real-World Examples

<CardGroup cols={2}>
  <Card title="Family History Extraction" icon="family">
    Extracting family or social history from encounter notes requires understanding what information has already been captured to avoid repetitive questions.
  </Card>

  <Card title="Billing Code Recommendations" icon="receipt">
    Smart billing workflows benefit from combining long‑term memory with real‑time information about the patient and clinician.
  </Card>
</CardGroup>

By storing this state centrally, Clinia:

* ❌ **Avoids frustration for clinicians**
* ✅ **Improves recommendation accuracy**
* 🔒 **Maintains compliance and audit trails**

## Key Agent Concepts

<CardGroup cols={2}>
  <Card title="Tool Orchestration" icon="wrench" href="/explanation/agents/tools">
    Agents decide when to call tools (such as semantic search or FHIR/OMOP queries) to enrich their responses. Tool rules help enforce execution order and termination conditions.
  </Card>

  <Card title="Core and External Memory" icon="brain" href="/explanation/agents/memory">
    Agents maintain structured memory blocks (user, clinical and persona memories) that persist across conversations. See the agent memory page for details.
  </Card>

  <Card title="Collaboration" icon="handshake" href="/explanation/agents/service">
    Agents can share core memory and coordinate with background or workflow agents when tasks require multiple roles. See Agents as a Service for more on how agents collaborate and persist state.
  </Card>
</CardGroup>

***

<Tip>
  Clinia's vision is to offer **stateful, specialized agents** that learn and evolve from interactions, so that healthcare providers can trust their recommendations. Understanding the difference between stateful and stateless systems helps explain why Clinia prioritizes persistent memory and long‑term context in its agentic platform.
</Tip>
