Features
Agent Tasks
Automatic task extraction from agent conversations
Acontext extracts tasks from agent conversations based on user requirements. Each distinct request the user makes becomes a separate, trackable task — the agent's plan steps are tracked as progress within that task.
Quick Start
import os
from acontext import AcontextClient
client = AcontextClient(api_key=os.getenv("ACONTEXT_API_KEY"))
session = client.sessions.create()
# Store conversation — each user request becomes a separate task
messages = [
{"role": "user", "content": "Research iPhone 15 specs and summarize the key features"},
{"role": "assistant", "content": "Here are the key iPhone 15 specs:\n- A16 chip, 48MP camera, USB-C..."},
{"role": "user", "content": "Now create a comparison table with iPhone 14"},
{"role": "assistant", "content": "| Feature | iPhone 14 | iPhone 15 |\n|---|---|---|\n| Chip | A15 | A16 |..."},
]
for msg in messages:
client.sessions.store_message(session_id=session.id, blob=msg, format="openai")
# Wait for extraction
client.sessions.flush(session.id)
# Get tasks — one per user request
tasks = client.sessions.get_tasks(session.id)
for task in tasks.items:
print(f"Task #{task.order}: {task.data.task_description} | Status: {task.status}")import { AcontextClient } from '@acontext/acontext';
const client = new AcontextClient({
apiKey: process.env.ACONTEXT_API_KEY,
});
const session = await client.sessions.create();
// Store conversation — each user request becomes a separate task
const messages = [
{ role: "user", content: "Research iPhone 15 specs and summarize the key features" },
{ role: "assistant", content: "Here are the key iPhone 15 specs:\n- A16 chip, 48MP camera, USB-C..." },
{ role: "user", content: "Now create a comparison table with iPhone 14" },
{ role: "assistant", content: "| Feature | iPhone 14 | iPhone 15 |\n|---|---|---|\n| Chip | A15 | A16 |..." },
];
for (const msg of messages) {
await client.sessions.storeMessage(session.id, msg, { format: "openai" });
}
// Wait for extraction
await client.sessions.flush(session.id);
// Get tasks — one per user request
const tasks = await client.sessions.getTasks(session.id);
for (const task of tasks.items) {
console.log(`Task #${task.order}: ${task.data.task_description} | Status: ${task.status}`);
}Task Data
Each task contains:
task_description: What the task isstatus:pending,running,success, orfailedprogresses: Agent's progress updatesuser_preferences: User requirements mentioned
for task in tasks.items:
print(f"Task: {task.data.task_description}")
if task.data.progresses:
for p in task.data.progresses:
print(f" Progress: {p}")
if task.data.user_preferences:
for pref in task.data.user_preferences:
print(f" Preference: {pref}")for (const task of tasks.items) {
console.log(`Task: ${task.data.task_description}`);
if (task.data.progresses) {
for (const p of task.data.progresses) {
console.log(` Progress: ${p}`);
}
}
if (task.data.user_preferences) {
for (const pref of task.data.user_preferences) {
console.log(` Preference: ${pref}`);
}
}
}View in Dashboard


Next Steps
Last updated on