> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kubiya.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute Team

> Execute a team task by submitting to Temporal workflow.

This creates an execution record and starts a Temporal workflow.
The actual execution happens asynchronously on the Temporal worker.

The runner_name should come from the Composer UI where user selects
from available runners (fetched from Kubiya API /api/v1/runners).



## OpenAPI

````yaml https://control-plane.kubiya.ai/api/openapi.json post /api/v1/teams/{team_id}/execute
openapi: 3.1.0
info:
  title: Agent Control Plane API
  description: Multi-tenant agent orchestration with Temporal workflows
  version: 1.0.0
servers: []
security:
  - BearerAuth: []
tags:
  - name: health
    description: 🏥 **Health & Status** - Check API health and availability
  - name: authentication
    description: 🔐 **Authentication** - Token validation and auth management
  - name: agents
    description: 🤖 **Agents** - Create and manage AI agents with custom capabilities
  - name: skills
    description: 🛠️ **Tool Sets** - Manage agent skills and tool configurations
  - name: integrations
    description: 🔌 **Integrations** - Connect to external services (Kubiya managed)
  - name: custom-integrations
    description: >-
      ⚙️ **Custom Integrations** - User-defined integration instances with env
      vars, secrets, and files
  - name: integration-templates
    description: >-
      📦 **Integration Templates** - Pre-configured templates for common
      services (PostgreSQL, Redis, MongoDB, etc.)
  - name: secrets
    description: 🔑 **Secrets** - Secure credential storage and retrieval
  - name: teams
    description: 👥 **Teams** - Team management and collaboration
  - name: workflows
    description: 📊 **Workflows** - Multi-step automation and orchestration
  - name: executions
    description: ▶️ **Executions** - Track and monitor workflow runs
  - name: jobs
    description: ⏰ **Jobs** - Scheduled and webhook-triggered tasks
  - name: policies
    description: 🛡️ **Policies** - Access control and security policies
  - name: analytics
    description: 📈 **Analytics** - Usage metrics and performance monitoring
  - name: projects
    description: 📁 **Projects** - Project organization and management
  - name: environments
    description: 🌍 **Environments** - Environment configuration (dev, staging, prod)
  - name: models
    description: 🧠 **Models** - LLM model configuration and management
  - name: runtimes
    description: ⚡ **Runtimes** - Agent execution runtime environments
  - name: workers
    description: 👷 **Workers** - Worker registration and heartbeat monitoring
  - name: storage
    description: 💾 **Storage** - File storage and cloud integration
  - name: context-graph
    description: 🕸️ **Context Graph** - Knowledge graph and context management
  - name: temporal-workflows
    description: >-
      ⚙️ **Temporal Workflows** - Background workflows for context graph
      ingestion, connector operations, and scheduled jobs
  - name: templates
    description: 📝 **Templates** - Reusable configuration templates
paths:
  /api/v1/teams/{team_id}/execute:
    post:
      summary: Execute Team
      description: |-
        Execute a team task by submitting to Temporal workflow.

        This creates an execution record and starts a Temporal workflow.
        The actual execution happens asynchronously on the Temporal worker.

        The runner_name should come from the Composer UI where user selects
        from available runners (fetched from Kubiya API /api/v1/runners).
      operationId: execute_team_api_v1_teams__team_id__execute_post
      parameters:
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            title: Team Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TeamExecutionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamExecutionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TeamExecutionRequest:
      properties:
        prompt:
          type: string
          title: Prompt
          description: The prompt/task to execute
        system_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: System Prompt
          description: Optional system prompt for team coordination
        stream:
          type: boolean
          title: Stream
          description: Whether to stream the response
          default: false
        worker_queue_id:
          type: string
          title: Worker Queue Id
          description: Worker queue ID (UUID) to route execution to - REQUIRED
        user_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: User Metadata
          description: User attribution metadata (optional, auto-filled from token)
        execution_environment:
          anyOf:
            - $ref: '#/components/schemas/ExecutionEnvironment'
            - type: 'null'
          description: >-
            Optional execution environment overrides (working_dir, env_vars,
            etc.)
        execution_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Execution Metadata
          description: >-
            Optional metadata for tracking and filtering executions (e.g.,
            meta_agent_session_id, trigger_type)
      type: object
      required:
        - prompt
        - worker_queue_id
      title: TeamExecutionRequest
    TeamExecutionResponse:
      properties:
        execution_id:
          type: string
          title: Execution Id
        workflow_id:
          type: string
          title: Workflow Id
        status:
          type: string
          title: Status
        message:
          type: string
          title: Message
      type: object
      required:
        - execution_id
        - workflow_id
        - status
        - message
      title: TeamExecutionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ExecutionEnvironment:
      properties:
        working_dir:
          anyOf:
            - type: string
            - type: 'null'
          title: Working Dir
          description: Working directory for execution (overrides default workspace)
        env_vars:
          additionalProperties:
            type: string
          type: object
          title: Env Vars
          description: Environment variables (key-value pairs)
        secrets:
          items:
            type: string
          type: array
          title: Secrets
          description: Secret names from Kubiya vault
        integration_ids:
          items:
            type: string
          type: array
          title: Integration Ids
          description: Integration UUIDs for delegated credentials
        mcp_servers:
          additionalProperties:
            $ref: '#/components/schemas/MCPServerConfig'
          type: object
          title: Mcp Servers
          description: >-
            MCP (Model Context Protocol) server configurations. Supports stdio,
            HTTP, and SSE transports.
      type: object
      title: ExecutionEnvironment
      description: Execution environment configuration for agents/teams
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MCPServerConfig:
      properties:
        command:
          anyOf:
            - type: string
            - type: 'null'
          title: Command
          description: Command for stdio transport (mutually exclusive with url/type)
        args:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Args
          description: Arguments for stdio transport
        env:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Env
          description: Environment variables (used by both stdio and HTTP transports)
        transport_type:
          anyOf:
            - type: string
              enum:
                - http
                - sse
            - type: 'null'
          title: Transport Type
          description: Transport type for HTTP/SSE (mutually exclusive with command)
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: URL for HTTP/SSE transport (mutually exclusive with command)
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Headers
          description: HTTP headers for HTTP/SSE transport
      type: object
      title: MCPServerConfig
      description: >-
        Unified MCP server configuration supporting multiple transport types.


        This schema uses discriminated union based on the presence of 'command'
        or 'type' field:

        - If 'command' is present: stdio transport

        - If 'type' is present: HTTP/SSE transport


        The configuration is validated to ensure only one transport type is
        specified.
      examples:
        - args:
            - '-m'
            - mcp_server_filesystem
          command: python
          env:
            ALLOWED_PATHS: '{{.env.PROJECT_ROOT}}'
        - headers:
            Authorization: Bearer {{.secret.token}}
          type: sse
          url: https://api.example.com/mcp
        - headers:
            Authorization: Bearer {{.secret.token}}
          transport_type: sse
          url: https://api.example.com/mcp
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your Kubiya API token (format: Bearer <token>)'

````