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

# Assistants Guide

> Create and use custom AI assistants with persistent instructions and context

Assistants are reusable AI personas with persistent system prompts. Instead of sending a long system message on every request, you create an assistant once and reference it by ID.

## Creating an Assistant

```python theme={null}
import requests

response = requests.post(
    "https://elumenta.ru/api/v2/assistants",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "name": "Customer Support Bot",
        "model": "claude-sonnet-4.5",
        "instructions": "You are a friendly customer support agent for Elumenta. Answer questions about pricing, models, and API usage. Be concise and helpful. If you don't know the answer, say so.",
        "description": "Handles customer support queries"
    }
)

assistant = response.json()
print(assistant["id"])  # asst_01j9x2abc123
```

## Using an Assistant

Once created, use the assistant ID instead of repeating the system prompt:

```python theme={null}
response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "assistant_id": "asst_01j9x2abc123",
        "messages": [
            {"role": "user", "content": "What's the difference between Pro and VIP plans?"}
        ]
    }
)

print(response.json()["content"])
```

## Marketplace Assistants

Browse community-built assistants without creating your own:

```python theme={null}
# List available marketplace assistants
response = requests.get(
    "https://elumenta.ru/api/v2/assistants/marketplace",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    params={"category": "productivity", "limit": 10}
)

for assistant in response.json()["items"]:
    print(f"{assistant['name']} — {assistant['description']}")
```

## Use Cases

| Use case      | Instructions example                                                                               |
| ------------- | -------------------------------------------------------------------------------------------------- |
| Code reviewer | `"Review code for bugs, security issues, and style. Provide specific line-by-line feedback."`      |
| Translator    | `"Translate all user input to English. Preserve formatting and tone."`                             |
| Data analyst  | `"Analyze data the user provides. Always output structured JSON results with insights."`           |
| Email writer  | `"Write professional business emails. Keep them concise, under 150 words unless asked otherwise."` |

## Managing Assistants

```python theme={null}
# List your assistants
requests.get("/api/v2/assistants", headers=headers)

# Update an assistant
requests.put("/api/v2/assistants/asst_01j9x2abc123", 
    headers=headers,
    json={"instructions": "Updated instructions..."}
)

# Delete an assistant
requests.delete("/api/v2/assistants/asst_01j9x2abc123", headers=headers)
```

<Note>
  Assistants store only instructions — not conversation history. Each call to `/generate` with an `assistant_id` is stateless. Manage multi-turn context yourself by passing the full `messages` array.
</Note>
