Quick Start
Get an AI agent running in four steps — create an agent, add a knowledge source, train it, then start chatting.
Step 1 — Create an Agent#
Create your agent with a name and category. Save the id from the response — you'll need it in every subsequent step.
curl -X POST 'https://api.7en.ai/api/v1/agents/' \
-H 'Authorization: Api-Key YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "Support Bot",
"agent_category": "chatbot"
}'// Save the agent id from the response
{
"data": {
"id": 671,
"name": "Support Bot",
"status": "Idle"
}
}Step 2 — Add a Knowledge Source#
Attach content to your agent so it has something to learn from. Supported types include url, text, and file.
curl -X POST 'https://api.7en.ai/api/v1/knowledge-source/' \
-H 'Authorization: Api-Key YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"agent": 671,
"source_type": "url",
"url": "https://your-site.com/help"
}'{
"data": {
"id": 42,
"agent": 671,
"source_type": "url",
"status": "Pending"
}
}Step 3 — Train the Agent#
Trigger training to index all attached knowledge sources. The agent's status immediately changes to "Training" and transitions to "Active" on success.
curl -X POST 'https://api.7en.ai/api/v1/agents/671/train-agent/' \
-H 'Authorization: Api-Key YOUR_API_KEY'The endpoint streams back SSE events as training progresses:
training_started
{"message": "Agent training has started", "agent_id": "671", "status": "Training", ...}
training_training
{"train_data": {"phase": "extracting", "message": "Starting text extraction", ...}}
training_training
{"train_data": {"phase": "embedding_start", "message": "Starting embedding for 1 chunks", ...}}
training_active
{"agent_id": "671", "status": "Active", "train_data": {"phase": "embedding_completed", ...}}Training time
Training typically completes within seconds to a few minutes depending on the size of the knowledge sources. Wait for status: "Active" before starting a chat session.
Step 4 — Chat via WebSocket#
Connect to the WebSocket endpoint and send messages to start a real-time conversation with your agent.
# WebSocket URL
wss://api.7en.ai/ws/api/chat/671/?api_key=YOUR_API_KEY// Send a message
{ "message": "Hello, how can you help me?" }
// Receive a response
{
"type": "bot_response",
"content": "Hi! I'm your Support Bot. How can I help you today?",
"session_id": "f5a48aab-9b43-4e88-b3a1-319475e385e0"
}What's next#
- Authentication — learn how to manage and rotate API keys
- Agent Operations — full agent configuration options
- Knowledge Sources — all supported source types
- Error Handling — understand error codes and responses