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

# Create Session By Name

> Start a session against the latest published version of an agent by name.

Resolves the current latest published version at runtime — callers do not
need to track a specific agent ID or version. Returns 404 if no published
version exists for the given agent name.



## OpenAPI

````yaml /api-v2.json post /agents/name/{name}/sessions
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /agents/name/{name}/sessions:
    post:
      tags:
        - Agents
      summary: Create Session By Name
      description: >-
        Start a session against the latest published version of an agent by
        name.


        Resolves the current latest published version at runtime — callers do
        not

        need to track a specific agent ID or version. Returns 404 if no
        published

        version exists for the given agent name.
      operationId: createSessionByName
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
            title: Name
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/CreateSessionRequest'
                - type: 'null'
              title: Session Request
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            from meibel import MeibelClient

            client = MeibelClient(api_key="your-api-key")

            result = client.agents.sessions.create_by_name("name_value")
            print(result)
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from 'meibel';


            const client = new MeibelClient({ apiKey: 'your-api-key' });


            const result = await
            client.agents.sessions.createByName('name_value');

            console.log(result);
        - lang: Go
          label: Go
          source: >-
            import v2 "github.com/meibel-ai/meibel-go/v2"


            client := v2.NewClient(v2.WithAPIKey("your-api-key"))

            ctx := context.Background()


            result, err := client.Agents.Sessions.CreateByName(ctx,
            "name_value")

            if err != nil {
                log.Fatal(err)
            }

            fmt.Println(result)
components:
  schemas:
    CreateSessionRequest:
      properties:
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
        initial_context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Initial Context
        max_iterations_per_user_message:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Iterations Per User Message
      type: object
      title: CreateSessionRequest
    CreateSessionResponse:
      properties:
        session_id:
          type: string
          title: Session Id
      type: object
      required:
        - session_id
      title: CreateSessionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````