Skip to main content

CX Agent Studio Scripting API (CXAS SCRAPI)

License PyPI Python Unit Tests

CXAS SCRAPI Logo

A powerful Python API, CLI, and set of Agent Skills for CX Agent Studio to automate, evaluate, and scale your agents with ease.

Important Links: Docs, Examples, Agent Skills, Core SDK

CX Agent Studio Scripting API (CXAS SCRAPI) is an open-source Python scripting API, CLI, and set of Agent Skills for CX Agent Studio. It is designed to simplify building, deploying, and orchestrating agent workflows, from simple tasks to complex systems. It integrates seamlessly with Agentic IDEs like Gemini CLI, Claude Code, and Antigravity, exposing advanced tooling for deep evaluations, real-time latency metrics, offline linting, and conversation history.


Built With

  • Python 3.10+

Authentication

Authentication can vary depending on how and where you are interacting with SCRAPI.

Google Colab

If you're using CXAS SCRAPI with a Google Colab notebook, you can add the following to the top of your notebook for easy authentication:

pip install cxas-scrapi
project_id = '<YOUR_GCP_PROJECT_ID>'

# this will launch an interactive prompt that allows you to auth with GCP in a browser
!gcloud auth application-default login --no-launch-browser

# this will set your active project to the `project_id` above
!gcloud auth application-default set-quota-project $project_id

After running the above, Colab will pick up your credentials from the environment and pass them to CXAS SCRAPI directly. No need to use Service Account keys! You can then use CXAS SCRAPI simply like this:

from cxas_scrapi import Apps

project_id = '<YOUR_GCP_PROJECT_ID>'
location = 'us'

app_client = Apps(project_id=project_id, location=location) # <-- Creds will be automatically picked up from the environment
apps_map = app_client.get_apps_map()

Cloud Functions / Cloud Run

If you're using CXAS SCRAPI with Cloud Functions or Cloud Run, CXAS SCRAPI can pick up on the default environment creds used by these services without any additional configuration!

  1. Add cxas-scrapi to your requirements.txt file
  2. Ensure the Cloud Function / Cloud Run service account has the appropriate Custom Agent / Conversational Agents IAM Role

Once you are setup with the above, your function code can be used easily like this:

from cxas_scrapi import Agents

app_name = '<YOUR_APP_NAME>'
a = Agents(project_id='<YOUR_GCP_PROJECT_ID>', location='global')
agents_map = a.get_agents_map(app_name)

Local Python Environment

Similar to Cloud Functions / Cloud Run, CXAS SCRAPI can pick up on your local authentication creds if you are using the gcloud CLI.

  1. Install gcloud CLI.
  2. Run gcloud init.
  3. Run gcloud auth login
  4. Run gcloud auth application-default login
  5. Run gcloud auth list to ensure your principal account is active.

This will authenticate your principal GCP account with the gcloud CLI, and SCRAPI can pick up the creds from here.


Exceptions and Misc.

If you prefer to explicitly assign Service Account credentials programmatically instead of relying on the environmental application-default, you can pass the path to your JSON key using creds_path.

from cxas_scrapi import Tools

creds_path = '<PATH_TO_YOUR_SERVICE_ACCOUNT_JSON_FILE>'

t = Tools(project_id='<YOUR_GCP_PROJECT_ID>', location='global', creds_path=creds_path)
tools_map = t.get_tools_map('<YOUR_APP_NAME>')

Getting Started

Environment Setup

Set up Google Cloud Platform credentials and install dependencies.

gcloud auth login
gcloud auth application-default login
gcloud config set project <project name>
uv sync
source .venv/bin/activate

Usage

To run a simple bit of code you can do the following:

  • Import a Class from cxas_scrapi
  • Define your GCP Project and Location
from cxas_scrapi import Apps

# Instantiate your class object and pass in your credentials
app_client = Apps(project_id='<YOUR_GCP_PROJECT_ID>', location='global')

# Retrieve all Apps existing in your project
apps = app_client.list_apps()
for app in apps:
    print(app.display_name, app.name)

Library Composition

Here is a brief overview of the CXAS SCRAPI library's structure and the motivation behind that structure.

Core

The src/cxas_scrapi/core directory contains the high level building blocks of CXAS SCRAPI, mapped to core resource types in the CXAS environment (Apps, Agents, Tools, Guardrails, Deployments, Sessions, etc.)

Utils

The src/cxas_scrapi/utils directory contains helper functions and background logic for pagination, response flattening, proto conversions, and external integrations like Google Sheets.

Evals

The src/cxas_scrapi/evals directory provides tools for executing and analyzing agent performance evaluations, including Golden tests and simulation runs, and extracting metrics like latency.

CLI

The src/cxas_scrapi/cli directory implements the command line interface for SCRAPI, offering tools like cxas lint to automate development and validation workflows.

Migration

The src/cxas_scrapi/migration directory contains tools to facilitate transitioning legacy Dialogflow CX agents to CXAS, including agent generation from flows and artifact building.

Documentation

The official documentation is hosted online at https://googlecloudplatform.github.io/cxas-scrapi/stable/.

The documentation site is built with MkDocs Material. To run it locally:

# Install dependencies including docs extras
uv sync --extra docs

# Start the local dev server
uv run mkdocs serve

Open http://127.0.0.1:8000 in your browser. Changes to files in docs/ will reload automatically.

To build the static site without serving:

mkdocs build          # output goes to site/
mkdocs build --strict # also fails on warnings (used in CI)

Contributing

We welcome any contributions or feature requests you would like to submit!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

Contact

Patrick Marlow - pmarlow@google.com - @kmaphoenix

Project Link: https://github.com/GoogleCloudPlatform/cxas-scrapi

References

Metadata

Release files for cxas-scrapi 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cxas-scrapi 1.11.0
File Size Uploaded Provenance Actions
cxas_scrapi-1.11.0.tar.gz 23.7 MB With provenance Details for cxas_scrapi-1.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cxas-scrapi 1.11.0
File Interpreter ABI Platform Actions
cxas_scrapi-1.11.0-py3-none-any.whl Python 3 none any Details for cxas_scrapi-1.11.0-py3-none-any.whl

Total release size: 28.3 MB

Release files / cxas_scrapi-1.11.0.tar.gz

Download URL cxas_scrapi-1.11.0.tar.gz
Size 23.7 MB
Tags Source
SHA-256 checksum
How to use checksums
1a9b06c580a90cd2c7359b6a482af3880b1c1ffc9e9cdd02f7a3c9c8d00af771
BLAKE2b-256 checksum
How to use checksums
6588048919ca5146447a7e1315140bdcfc8b3ea181d7398b58bdc0cf2df06a2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / cxas_scrapi-1.11.0-py3-none-any.whl

Download URL cxas_scrapi-1.11.0-py3-none-any.whl
Size 4.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8d1d1b386e157828da22f573d81e6b566d72aa549a41b08936ad6190e91314ce
BLAKE2b-256 checksum
How to use checksums
887ddbf0bf4f1077d78cf0121eb4a6d587e7ed6c3d399b244ee72061efa89816
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for cxas-scrapi 1.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cxas_scrapi-1.11.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page