Skip to content

← Back to YouLab

Complete HTTP API reference for the YouLab service.

http://localhost:8100

Currently no authentication required. Optional API key support via YOULAB_SERVICE_API_KEY.


Check service health and Letta connection.

Response:

{
"status": "ok",
"letta_connected": true,
"honcho_connected": true,
"version": "0.1.0"
}
FieldTypeDescription
statusstring"ok" or "degraded"
letta_connectedbooleanLetta server reachable
honcho_connectedbooleanHoncho service reachable
versionstringService version (e.g., "0.1.0")

Create a new agent for a user.

Request:

{
"user_id": "user123",
"agent_type": "tutor",
"user_name": "Alice"
}
FieldTypeRequiredDefault
user_idstringYes-
agent_typestringNo"tutor"
user_namestringNonull

Response (201):

{
"agent_id": "agent-abc123",
"user_id": "user123",
"agent_type": "tutor",
"agent_name": "youlab_user123_tutor",
"created_at": "2025-12-31T10:00:00Z"
}

Errors:

  • 400 - Unknown agent type
  • 500 - Agent created but info retrieval failed
  • 503 - Letta unavailable

Get agent by ID.

Response:

{
"agent_id": "agent-abc123",
"user_id": "user123",
"agent_type": "tutor",
"agent_name": "youlab_user123_tutor",
"created_at": "2025-12-31T10:00:00Z"
}

Errors:

  • 404 - Agent not found

List agents.

Query Parameters:

ParameterTypeDescription
user_idstringFilter by user

Response:

{
"agents": [
{
"agent_id": "agent-abc123",
"user_id": "user123",
"agent_type": "tutor",
"agent_name": "youlab_user123_tutor",
"created_at": "2025-12-31T10:00:00Z"
}
]
}

Send message (synchronous).

Request:

{
"agent_id": "agent-abc123",
"message": "Help me brainstorm essay topics",
"chat_id": "chat-xyz",
"chat_title": "Essay Brainstorming"
}
FieldTypeRequired
agent_idstringYes
messagestringYes
chat_idstringNo
chat_titlestringNo

Response:

{
"response": "Great! Let's explore some essay topics...",
"agent_id": "agent-abc123"
}

Errors:

  • 404 - Agent not found
  • 503 - Communication failed

Send message with SSE streaming.

Request:

{
"agent_id": "agent-abc123",
"message": "What makes a compelling narrative?",
"chat_id": "chat-xyz",
"chat_title": "Essay Writing",
"enable_thinking": true
}
FieldTypeRequiredDefault
agent_idstringYes-
messagestringYes-
chat_idstringNonull
chat_titlestringNonull
enable_thinkingbooleanNotrue

Response (SSE):

data: {"type": "status", "content": "Thinking..."}
data: {"type": "message", "content": "A compelling narrative..."}
data: {"type": "done"}

Event Types:

TypeDescription
statusProcessing indicator
messageResponse content
doneStream complete
errorError message

Upload document to archival memory.

Request:

{
"content": "# Architecture\n\nYouLab uses...",
"tags": ["architecture", "design"]
}
FieldTypeRequiredDefault
contentstringYes-
tagsarray[string]No[]

Response (201):

{
"success": true
}

Errors:

  • 503 - Letta unavailable

Query strategy agent.

Request:

{
"question": "What is the YouLab architecture?"
}

Response:

{
"response": "Based on the documentation..."
}

Errors:

  • 503 - Letta unavailable

Search archival memory.

Query Parameters:

ParameterTypeDefault
querystringRequired
limitinteger5

Response:

{
"documents": [
"[TAGS: architecture]\n# Architecture\n..."
]
}

Errors:

  • 503 - Letta unavailable

Check strategy agent status.

Response:

{
"status": "ready",
"agent_exists": true
}
StatusMeaning
readyAgent exists
not_readyAgent not created

List configured background agents.

Response:

[
{
"id": "insight-harvester",
"name": "Student Insight Harvester",
"course_id": "college-essay",
"enabled": true,
"triggers": {
"schedule": "0 3 * * *",
"idle_enabled": false,
"manual": true
},
"query_count": 3
}
]

Manually trigger a background agent.

Request (optional):

{
"user_ids": ["user123"]
}
FieldTypeRequired
user_idsarrayNo

Response:

{
"agent_id": "insight-harvester",
"started_at": "2025-01-08T03:00:00Z",
"completed_at": "2025-01-08T03:05:00Z",
"users_processed": 25,
"queries_executed": 75,
"enrichments_applied": 68,
"error_count": 7,
"errors": []
}

Errors:

  • 404 - Agent not found
  • 500 - System not initialized

Reload TOML configuration.

Query Parameters:

ParameterTypeDefault
config_dirstringconfig/courses

Response:

{
"success": true,
"courses_loaded": 1,
"course_ids": ["college-essay"],
"message": "Configuration reloaded successfully"
}

All errors follow this format:

{
"detail": "Error message here"
}
CodeMeaning
400Bad request (invalid input)
404Resource not found
500Internal server error
503Service unavailable (Letta down)

Terminal window
curl -X POST http://localhost:8100/agents \
-H "Content-Type: application/json" \
-d '{"user_id": "user123", "agent_type": "tutor"}'
Terminal window
curl -X POST http://localhost:8100/chat \
-H "Content-Type: application/json" \
-d '{"agent_id": "...", "message": "Hello"}'
Terminal window
curl -N -X POST http://localhost:8100/chat/stream \
-H "Content-Type: application/json" \
-d '{"agent_id": "...", "message": "Hello"}'
Terminal window
curl -X POST http://localhost:8100/strategy/documents \
-H "Content-Type: application/json" \
-d '{"content": "# Docs", "tags": ["docs"]}'