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

> ## Agent Instructions
> For AgentScope Python, use https://docs.agentscope.io/stable/en/index for new projects. For existing projects, check the installed agentscope version and use matching versioned documentation.
> The /latest/ alias points to development documentation. Use it only with the matching development source. Do not mix AgentScope 1.x and 2.x APIs.
> State the AgentScope version when providing installation commands or code examples. ReMe uses its own continuously updated /reme/latest/ documentation.

# Get Workspace Status

> Report where a session is pointed, and the git state of that place.

The directory comes from the session's own ``cwd`` rather than a
query parameter: it is the session's anchor, and resolving a
relative one needs the workspace root the client cannot see.

Git is best-effort. A directory that is not a repository is the
normal case, not an error, and the sandboxed backends differ in how
they report a missing binary or an unreachable container — so every
failure collapses to ``git: null`` and the rest of the response is
still served.



## OpenAPI

````yaml /en/versions/2.0.9/deploy/openapi.json get /workspace/status
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.9
servers: []
security: []
paths:
  /workspace/status:
    get:
      tags:
        - workspace
      summary: Get Workspace Status
      description: |-
        Report where a session is pointed, and the git state of that place.

        The directory comes from the session's own ``cwd`` rather than a
        query parameter: it is the session's anchor, and resolving a
        relative one needs the workspace root the client cannot see.

        Git is best-effort. A directory that is not a repository is the
        normal case, not an error, and the sandboxed backends differ in how
        they report a missing binary or an unreachable container — so every
        failure collapses to ``git: null`` and the rest of the response is
        still served.
      operationId: get_workspace_status_workspace_status_get
      parameters:
        - name: agent_id
          in: query
          required: true
          schema:
            type: string
            title: Agent Id
        - name: session_id
          in: query
          required: true
          schema:
            type: string
            title: Session Id
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceStatus'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WorkspaceStatus:
      properties:
        workdir:
          type: string
          title: Workdir
          description: >-
            Absolute path of the workspace root. Backend-dependent — a host
            directory locally, a fixed path inside the sandbox otherwise — so
            the client cannot derive it.
        cwd:
          type: string
          title: Cwd
          description: >-
            Absolute path the session is focused on, resolved from
            :attr:`SessionConfig.cwd`. Equals :attr:`workdir` when that is
            unset.
        git:
          anyOf:
            - $ref: '#/components/schemas/GitStatus'
            - type: 'null'
          description: >-
            Git state of :attr:`cwd`, or null when there is none to report — not
            a repository, git unavailable, the command timed out, or the backend
            could not run it. The caller shows no branch either way, so the
            reasons are logged rather than returned.
      type: object
      required:
        - workdir
        - cwd
      title: WorkspaceStatus
      description: Where a session is pointed, and the git state of that place.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GitStatus:
      properties:
        branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Branch
          description: Current branch, or null on a detached HEAD.
        head:
          anyOf:
            - type: string
            - type: 'null'
          title: Head
          description: >-
            Full commit SHA of HEAD, or null when the repository has no commits
            yet. Never abbreviated — how many characters to show is the caller's
            decision.
        ahead:
          anyOf:
            - type: integer
            - type: 'null'
          title: Ahead
          description: >-
            Commits ahead of the upstream branch. Null when no upstream is
            configured, which is a different state from zero: git omits the
            counts entirely in that case.
        behind:
          anyOf:
            - type: integer
            - type: 'null'
          title: Behind
          description: Commits behind the upstream branch. Null as above.
        insertions:
          type: integer
          title: Insertions
          description: >-
            Lines added relative to HEAD. Untracked files contribute nothing —
            ``git diff`` does not see them — so a session that only created
            files reports zero here and a non-zero ``untracked``.
          default: 0
        deletions:
          type: integer
          title: Deletions
          description: Lines removed relative to HEAD, same caveat.
          default: 0
        staged:
          type: integer
          title: Staged
          description: Files with staged changes.
          default: 0
        unstaged:
          type: integer
          title: Unstaged
          description: Files with unstaged changes.
          default: 0
        untracked:
          type: integer
          title: Untracked
          description: Files git is not tracking.
          default: 0
        conflicted:
          type: integer
          title: Conflicted
          description: Files with unresolved merge conflicts.
          default: 0
      type: object
      title: GitStatus
      description: Git state of one directory, as shown next to the composer.
    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

````