Task Extraction#
Infrastructure node that converts chat conversation history into focused, actionable tasks.
TaskExtractionNode#
- class framework.infrastructure.task_extraction_node.TaskExtractionNode[source]#
Bases:
BaseInfrastructureNode
Convention-based task extraction node with sophisticated task processing logic.
Extracts and processes user tasks with context analysis, dependency detection, and task refinement. Handles both initial task extraction and task updates from conversations.
Features: - Configuration-driven error classification and retry policies - LLM-based task extraction with fallback mechanisms - Context-aware task processing - Dependency analysis for chat history and user memory - Sophisticated error handling for LLM operations
- name: str = 'task_extraction'#
- description: str = 'Task Extraction and Processing'#
- static classify_error(exc, context)[source]#
Built-in error classification for task extraction operations.
- Parameters:
exc (Exception) – Exception that occurred during task extraction
context (dict) – Execution context with task extraction details
- Returns:
Error classification for retry decisions
- Return type:
- static get_retry_policy()[source]#
Custom retry policy for LLM-based task extraction operations.
Task extraction uses LLM calls to parse user queries and can be flaky due to: - Network timeouts to LLM services - LLM provider rate limiting - Complex query parsing requirements
Use standard retry attempts with moderate delays since task extraction is the entry point and should be reliable but not overly aggressive.
- Return type:
Dict[str, Any]
- async static execute(state, **kwargs)[source]#
Main task extraction logic with sophisticated error handling and fallback.
Converts conversational exchanges into clear, actionable task descriptions. Analyzes native LangGraph messages and external data sources to extract the user’s actual intent and dependencies on previous conversation context.
- Parameters:
state (AgentState) – Current agent state (TypedDict)
kwargs – Additional LangGraph parameters
- Returns:
Dictionary of state updates to apply
- Return type:
Dict[str, Any]
- __repr__()#
Return a string representation of the infrastructure node for debugging.
Provides a concise string representation that includes both the Python class name and the infrastructure node’s registered name. This is useful for debugging, logging, and development workflows where infrastructure nodes need to be identified clearly.
- Returns:
String representation including class name and node name
- Return type:
str
Example
>>> node = TaskExtractionNode() >>> repr(node) '<TaskExtractionNode: task_extraction>'
Note
The format follows the pattern ‘<ClassName: node_name>’ for consistency across all framework components.
- async langgraph_node(**kwargs)#
LangGraph-native node function with manual error handling.
This function is called by LangGraph during execution. Infrastructure nodes now use get_stream_writer() and get_config() directly for pure LangGraph integration.
- Parameters:
state (AgentState) – Current agent state
kwargs – Additional parameters from LangGraph
- Returns:
State updates dictionary
- Return type:
Dict[str, Any]
Supporting Functions#
- framework.infrastructure.task_extraction_node.build_task_extraction_prompt(messages, retrieval_result)[source]#
Build the system prompt with examples, current chat, and integrated data sources context.
- Parameters:
messages (List[BaseMessage]) – The native LangGraph messages to extract task from
retrieval_result – Data retrieval result from external sources
- Returns:
Complete prompt for task extraction
- Return type:
str
Core Models#
Task extraction uses models defined in the core framework:
See also
ExtractedTask
Structured output model for extracted tasks
BaseInfrastructureNode
Base class for infrastructure components
Registration#
Automatically registered as:
NodeRegistration(
name="task_extraction",
module_path="framework.infrastructure.task_extraction_node",
function_name="TaskExtractionNode",
description="Task extraction and processing"
)
See also
- Prompt System
Prompt customization system
- Registry System
Component registration system
- Task Extraction
Implementation details and usage patterns