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

# Get Devbox counts by Agent.

> Returns devbox counts grouped by agent name. This endpoint efficiently aggregates devbox counts for all agents in a single request, avoiding N+1 query patterns.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json get /v1/agents/devbox_counts
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/agents/devbox_counts:
    get:
      tags:
        - agents
      summary: Get Devbox counts by Agent.
      description: >-
        Returns devbox counts grouped by agent name. This endpoint efficiently
        aggregates devbox counts for all agents in a single request, avoiding
        N+1 query patterns.
      operationId: getAgentDevboxCounts
      responses:
        '200':
          description: Successfully retrieved devbox counts by agent name.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentDevboxCountsView'
        '401':
          description: Unauthorized. Invalid or missing authentication.
        '403':
          description: Forbidden. Account does not have devbox capability.
        '500':
          description: Internal server error.
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Runloop from '@runloop/api-client';

            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });

            const agentDevboxCountsView = await client.agents.devboxCounts();

            console.log(agentDevboxCountsView.counts);
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            agent_devbox_counts_view = client.agents.devbox_counts()
            print(agent_devbox_counts_view.counts)
components:
  schemas:
    AgentDevboxCountsView:
      type: object
      description: >-
        Devbox counts grouped by agent name. Used to efficiently fetch devbox
        counts for multiple agents in a single request.
      properties:
        counts:
          type: object
          additionalProperties:
            type: integer
            format: int32
          description: >-
            Map of agent name to devbox count. Each key is an agent name, and
            the value is the count of devboxes associated with that agent.
        total_count:
          type: integer
          format: int32
          description: Total count of devboxes across all agents in the result.
      required:
        - counts
        - total_count
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````