@@ -18,6 +18,7 @@ Ask Purple AI a question asynchronously.
1818
1919** Example:**
2020``` python
21+ import uuid
2122import asyncio
2223from purple_mcp.libs.purple_ai import (
2324 ask_purple,
@@ -34,14 +35,15 @@ async def main():
3435 user_details = PurpleAIUserDetails(
3536 account_id = " 123456789" ,
3637 team_token = " team-token" ,
38+ session_id = uuid.uuid4().hex,
3739 email_address = " [email protected] " ,
3840 user_agent = " MyApp/1.0" ,
3941 build_date = " 2025-01-01" ,
4042 build_hash = " abc123" ,
4143 ),
4244 console_details = PurpleAIConsoleDetails(
4345 base_url = " https://console.example.com" ,
44- version = " S-25.1.1#30 " ,
46+ version = " S" ,
4547 ),
4648 )
4749
@@ -72,6 +74,7 @@ Ask Purple AI a question synchronously.
7274
7375** Example:**
7476``` python
77+ import uuid
7578from purple_mcp.libs.purple_ai import sync_ask_purple, PurpleAIConfig, PurpleAIUserDetails, PurpleAIConsoleDetails
7679
7780config = PurpleAIConfig(
@@ -80,14 +83,15 @@ config = PurpleAIConfig(
8083 user_details = PurpleAIUserDetails(
8184 account_id = " 123456789" ,
8285 team_token = " team-token" ,
86+ session_id = uuid.uuid4().hex,
8387 email_address = " [email protected] " ,
8488 user_agent = " MyApp/1.0" ,
8589 build_date = " 2025-01-01" ,
8690 build_hash = " abc123"
8791 ),
8892 console_details = PurpleAIConsoleDetails(
8993 base_url = " https://console.example.com" ,
90- version = " S-25.1.1#30 "
94+ version = " S"
9195 )
9296)
9397
@@ -120,6 +124,7 @@ PurpleAIConfig(
120124
121125#### Example
122126``` python
127+ import uuid
123128from purple_mcp.libs.purple_ai import (
124129 PurpleAIConfig,
125130 PurpleAIConsoleDetails,
@@ -131,11 +136,12 @@ config = PurpleAIConfig(
131136 auth_token = " your-service-token" ,
132137 console_details = PurpleAIConsoleDetails(
133138 base_url = " https://console.example.com" ,
134- version = " S-25.1.1#30 "
139+ version = " S"
135140 ),
136141 user_details = PurpleAIUserDetails(
137142 account_id = " 123456789" ,
138143 team_token = " team-token-abc" ,
144+ session_id = uuid.uuid4().hex,
139145 email_address = " [email protected] " ,
140146 user_agent = " MyApp/1.0" ,
141147 build_date = " 2025-01-15" ,
@@ -164,7 +170,7 @@ PurpleAIConsoleDetails(
164170``` python
165171console_details = PurpleAIConsoleDetails(
166172 base_url = " https://console.example.com" ,
167- version = " S-25.1.1#30 "
173+ version = " S"
168174)
169175```
170176
@@ -177,6 +183,7 @@ User-specific configuration details.
177183PurpleAIUserDetails(
178184 account_id: str ,
179185 team_token: str ,
186+ session_id: str ,
180187 email_address: str ,
181188 user_agent: str ,
182189 build_date: str ,
@@ -197,6 +204,7 @@ PurpleAIUserDetails(
197204user_details = PurpleAIUserDetails(
198205 account_id = " 123456789" ,
199206 team_token = " team-token-abc" ,
207+ session_id = uuid.uuid4().hex,
200208 email_address = " [email protected] " ,
201209 user_agent = " SecurityTools/2.1 (Python/3.11)" ,
202210 build_date = " 2025-01-15" ,
@@ -411,6 +419,7 @@ The library can use environment variables for configuration:
411419
412420``` python
413421import os
422+ import uuid
414423from purple_mcp.libs.purple_ai import PurpleAIConfig
415424
416425def create_config_from_env ():
@@ -422,6 +431,7 @@ def create_config_from_env():
422431 user_details = PurpleAIUserDetails(
423432 account_id = os.getenv(" PURPLEMCP_PURPLE_AI_ACCOUNT_ID" , " " ),
424433 team_token = os.getenv(" PURPLEMCP_PURPLE_AI_TEAM_TOKEN" , " " ),
434+ session_id = os.getenv(" PURPLEMCP_PURPLE_AI_SESSION_ID" , uuid.uuid4().hex),
425435 email_address = os.getenv(" PURPLEMCP_PURPLE_AI_EMAIL_ADDRESS" , " " ),
426436 user_agent = os.getenv(" PURPLEMCP_PURPLE_AI_USER_AGENT" , " PurpleAI/1.0" ),
427437 build_date = os.getenv(" PURPLEMCP_PURPLE_AI_BUILD_DATE" , " " ),
@@ -468,6 +478,7 @@ test_config = PurpleAIConfig(
468478 user_details = PurpleAIUserDetails(
469479 account_id = " test-account" ,
470480 team_token = " test-team-token" ,
481+ session_id = " test-session-id" ,
471482 email_address = " [email protected] " ,
472483 user_agent = " TestClient/1.0" ,
473484 build_date = " 2025-01-01" ,
@@ -503,6 +514,7 @@ async def test_purple_ai_integration():
503514 user_details = PurpleAIUserDetails(
504515 account_id = os.getenv(" PURPLEMCP_PURPLE_AI_ACCOUNT_ID" ),
505516 team_token = os.getenv(" PURPLEMCP_PURPLE_AI_TEAM_TOKEN" ),
517+ session_id = os.getenv(" PURPLEMCP_PURPLE_AI_SESSION_ID" ),
506518 email_address = os.getenv(" PURPLEMCP_PURPLE_AI_EMAIL_ADDRESS" ),
507519 user_agent = os.getenv(" PURPLEMCP_PURPLE_AI_USER_AGENT" , " IntegrationTest/1.0" ),
508520 build_date = os.getenv(" PURPLEMCP_PURPLE_AI_BUILD_DATE" ),
@@ -519,4 +531,4 @@ _result_type, response = await ask_purple("What is SentinelOne?", config)
519531 assert response is not None
520532 assert len (response) > 0
521533 assert isinstance (response, str )
522- ```
534+ ```
0 commit comments