clara.skills.email_assistant package
Submodules
clara.skills.email_assistant.workflows module
Email Assistant Workflow Module for Clara Core.
Implements the cognitive CRUD loop for email management: 1. Parse Intent (Create, Read, Update, Delete) 2. Extract Entities (Recipients, Subject, Body, Date, Folder, Attachments) 3. Confirm Ambiguity / Guardrails 4. Execute via Gmail Connection tools 5. Format structured markdown response
- class clara.skills.email_assistant.workflows.EmailAssistantWorkflow(service=None, access_token=None)[source]
Bases:
objectWorkflow coordinator for processing natural language email requests.
Orchestrates intent classification, entity extraction, safety confirmation guardrails, tool execution against Gmail APIs, and markdown response generation.
- Parameters:
service (Any | None)
access_token (str | None)
- service
Authenticated Gmail API client service.
- Type:
Optional[Any]
- access_token
OAuth2 access token for user authentication.
- Type:
Optional[str]
Example
>>> workflow = EmailAssistantWorkflow(access_token="ya29.a0...") >>> response = workflow.execute("Draft an email to boss@example.com") >>> print(response["reply"])
- execute(user_prompt, context=None)[source]
Main entry point for executing an email assistant request.
- Parameters:
user_prompt (str) – Natural language user instruction.
context (Optional[Dict[str, Any]]) – Optional conversation context or previous pending action state.
- Returns:
- Execution result containing:
status(str): ‘success’, ‘pending_confirmation’, ‘clarification_needed’, ‘cancelled’, or ‘error’.action(str): Executed action name.reply(str): User-facing markdown formatted reply.data(Dict[str, Any]): Structured output payload.
- Return type:
Dict[str, Any]
- clara.skills.email_assistant.workflows.handle_email_prompt(user_prompt, access_token=None, service=None, context=None)[source]
Convenience helper to process a natural language prompt with the Email Assistant.
- Parameters:
user_prompt (str) – The natural language instruction from the user.
access_token (Optional[str]) – Optional OAuth2 bearer token.
service (Optional[Any]) – Optional pre-authenticated Gmail API client.
context (Optional[Dict[str, Any]]) – Optional execution context.
- Returns:
Formatted execution results dictionary.
- Return type:
Dict[str, Any]
Example
>>> res = handle_email_prompt("Check my unread emails", access_token="ya29...") >>> print(res["reply"])
Module contents
Email Assistant Skill for Clara Core.
Provides cognitive workflows to parse natural language email commands, draft, send, search, summarize threads, archive, and delete messages using Google Gmail.