File size: 3,483 Bytes
1d5163f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from python.helpers.api import ApiHandler, Request, Output
import os

class Docs(ApiHandler):
    @classmethod
    def requires_auth(cls) -> bool:
        return False

    @classmethod
    def requires_csrf(cls) -> bool:
        return False

    @classmethod
    def get_methods(cls) -> list[str]:
        return ["GET"]

    async def process(self, input: dict, request: Request) -> dict:
        auth_token = os.getenv("AUTHENTICATION_TOKEN")
        auth_type = "Bearer token required" if auth_token else "Basic Auth or API Key required"
        
        return {
            "title": "Agent-skillset API Documentation",
            "authentication": auth_type,
            "endpoints": [
                {
                    "path": "/health",
                    "method": "GET",
                    "description": "Check if the service is running.",
                    "auth_required": False
                },
                {
                    "path": "/chat",
                    "method": "POST",
                    "description": "Send a message and receive the final response.",
                    "parameters": {
                        "message": "The text message to send (required).",
                        "subagent": "The name of the agent profile to use (optional).",
                        "file": "Base64 encoded file content for context (optional).",
                        "file_name": "The name of the file being uploaded (optional).",
                        "context": "The ID of an existing chat context (optional)."
                    },
                    "headers": {
                        "Authorization": "Bearer YOUR_AUTHENTICATION_TOKEN"
                    }
                },
                {
                    "path": "/stream",
                    "method": "POST",
                    "description": "Stream the agent's response using Server-Sent Events (SSE).",
                    "parameters": {
                        "message": "The text message to send (required).",
                        "subagent": "The name of the agent profile to use (optional).",
                        "file": "Base64 encoded file content for context (optional).",
                        "file_name": "The name of the file being uploaded (optional).",
                        "context": "The ID of an existing chat context (optional)."
                    },
                    "headers": {
                        "Authorization": "Bearer YOUR_AUTHENTICATION_TOKEN"
                    }
                },
                {
                    "path": "/set",
                    "method": "POST",
                    "description": "Dynamically update application settings and API keys.",
                    "parameters": {
                        "any_setting_key": "The value to set for that setting.",
                        "api_key_PROVIDER": "Set the API key for a specific provider (e.g., api_key_openai)."
                    },
                    "headers": {
                        "Authorization": "Bearer YOUR_AUTHENTICATION_TOKEN"
                    }
                },
                {
                    "path": "/get",
                    "method": "GET",
                    "description": "Retrieve the current application settings.",
                    "headers": {
                        "Authorization": "Bearer YOUR_AUTHENTICATION_TOKEN"
                    }
                }
            ]
        }