Skip to main content
Glama

run_task

Execute Union tasks using natural language by specifying project, domain, name, and inputs to automate workflows and applications.

Instructions

Run a task with natural language.

- Based on the prompt and inputs dictionary, determine the task to run
- Format the inputs dictionary so that it matches the task function signature
- Invoke the task

Args:
    project: Project to run the task in.
    domain: Domain to run the task in.
    name: Name of the task to run.
    inputs: A dictionary of inputs to the task.

Returns:
    A dictionary of outputs from the task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
inputsYes
nameYes
projectYes

Implementation Reference

  • Primary MCP tool handler and registration for 'run_task' in v2 server. Decorated with @mcp.tool() and @require_auth. Initializes Flyte and calls the resources helper.
    @mcp.tool()
    @require_auth
    async def run_task(
        name: str,
        inputs: dict,
        project: str,
        domain: str,
        ctx: Context,
    ) -> dict:
        ctx.info(f"Running task {name} in project {project} and domain {domain}")
        """Run a task with natural language.
    
        - Based on the prompt and inputs dictionary, determine the task to run
        - Format the inputs dictionary so that it matches the task function signature
        - Invoke the task
        
        Args:
            project: Project to run the task in.
            domain: Domain to run the task in.
            name: Name of the task to run.
            inputs: A dictionary of inputs to the task.
    
        Returns:
            A dictionary of outputs from the task.
        """
        # Based on the prompt and inputs dictionary, determine the task
        _init(project, domain)
        return (await resources.run_task(name, inputs, project, domain)).to_dict()
  • Core helper function that fetches a Flyte task and runs it asynchronously, returning action details. Called by the v2 server handler.
    async def run_task(
        name: str,
        inputs: dict,
        project: str | None = None,
        domain: str | None = None,
        version: str | None = None,
    ) -> flyte.remote.ActionDetails:
        task = flyte.remote.Task.get(
            name=name,
            project=project,
            domain=domain,
            version=version,
            auto_version="latest" if version is None else None,
        )
        run: flyte.remote.Run = flyte.run(task, **inputs)
        return await run.action.details()
  • v1 MCP tool handler and registration for 'run_task'. Directly fetches and executes task using union remote API.
    @mcp.tool()
    @require_auth
    def run_task(
        name: str,
        inputs: dict,
        project: str,
        domain: str,
        ctx: Context,
    ) -> dict:
        ctx.info(f"Running task {name} in project {project} and domain {domain}")
        """Run a task with natural language.
    
        - Based on the prompt and inputs dictionary, determine the task to run
        - Format the inputs dictionary so that it matches the task function signature
        - Invoke the task
        
        Args:
            project: Project to run the task in.
            domain: Domain to run the task in.
            name: Name of the task to run.
            inputs: A dictionary of inputs to the task.
    
        Returns:
            A dictionary of outputs from the task.
        """
        # Based on the prompt and inputs dictionary, determine the task
        remote = _remote(project, domain)
        task = remote.fetch_task(project=project, domain=domain, name=name)
        execution = remote.execute(task, inputs, project=project, domain=domain)
        return resources.proto_to_json(execution.to_flyte_idl())

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/unionai-oss/union-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server