Skip to main content
POST
/
v1
/
agents
/
{agent_id}
/
sandbox
/
glob
Sandbox: Glob
curl --request POST \
  --url https://api.xpander.ai/v1/agents/{agent_id}/sandbox/glob \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "pattern": "**/*.py",
  "root_dir": "src",
  "max_results": 1000
}
'
{
  "status": "ok",
  "stdout": "<string>",
  "stderr": "<string>",
  "exit_code": 123,
  "content": "<string>",
  "path": "<string>",
  "matches": [
    {}
  ],
  "url": "<string>",
  "error": "<string>"
}
Find files in the per-agent sandbox matching a glob pattern (e.g. **/*.py). Useful for discovering files before reading or editing them.

Path Parameters

agent_id
string
required
Agent ID (UUID)

Request Body

pattern
string
required
Glob pattern to match (e.g. **/*.py).
root_dir
string
Directory to search from, relative to the sandbox root. Defaults to the sandbox root when omitted.
max_results
integer
default:1000
Maximum number of matches to return.

Response

status
string
Result status (e.g., ok).
matches
array
Array of matching file paths.

Example Request

curl -X POST "https://api.xpander.ai/v1/agents/<agent-id>/sandbox/glob" \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "pattern": "**/*.py",
    "root_dir": "src",
    "max_results": 1000
  }'

Notes

  • Use ** to match across directory boundaries and * to match anything within a single path segment.
  • Combine with Sandbox: Grep to search the contents of the matched files.

See Also

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

agent_id
string
required

Agent UUID

Body

application/json

Request body for finding files in the agent sandbox by glob pattern.

pattern
string
required

Glob pattern to match (e.g. **/*.py).

Example:

"**/*.py"

root_dir
string

Directory to search from, relative to the sandbox root. Defaults to the sandbox root when omitted.

Example:

"src"

max_results
integer
default:1000

Maximum number of matches to return.

Required range: x >= 1

Response

Successful Response

Generic response wrapper returned by agent sandbox endpoints. Not every field is populated for every tool.

status
string

Result status of the sandbox operation.

Example:

"ok"

stdout
string | null

Standard output captured from the sandbox command. Present for bash.

stderr
string | null

Standard error captured from the sandbox command. Present for bash.

exit_code
integer | null

Process exit code returned by the sandbox. Present for bash.

content
string | null

File contents. Present for file_read.

path
string | null

File path affected by the operation. Present for file_write, file_edit, multi_edit, file_share.

matches
Matches · object[] | null

Match results. Present for glob and grep.

url
string<uri> | null

Public CDN URL. Present for file_share.

error
string | null

Error message when the operation fails.