Skip to main content
Get a token-efficient summary of session tasks for prompt injection.

Usage

import os
from acontext import AcontextClient

client = AcontextClient(api_key=os.getenv("ACONTEXT_API_KEY"))

summary = client.sessions.get_session_summary(session_id)

system_prompt = f"""You are a helpful assistant.

Previous tasks:
{summary}

Continue helping the user.
"""

Output Format

<task id="1" description="Search for iPhone 15 news">
<progress>
1. Searched and found key specs
2. Compiled feature comparison
</progress>
<user_preference>
1. Focus on camera capabilities
</user_preference>
</task>

Options

# Limit to last 5 tasks
summary = client.sessions.get_session_summary(session_id, limit=5)
Task extraction is async and may lag 1-6 messages. Keep the 4-6 most recent messages in full when using summary as compression.

Next Steps