Do not commit the `.env` file to Git. Make sure to add it to your `.gitignore` file.
Use Agent Development Kit to Build, Test, and Deploy Agentspublic
Validated on 9 Dec 2025 • Last edited on 29 Jan 2026
DigitalOcean Gradient™ AI Platform lets you build fully-managed AI agents with knowledge bases for retrieval-augmented generation, multi-agent routing, guardrails, and more, or use serverless inference to make direct requests to popular foundation models.
The Agent Development Kit (ADK) is an SDK to build, test, and deploy agent workflows from within your development environments. You can opt in the public preview from the Feature Preview page.
Prerequisites
You must have the following prerequisites to use the ADK:
-
Python version 3.10 or higher. Run
python --versionorpython3 --versionto check your Python version.If your version is not 3.10 or higher, you can install it using one of these methods:
-
Download from python.org.
-
Run one of the following commands in your command line terminal:
pyenv install 3.13.0 && pyenv local 3.13.0conda create -n gradient python=3.13 && conda activate gradient
-
-
ADK Feature Preview enabled. You can opt in from the Feature Preview page. If you can’t see the option, contact your team owner to enable it for you.
-
API Access Keys. You need the following keys to use the ADK:
-
Model access key to authenticate access to open-source and commercial models for serverless inference on the Gradient AI Platform.
Go to the Serverless Inference tab in the control panel and scroll down to the Model Access Keys section. Click Create Access Key or copy an existing one.
Add the model access key as the
GRADIENT_MODEL_ACCESS_KEYenvironment variable to the.envfile.For running or testing your agent locally, you must also export the key so that it is accessible to the application. To do this, run the following command:
export GRADIENT_MODEL_ACCESS_KEY="<your_model_key>" -
Your account’s personal access token to allow deploying agents to your DigitalOcean account.
Go to the API Tokens page in the control panel and click Generate New Token. Configure the following CRUD scopes:
- Create, read, update, delete scopes for
genai - Read scope for
project
Provide a descriptive name for your token such as
Gradient ADK - Production.Add the API key as the
DIGITALOCEAN_API_TOKENenvironment variable to the.envfile. - Create, read, update, delete scopes for
-
-
An
.envfile with environment variables to use in agent deployment. Use the following command to create the.envfile and add the model access key,GRADIENT_MODEL_ACCESS_KEY, and your account’s personal access token,DIGITALOCEAN_API_TOKEN, environment variables to enable agent deployment to your DigitalOcean account:cat > .env << EOF GRADIENT_MODEL_ACCESS_KEY=<your_model_key> DIGITALOCEAN_API_TOKEN=<your_api_token> EOFWarning -
A
requirements.txtfile at the root of the folder or repo to deploy, listing your dependencies.
Build New Agent
To build and deploy a new agent using the ADK, follow these steps:
-
Initialize a new agent project using the following command:
gradient agent initWhen prompted, specify an agent workspace name and an agent deployment name. For example,
my-first-agentanddevelopment.When you run this command, the following directory structure is created:
my-agent/ ├── main.py # Your entrypoint (modify this!) ├── .gradient/ │ └── agent.yml # Config (don't edit manually) ├── requirements.txt # Python packages (add dependencies here) ├── .env # API keys (YOU create this) ├── agents/ # Your agent code (optional) └── tools/ # Custom tools (optional)To provide an easy way for you to create an agent, the command also:
- Creates a base template (
main.py) for a simple LangGraph example agent that calls aopenai-gpt-oss-120bmodel using serverless inference - Creates a configuration file (
agents.yml) required to run or deploy your agent - Installs all necessary dependencies for agent development
- Creates a base template (
-
Run and test the example agent locally using the following command:
gradient agent runThe output looks like this:
Entrypoint: main.py Server: http://0.0.0.0:8080 Agent: my-first-agent Entrypoint endpoint: http://0.0.0.0:8080/runYou can then access the agent and interact with it at the
http://0.0.0.0:8080/runendpoint.To interact with the agent, send a
POSTrequest to this endpoint with a prompt in the request body. For example, your request body can be'{"prompt": "How are you?"}':curl -X POST http://localhost:8080/run \ -H "Content-Type: application/json" \ -d '{"prompt": "Hello! How are you?"}'Your agent processes the request and returns a response:
{ "response": "Hello! I'm doing well, thank you for asking. How can I help you today?" }To view more verbose logs, use:
gradient agent run --verbose -
Once you verify that your agent is working correctly locally, deploy it to your DigitalOcean account using the following commands:
export DIGITALOCEAN_API_TOKEN="<your_api-token>" gradient agent deployThe deployment takes between 1 to 5 minutes. After the deployment succeeds, you see a
Deployment completed successfullymessage and the deployment URL that the agent is running on in your terminal.✅ Deployment completed successfully! [01:23] Agent deployed successfully! (my-first-agent/development) Deployment URL: https://agents.do-ai.run/v1/abc123-xxxx-xxxx/development/run -
Test the deployed agent by sending a
POSTrequest with a prompt in the request body to the deployment endpoint URL. For example, the request body can be'{"prompt": "hello"}:curl -X POST \ -H "Authorization: Bearer $DIGITALOCEAN_API_TOKEN" \ -H "Content-Type: application/json" \ "https://agents.do-ai.run/v1/abc123-xxxx-xxxx/development/run" \ -d '{"prompt": "Hello deployed agent!"}'Your agent deployment processes the request and returns a response:
{ "response": "Hello! How can I assist you today?" }
For more detailed information on building, testing, and deploying agents using the ADK, see Build Agents Using Agent Development Kit.