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

# Handle Agent RPC by Name

> Handle JSON-RPC requests for an agent by its unique name.



## OpenAPI

````yaml https://agentex.dev-sgp.scale.com/openapi.json post /agents/name/{agent_name}/rpc
openapi: 3.1.0
info:
  title: Agentex API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/name/{agent_name}/rpc:
    post:
      tags:
        - Agents
      summary: Handle Agent RPC by Name
      description: Handle JSON-RPC requests for an agent by its unique name.
      operationId: handle_agent_rpc_by_name_agents_name__agent_name__rpc_post
      parameters:
        - name: agent_name
          in: path
          required: true
          schema:
            type: string
            title: Agent Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentRPCRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRPCResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentRPCRequest:
      properties:
        jsonrpc:
          type: string
          const: '2.0'
          title: Jsonrpc
          default: '2.0'
        method:
          $ref: '#/components/schemas/AgentRPCMethod'
        params:
          $ref: '#/components/schemas/AgentRPCParams'
        id:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          title: Id
      type: object
      required:
        - method
        - params
      title: AgentRPCRequest
    AgentRPCResponse:
      properties:
        jsonrpc:
          type: string
          const: '2.0'
          title: Jsonrpc
          default: '2.0'
        result:
          $ref: '#/components/schemas/AgentRPCResult'
          description: The result of the agent RPC request
        error:
          anyOf:
            - {}
            - type: 'null'
          title: Error
        id:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          title: Id
      type: object
      required:
        - result
      title: AgentRPCResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentRPCMethod:
      type: string
      enum:
        - event/send
        - task/create
        - message/send
        - task/cancel
      title: AgentRPCMethod
    AgentRPCParams:
      anyOf:
        - $ref: '#/components/schemas/CreateTaskRequest'
        - $ref: '#/components/schemas/CancelTaskRequest'
        - $ref: '#/components/schemas/SendMessageRequest'
        - $ref: '#/components/schemas/SendEventRequest'
      title: AgentRPCParams
      description: The parameters for the agent RPC request
    AgentRPCResult:
      anyOf:
        - items:
            $ref: '#/components/schemas/TaskMessage'
          type: array
        - $ref: '#/components/schemas/TaskMessageUpdate'
        - $ref: '#/components/schemas/Task'
        - $ref: '#/components/schemas/Event'
        - type: 'null'
      title: AgentRPCResult
    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
    CreateTaskRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            Optional human-readable name for the task. When set it must be
            globally unique. task/create is get-or-create by name: reusing an
            existing name returns the existing task (with its prior history)
            instead of creating a new one, so omit name (or make it unique, e.g.
            by appending a UUID) whenever each call should produce a fresh task.
        params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Params
          description: >-
            The parameters for the task. On a get-or-create by name, providing
            params overwrites the existing task's params (it is not a pure
            read).
        task_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Task Metadata
          description: >-
            Caller-provided metadata to persist on the task row. Only applied at
            task creation; ignored if a task with this name already exists.
            Forwarded to the agent inside the ACP payload for backward
            compatibility.
      type: object
      title: CreateTaskRequest
    CancelTaskRequest:
      properties:
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
          description: >-
            The ID of the task to cancel. Either this or task_name must be
            provided.
        task_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Name
          description: >-
            The name of the task to cancel. Either this or task_id must be
            provided.
      type: object
      title: CancelTaskRequest
    SendMessageRequest:
      properties:
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
          description: The ID of the task that the message was sent to
        task_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Name
          description: The name of the task that the message was sent to
        content:
          $ref: '#/components/schemas/TaskMessageContent'
          description: The message that was sent to the agent
        stream:
          type: boolean
          title: Stream
          description: Whether to stream the response message back to the client
          default: false
        task_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Task Params
          description: The parameters for the task (only used when creating new tasks)
      type: object
      required:
        - content
      title: SendMessageRequest
    SendEventRequest:
      properties:
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
          description: The ID of the task that the event was sent to
        task_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Name
          description: The name of the task that the event was sent to
        content:
          anyOf:
            - $ref: '#/components/schemas/TaskMessageContent'
            - type: 'null'
          description: The content to send to the event
      type: object
      title: SendEventRequest
    TaskMessage:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: The task message's unique id
        task_id:
          type: string
          title: Task Id
          description: ID of the task this message belongs to
        content:
          $ref: '#/components/schemas/TaskMessageContent'
          description: >-
            The content of the message. This content is not OpenAI compatible.
            These are messages that are meant to be displayed to the user.
        streaming_status:
          anyOf:
            - type: string
              enum:
                - IN_PROGRESS
                - DONE
            - type: 'null'
          title: >-
            In case of streaming, this indicates whether the message is still
            being streamed or has been completed
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: The timestamp when the message was created
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: The timestamp when the message was last updated
      type: object
      required:
        - task_id
        - content
      title: TaskMessage
      description: |-
        Represents a message in the agent system.

        This entity is used to store messages in MongoDB, with each message
        associated with a specific task.
    TaskMessageUpdate:
      oneOf:
        - $ref: '#/components/schemas/StreamTaskMessageStart'
        - $ref: '#/components/schemas/StreamTaskMessageDelta'
        - $ref: '#/components/schemas/StreamTaskMessageFull'
        - $ref: '#/components/schemas/StreamTaskMessageDone'
      title: TaskMessageUpdate
      discriminator:
        propertyName: type
        mapping:
          delta:
            $ref: '#/components/schemas/StreamTaskMessageDelta'
          done:
            $ref: '#/components/schemas/StreamTaskMessageDone'
          full:
            $ref: '#/components/schemas/StreamTaskMessageFull'
          start:
            $ref: '#/components/schemas/StreamTaskMessageStart'
    Task:
      properties:
        id:
          type: string
          title: Unique Task ID
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Unique name of the task
        status:
          anyOf:
            - $ref: '#/components/schemas/TaskStatus'
            - type: 'null'
          title: The current status of the task
        status_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: The reason for the current task status
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: The timestamp when the task was created
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: The timestamp when the task was last updated
        cleaned_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: >-
            The timestamp when the task's content was cleaned for retention
            compliance; null when active
        params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Task parameters
        task_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Task metadata
      type: object
      required:
        - id
      title: Task
    Event:
      properties:
        id:
          type: string
          title: Id
          description: The UUID of the event
        sequence_id:
          type: integer
          title: Sequence Id
          description: The sequence ID of the event
        task_id:
          type: string
          title: Task Id
          description: The UUID of the task that the event belongs to
        agent_id:
          type: string
          title: Agent Id
          description: The UUID of the agent that the event belongs to
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: The timestamp of the event
        content:
          anyOf:
            - $ref: '#/components/schemas/TaskMessageContent'
            - type: 'null'
          description: The content of the event
      type: object
      required:
        - id
        - sequence_id
        - task_id
        - agent_id
      title: Event
    TaskMessageContent:
      oneOf:
        - $ref: '#/components/schemas/TextContent'
        - $ref: '#/components/schemas/ReasoningContent'
        - $ref: '#/components/schemas/DataContent'
        - $ref: '#/components/schemas/ToolRequestContent'
        - $ref: '#/components/schemas/ToolResponseContent'
      title: TaskMessageContent
      discriminator:
        propertyName: type
        mapping:
          data:
            $ref: '#/components/schemas/DataContent'
          reasoning:
            $ref: '#/components/schemas/ReasoningContent'
          text:
            $ref: '#/components/schemas/TextContent'
          tool_request:
            $ref: '#/components/schemas/ToolRequestContent'
          tool_response:
            $ref: '#/components/schemas/ToolResponseContent'
    StreamTaskMessageStart:
      properties:
        type:
          type: string
          const: start
          title: Type
          default: start
        index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Index
        parent_task_message:
          anyOf:
            - $ref: '#/components/schemas/TaskMessage'
            - type: 'null'
        content:
          $ref: '#/components/schemas/TaskMessageContent'
      type: object
      required:
        - content
      title: StreamTaskMessageStart
      description: Event for starting a streaming message
    StreamTaskMessageDelta:
      properties:
        type:
          type: string
          const: delta
          title: Type
          default: delta
        index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Index
        parent_task_message:
          anyOf:
            - $ref: '#/components/schemas/TaskMessage'
            - type: 'null'
        delta:
          anyOf:
            - $ref: '#/components/schemas/TaskMessageDelta'
            - type: 'null'
      type: object
      title: StreamTaskMessageDelta
      description: Event for streaming chunks of content
    StreamTaskMessageFull:
      properties:
        type:
          type: string
          const: full
          title: Type
          default: full
        index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Index
        parent_task_message:
          anyOf:
            - $ref: '#/components/schemas/TaskMessage'
            - type: 'null'
        content:
          $ref: '#/components/schemas/TaskMessageContent'
      type: object
      required:
        - content
      title: StreamTaskMessageFull
      description: Event for streaming the full content
    StreamTaskMessageDone:
      properties:
        type:
          type: string
          const: done
          title: Type
          default: done
        index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Index
        parent_task_message:
          anyOf:
            - $ref: '#/components/schemas/TaskMessage'
            - type: 'null'
      type: object
      title: StreamTaskMessageDone
      description: Event for indicating the task is done
    TaskStatus:
      type: string
      enum:
        - CANCELED
        - COMPLETED
        - FAILED
        - RUNNING
        - TERMINATED
        - TIMED_OUT
        - DELETED
      title: TaskStatus
    TextContent:
      properties:
        type:
          type: string
          const: text
          title: Type
          description: The type of the message, in this case `text`.
          default: text
        author:
          $ref: '#/components/schemas/MessageAuthor'
          description: >-
            The role of the messages author, in this case `system`, `user`,
            `assistant`, or `tool`.
        style:
          $ref: '#/components/schemas/MessageStyle'
          description: >-
            The style of the message. This is used by the client to determine
            how to display the message.
          default: static
        format:
          $ref: '#/components/schemas/TextFormat'
          description: >-
            The format of the message. This is used by the client to determine
            how to display the message.
          default: plain
        content:
          type: string
          title: Content
          description: The contents of the text message.
        attachments:
          anyOf:
            - items:
                $ref: '#/components/schemas/FileAttachment'
              type: array
            - type: 'null'
          title: Attachments
          description: Optional list of file attachments with structured metadata.
      type: object
      required:
        - author
        - content
      title: TextContent
    ReasoningContent:
      properties:
        type:
          type: string
          const: reasoning
          title: Type
          description: The type of the message, in this case `reasoning`.
          default: reasoning
        author:
          $ref: '#/components/schemas/MessageAuthor'
          description: >-
            The role of the messages author, in this case `system`, `user`,
            `assistant`, or `tool`.
        style:
          $ref: '#/components/schemas/MessageStyle'
          description: >-
            The style of the message. This is used by the client to determine
            how to display the message.
          default: static
        summary:
          items:
            type: string
          type: array
          title: Summary
          description: A list of short reasoning summaries
        content:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Content
          description: The reasoning content or chain-of-thought text
      type: object
      required:
        - author
        - summary
      title: ReasoningContent
    DataContent:
      properties:
        type:
          type: string
          const: data
          title: Type
          description: The type of the message, in this case `data`.
          default: data
        author:
          $ref: '#/components/schemas/MessageAuthor'
          description: >-
            The role of the messages author, in this case `system`, `user`,
            `assistant`, or `tool`.
        style:
          $ref: '#/components/schemas/MessageStyle'
          description: >-
            The style of the message. This is used by the client to determine
            how to display the message.
          default: static
        data:
          additionalProperties: true
          type: object
          title: Data
          description: The contents of the data message.
      type: object
      required:
        - author
        - data
      title: DataContent
    ToolRequestContent:
      properties:
        type:
          type: string
          const: tool_request
          title: Type
          description: The type of the message, in this case `tool_request`.
          default: tool_request
        author:
          $ref: '#/components/schemas/MessageAuthor'
          description: >-
            The role of the messages author, in this case `system`, `user`,
            `assistant`, or `tool`.
        style:
          $ref: '#/components/schemas/MessageStyle'
          description: >-
            The style of the message. This is used by the client to determine
            how to display the message.
          default: static
        tool_call_id:
          type: string
          title: Tool Call Id
          description: The ID of the tool call that is being requested.
        name:
          type: string
          title: Name
          description: The name of the tool that is being requested.
        arguments:
          additionalProperties: true
          type: object
          title: Arguments
          description: The arguments to the tool.
      type: object
      required:
        - author
        - tool_call_id
        - name
        - arguments
      title: ToolRequestContent
    ToolResponseContent:
      properties:
        type:
          type: string
          const: tool_response
          title: Type
          description: The type of the message, in this case `tool_response`.
          default: tool_response
        author:
          $ref: '#/components/schemas/MessageAuthor'
          description: >-
            The role of the messages author, in this case `system`, `user`,
            `assistant`, or `tool`.
        style:
          $ref: '#/components/schemas/MessageStyle'
          description: >-
            The style of the message. This is used by the client to determine
            how to display the message.
          default: static
        tool_call_id:
          type: string
          title: Tool Call Id
          description: The ID of the tool call that is being responded to.
        name:
          type: string
          title: Name
          description: The name of the tool that is being responded to.
        content:
          title: Content
          description: The result of the tool.
        is_error:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Error
          description: >-
            Whether the tool call resulted in an error. `None` when the harness
            does not report a status.
      type: object
      required:
        - author
        - tool_call_id
        - name
        - content
      title: ToolResponseContent
    TaskMessageDelta:
      oneOf:
        - $ref: '#/components/schemas/TextDelta'
        - $ref: '#/components/schemas/DataDelta'
        - $ref: '#/components/schemas/ToolRequestDelta'
        - $ref: '#/components/schemas/ToolResponseDelta'
        - $ref: '#/components/schemas/ReasoningSummaryDelta'
        - $ref: '#/components/schemas/ReasoningContentDelta'
      title: TaskMessageDelta
      discriminator:
        propertyName: type
        mapping:
          data:
            $ref: '#/components/schemas/DataDelta'
          reasoning_content:
            $ref: '#/components/schemas/ReasoningContentDelta'
          reasoning_summary:
            $ref: '#/components/schemas/ReasoningSummaryDelta'
          text:
            $ref: '#/components/schemas/TextDelta'
          tool_request:
            $ref: '#/components/schemas/ToolRequestDelta'
          tool_response:
            $ref: '#/components/schemas/ToolResponseDelta'
    MessageAuthor:
      type: string
      enum:
        - user
        - agent
      title: MessageAuthor
    MessageStyle:
      type: string
      enum:
        - static
        - active
      title: MessageStyle
    TextFormat:
      type: string
      enum:
        - markdown
        - plain
        - code
      title: TextFormat
    FileAttachment:
      properties:
        file_id:
          type: string
          title: File Id
          description: The unique ID of the attached file
        name:
          type: string
          title: Name
          description: The name of the file
        size:
          type: integer
          title: Size
          description: The size of the file in bytes
        type:
          type: string
          title: Type
          description: The MIME type or content type of the file
      type: object
      required:
        - file_id
        - name
        - size
        - type
      title: FileAttachment
      description: Represents a file attachment in messages.
    TextDelta:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Text Delta
          default: ''
      type: object
      title: TextDelta
      description: Delta for text updates
    DataDelta:
      properties:
        type:
          type: string
          const: data
          title: Type
          default: data
        data_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Delta
          default: ''
      type: object
      title: DataDelta
      description: Delta for data updates
    ToolRequestDelta:
      properties:
        type:
          type: string
          const: tool_request
          title: Type
          default: tool_request
        tool_call_id:
          type: string
          title: Tool Call Id
        name:
          type: string
          title: Name
        arguments_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Arguments Delta
          default: ''
      type: object
      required:
        - tool_call_id
        - name
      title: ToolRequestDelta
      description: Delta for tool request updates
    ToolResponseDelta:
      properties:
        type:
          type: string
          const: tool_response
          title: Type
          default: tool_response
        tool_call_id:
          type: string
          title: Tool Call Id
        name:
          type: string
          title: Name
        content_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Delta
          default: ''
      type: object
      required:
        - tool_call_id
        - name
      title: ToolResponseDelta
      description: Delta for tool response updates
    ReasoningSummaryDelta:
      properties:
        type:
          type: string
          const: reasoning_summary
          title: Type
          default: reasoning_summary
        summary_index:
          type: integer
          title: Summary Index
        summary_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Delta
          default: ''
      type: object
      required:
        - summary_index
      title: ReasoningSummaryDelta
      description: Delta for reasoning summary updates
    ReasoningContentDelta:
      properties:
        type:
          type: string
          const: reasoning_content
          title: Type
          default: reasoning_content
        content_index:
          type: integer
          title: Content Index
        content_delta:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Delta
          default: ''
      type: object
      required:
        - content_index
      title: ReasoningContentDelta
      description: Delta for reasoning content updates

````