Skip to content

Commit caaa14c

Browse files
authored
feat: add task schema (#82)
* feat: add task schema * feat(sdk): update ts sdk for schema * docs: update task schema * chore: bump sdk versions
1 parent bab24ec commit caaa14c

30 files changed

Lines changed: 629 additions & 112 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,19 +491,19 @@ print(tasks_response)
491491
for task in tasks_response.items:
492492
print(f"\nTask #{task.order}:")
493493
print(f" ID: {task.id}")
494-
print(f" Title: {task.data['task_description']}")
494+
print(f" Title: {task.data.task_description}")
495495
print(f" Status: {task.status}")
496496

497497
# Show progress updates if available
498498
if "progresses" in task.data:
499-
print(f" Progress updates: {len(task.data['progresses'])}")
500-
for progress in task.data["progresses"]:
499+
print(f" Progress updates: {len(task.data.progresses)}")
500+
for progress in task.data.progresses:
501501
print(f" - {progress}")
502502

503503
# Show user preferences if available
504504
if "user_preferences" in task.data:
505505
print(" User preferences:")
506-
for pref in task.data["user_preferences"]:
506+
for pref in task.data.user_preferences:
507507
print(f" - {pref}")
508508

509509
```

docs/api-reference/openapi.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,8 +2414,7 @@
24142414
"type" : "string"
24152415
},
24162416
"data" : {
2417-
"properties" : { },
2418-
"type" : "object"
2417+
"$ref" : "#/components/schemas/model.TaskData"
24192418
},
24202419
"id" : {
24212420
"type" : "string"
@@ -2444,6 +2443,29 @@
24442443
},
24452444
"type" : "object"
24462445
},
2446+
"model.TaskData" : {
2447+
"properties" : {
2448+
"progresses" : {
2449+
"items" : {
2450+
"type" : "string"
2451+
},
2452+
"type" : "array"
2453+
},
2454+
"sop_thinking" : {
2455+
"type" : "string"
2456+
},
2457+
"task_description" : {
2458+
"type" : "string"
2459+
},
2460+
"user_preferences" : {
2461+
"items" : {
2462+
"type" : "string"
2463+
},
2464+
"type" : "array"
2465+
}
2466+
},
2467+
"type" : "object"
2468+
},
24472469
"serializer.Response" : {
24482470
"properties" : {
24492471
"code" : {

docs/integrations/agno.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def main():
198198

199199
print("Extracted tasks:")
200200
for task in tasks_response.items:
201-
print(f"Task: {task.data['task_description']}")
201+
print(f"Task: {task.data.task_description}")
202202
print(f"Status: {task.status}")
203203

204204
if __name__ == "__main__":
@@ -233,17 +233,17 @@ acontext_client.sessions.flush(session_id)
233233
tasks_response = acontext_client.sessions.get_tasks(session_id)
234234

235235
for task in tasks_response.items:
236-
print(f"Task: {task.data['task_description']}")
236+
print(f"Task: {task.data.task_description}")
237237
print(f"Status: {task.status}")
238238

239239
# Access progress updates if available
240-
if "progresses" in task.data:
241-
for progress in task.data["progresses"]:
240+
if task.data.progresses:
241+
for progress in task.data.progresses:
242242
print(f" Progress: {progress}")
243243

244244
# Access user preferences if available
245-
if "user_preferences" in task.data:
246-
for pref in task.data["user_preferences"]:
245+
if task.data.user_preferences:
246+
for pref in task.data.user_preferences:
247247
print(f" Preference: {pref}")
248248
```
249249

docs/integrations/ai-sdk.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ async function main(): Promise<void> {
474474

475475
console.log('Extracted tasks:');
476476
for (const task of tasksResponse.items) {
477-
console.log(`Task: ${task.data['task_description']}`);
477+
console.log(`Task: ${task.data.task_description}`);
478478
console.log(`Status: ${task.status}`);
479479
}
480480
}
@@ -517,19 +517,19 @@ await acontextClient.sessions.flush(sessionId);
517517
const tasksResponse = await acontextClient.sessions.getTasks(sessionId);
518518

519519
for (const task of tasksResponse.items) {
520-
console.log(`Task: ${task.data['task_description']}`);
520+
console.log(`Task: ${task.data.task_description}`);
521521
console.log(`Status: ${task.status}`);
522522

523523
// Access progress updates if available
524-
if ('progresses' in task.data) {
525-
for (const progress of task.data['progresses'] as any[]) {
524+
if (task.data.progresses) {
525+
for (const progress of task.data.progresses) {
526526
console.log(` Progress: ${progress}`);
527527
}
528528
}
529529

530530
// Access user preferences if available
531-
if ('user_preferences' in task.data) {
532-
for (const pref of task.data['user_preferences'] as any[]) {
531+
if (task.data.user_preferences) {
532+
for (const pref of task.data.user_preferences) {
533533
console.log(` Preference: ${pref}`);
534534
}
535535
}

docs/integrations/openai-python.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ async def main():
332332

333333
print("Extracted tasks:")
334334
for task in tasks_response.items:
335-
print(f"Task: {task.data['task_description']}")
335+
print(f"Task: {task.data.task_description}")
336336
print(f"Status: {task.status}")
337337

338338
if __name__ == "__main__":
@@ -370,17 +370,17 @@ acontext_client.sessions.flush(session_id)
370370
tasks_response = acontext_client.sessions.get_tasks(session_id)
371371

372372
for task in tasks_response.items:
373-
print(f"Task: {task.data['task_description']}")
373+
print(f"Task: {task.data.task_description}")
374374
print(f"Status: {task.status}")
375375

376376
# Access progress updates if available
377-
if "progresses" in task.data:
378-
for progress in task.data["progresses"]:
377+
if task.data.progresses:
378+
for progress in task.data.progresses:
379379
print(f" Progress: {progress}")
380380

381381
# Access user preferences if available
382-
if "user_preferences" in task.data:
383-
for pref in task.data["user_preferences"]:
382+
if task.data.user_preferences:
383+
for pref in task.data.user_preferences:
384384
print(f" Preference: {pref}")
385385
```
386386

docs/integrations/openai-typescript.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ async function main(): Promise<void> {
397397

398398
console.log('Extracted tasks:');
399399
for (const task of tasksResponse.items) {
400-
console.log(`Task: ${task.data['task_description']}`);
400+
console.log(`Task: ${task.data.task_description}`);
401401
console.log(`Status: ${task.status}`);
402402
}
403403
}
@@ -441,19 +441,19 @@ await acontextClient.sessions.flush(sessionId);
441441
const tasksResponse = await acontextClient.sessions.getTasks(sessionId);
442442

443443
for (const task of tasksResponse.items) {
444-
console.log(`Task: ${task.data['task_description']}`);
444+
console.log(`Task: ${task.data.task_description}`);
445445
console.log(`Status: ${task.status}`);
446446

447447
// Access progress updates if available
448-
if ('progresses' in task.data) {
449-
for (const progress of task.data['progresses'] as any[]) {
448+
if (task.data.progresses) {
449+
for (const progress of task.data.progresses) {
450450
console.log(` Progress: ${progress}`);
451451
}
452452
}
453453

454454
// Access user preferences if available
455-
if ('user_preferences' in task.data) {
456-
for (const pref of task.data['user_preferences'] as any[]) {
455+
if (task.data.user_preferences) {
456+
for (const pref of task.data.user_preferences) {
457457
console.log(` Preference: ${pref}`);
458458
}
459459
}

docs/integrations/openai_agent.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ async def session_1(session_id: str):
277277

278278
print("Extracted tasks:")
279279
for task in tasks_response.items:
280-
print(f"Task: {task.data['task_description']}")
280+
print(f"Task: {task.data.task_description}")
281281
print(f"Status: {task.status}")
282282

283283
async def main():
@@ -324,17 +324,17 @@ acontext_client.sessions.flush(session_id)
324324
tasks_response = acontext_client.sessions.get_tasks(session_id)
325325

326326
for task in tasks_response.items:
327-
print(f"Task: {task.data['task_description']}")
327+
print(f"Task: {task.data.task_description}")
328328
print(f"Status: {task.status}")
329329

330330
# Access progress updates if available
331-
if "progresses" in task.data:
332-
for progress in task.data["progresses"]:
331+
if task.data.progresses:
332+
for progress in task.data.progresses:
333333
print(f" Progress: {progress}")
334334

335335
# Access user preferences if available
336-
if "user_preferences" in task.data:
337-
for pref in task.data["user_preferences"]:
336+
if task.data.user_preferences:
337+
for pref in task.data.user_preferences:
338338
print(f" Preference: {pref}")
339339
```
340340

0 commit comments

Comments
 (0)