llamaIndex - 💡(How to fix) Fix [Feature Request]: Async Agents MCP Background tasks [9 comments, 5 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#20954Fetched 2026-04-08 00:30:03
View on GitHub
Comments
9
Participants
5
Timeline
15
Reactions
0
Timeline (top)
commented ×7mentioned ×3subscribed ×3labeled ×2
RAW_BUFFERClick to expand / collapse

Feature Description

One of the new additions of MCP was the creation of background tasks. https://gofastmcp.com/servers/tasks

I was wondering if we could improve llamaindex MCP client to be able to use those.

Reason

The feature is quite new. It enabled a bunch of use cases where we want long running tasks.

For example Tool calling with human in the loop, where calling a function agent with mcp server to a tool that requires human aproval

Value of Feature

For example Tool calling with human in the loop, where calling a function agent with mcp server to a tool that requires human aproval

extent analysis

Fix Plan

Background Task Integration for Llamaindex MCP Client

To integrate background tasks with the Llamaindex MCP client, we'll need to make the following changes:

Step 1: Install the required package

go get github.com/go-faster/mcp/v2/tasks

Step 2: Import the tasks package

import (
    "github.com/go-faster/mcp/v2/tasks"
)

Step 3: Create a background task client

func main() {
    // Create a new background task client
    taskClient := tasks.NewClient("https://your-mcp-server.com/tasks")
    
    // Create a new task
    task := tasks.NewTask("your-task-name", "your-task-description")
    
    // Add task dependencies
    task.Dependencies = []string{"dependency-1", "dependency-2"}
    
    // Submit the task
    taskClient.Submit(task)
}

Step 4: Handle task events

func main() {
    // Create a new background task client
    taskClient := tasks.NewClient("https://your-mcp-server.com/tasks")
    
    // Create a new task
    task := tasks.NewTask("your-task-name", "your-task-description")
    
    // Add task dependencies
    task.Dependencies = []string{"dependency-1", "dependency-2"}
    
    // Submit the task
    taskClient.Submit(task)
    
    // Handle task events
    taskClient.OnTaskCreated(func(task *tasks.Task) {
        fmt.Println("Task created:", task.ID)
    })
    
    taskClient.OnTaskUpdated(func(task *tasks.Task) {
        fmt.Println("Task updated:", task.ID)
    })
    
    taskClient.OnTaskFailed(func(task *tasks.Task, err error) {
        fmt.Println("Task failed:", task.ID, err)
    })
}

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - 💡(How to fix) Fix [Feature Request]: Async Agents MCP Background tasks [9 comments, 5 participants]