> ## 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.

# Create an Agent.

> Create a new Agent with a name and optional public visibility. The Agent will be assigned a unique ID.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json post /v1/agents
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:
    post:
      tags:
        - agents
      summary: Create an Agent.
      description: >-
        Create a new Agent with a name and optional public visibility. The Agent
        will be assigned a unique ID.
      operationId: createAgent
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentCreateParameters'
      responses:
        '200':
          description: Agent created successfully. Returns the Agent with metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentView'
        '400':
          description: Bad request. Invalid name or parameters.
        '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 agentView = await client.agents.create({ name: 'name' });

            console.log(agentView.id);
        - 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_view = client.agents.create(
                name="name",
            )
            print(agent_view.id)
components:
  schemas:
    AgentCreateParameters:
      type: object
      description: Parameters for creating a new Agent.
      properties:
        name:
          type: string
          description: The name of the Agent.
        version:
          description: >-
            Optional version identifier for the Agent. For npm/pip sources this
            is typically a semver string (e.g. '2.0.65'). For git sources it can
            be a branch or tag. Semantics are user-defined for object sources.
          type:
            - string
            - 'null'
        source:
          description: The source configuration for the Agent.
          anyOf:
            - $ref: '#/components/schemas/AgentSource'
            - type: 'null'
      required:
        - name
    AgentView:
      type: object
      description: An Agent represents a registered AI agent entity.
      properties:
        id:
          type: string
          description: The unique identifier of the Agent.
        name:
          type: string
          description: The name of the Agent.
        version:
          description: >-
            Optional version identifier for the Agent. For npm/pip sources this
            is typically a semver string (e.g. '2.0.65'). For git sources it can
            be a branch or tag. Omitted for object sources or when not provided.
          type:
            - string
            - 'null'
        create_time_ms:
          type: integer
          format: int64
          description: The creation time of the Agent (Unix timestamp milliseconds).
        is_public:
          type: boolean
          description: Whether the Agent is publicly accessible.
        source:
          description: The source configuration for the Agent.
          anyOf:
            - $ref: '#/components/schemas/AgentSource'
            - type: 'null'
      required:
        - id
        - name
        - create_time_ms
        - is_public
    AgentSource:
      type: object
      description: Agent source configuration.
      properties:
        type:
          type: string
          description: 'Source type: npm, pip, object, or git'
        npm:
          description: NPM source configuration
          anyOf:
            - $ref: '#/components/schemas/NpmSource'
            - type: 'null'
        pip:
          description: Pip source configuration
          anyOf:
            - $ref: '#/components/schemas/PipSource'
            - type: 'null'
        object:
          description: Object store source configuration
          anyOf:
            - $ref: '#/components/schemas/ObjectSource'
            - type: 'null'
        git:
          description: Git source configuration
          anyOf:
            - $ref: '#/components/schemas/GitSource'
            - type: 'null'
      required:
        - type
    NpmSource:
      type: object
      description: NPM-based agent source configuration.
      properties:
        package_name:
          type: string
          description: NPM package name
        registry_url:
          description: NPM registry URL
          type:
            - string
            - 'null'
        agent_setup:
          items:
            type: string
          description: Setup commands to run after installation
          type:
            - array
            - 'null'
      required:
        - package_name
    PipSource:
      type: object
      description: Pip-based agent source configuration.
      properties:
        package_name:
          type: string
          description: Pip package name
        registry_url:
          description: Pip registry URL
          type:
            - string
            - 'null'
        agent_setup:
          items:
            type: string
          description: Setup commands to run after installation
          type:
            - array
            - 'null'
      required:
        - package_name
    ObjectSource:
      type: object
      description: Object store agent source configuration.
      properties:
        object_id:
          type: string
          description: Object ID
        agent_setup:
          items:
            type: string
          description: Setup commands to run after unpacking
          type:
            - array
            - 'null'
      required:
        - object_id
    GitSource:
      type: object
      description: Git-based agent source configuration.
      properties:
        repository:
          type: string
          description: Git repository URL
        ref:
          description: Optional Git ref (branch/tag/commit), defaults to main/HEAD
          type:
            - string
            - 'null'
        agent_setup:
          items:
            type: string
          description: Setup commands to run after cloning
          type:
            - array
            - 'null'
      required:
        - repository
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````