$npx -y skills add digitalocean-labs/do-app-platform-skills --skill ai-servicesConfigure DigitalOcean Gradient AI serverless inference and Agent Development Kit. Use when adding LLM inference, model access keys, serverless AI endpoints, or building AI agents with ADK on App Platform.
| 1 | # AI Services Skill |
| 2 | |
| 3 | Configure DigitalOcean Gradient AI Platform for App Platform applications. |
| 4 | |
| 5 | > **Tip**: This is one specialized skill in the App Platform library. For complex multi-step projects, consider using the **planner** skill to generate a staged approach. For an overview of all available skills, see the [root SKILL.md](../../SKILL.md). |
| 6 | |
| 7 | --- |
| 8 | |
| 9 | ## Quick Decision |
| 10 | |
| 11 | ``` |
| 12 | What do you need? |
| 13 | ├── Simple LLM API calls → Serverless Inference |
| 14 | │ OpenAI-compatible API, no agent management |
| 15 | │ |
| 16 | └── Full AI agents → Agent Development Kit (ADK) |
| 17 | Knowledge bases, RAG, guardrails, multi-agent routing |
| 18 | ``` |
| 19 | |
| 20 | | Need | Solution | Reference | |
| 21 | |------|----------|-----------| |
| 22 | | Call LLM models directly | Serverless Inference | [serverless-inference.md](reference/serverless-inference.md) | |
| 23 | | Build agents with knowledge bases | ADK | [agent-development-kit.md](reference/agent-development-kit.md) | |
| 24 | | Content filtering / guardrails | ADK | [agent-development-kit.md](reference/agent-development-kit.md) | |
| 25 | | Multi-agent workflows | ADK | [agent-development-kit.md](reference/agent-development-kit.md) | |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## Credential Handling |
| 30 | |
| 31 | Model access keys follow the standard credential hierarchy: |
| 32 | |
| 33 | 1. **GitHub Secrets** (recommended): User creates key → adds to GitHub Secrets → app spec references |
| 34 | 2. **App Platform Secrets**: Set via `doctl apps update` with `type: SECRET` |
| 35 | |
| 36 | ```yaml |
| 37 | # App Spec pattern |
| 38 | envs: |
| 39 | - key: MODEL_ACCESS_KEY |
| 40 | scope: RUN_TIME |
| 41 | type: SECRET |
| 42 | value: ${MODEL_ACCESS_KEY} # From GitHub Secrets |
| 43 | ``` |
| 44 | |
| 45 | **Key creation**: Control Panel → Serverless Inference → Model Access Keys |
| 46 | |
| 47 | > Keys shown **only once** after creation—store securely. |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | ## Quick Start: Serverless Inference |
| 52 | |
| 53 | ```yaml |
| 54 | # .do/app.yaml |
| 55 | services: |
| 56 | - name: api |
| 57 | envs: |
| 58 | - key: MODEL_ACCESS_KEY |
| 59 | scope: RUN_TIME |
| 60 | type: SECRET |
| 61 | value: ${MODEL_ACCESS_KEY} |
| 62 | - key: INFERENCE_ENDPOINT |
| 63 | value: https://inference.do-ai.run |
| 64 | ``` |
| 65 | |
| 66 | ```python |
| 67 | # Python SDK (OpenAI-compatible) |
| 68 | from openai import OpenAI |
| 69 | import os |
| 70 | |
| 71 | client = OpenAI( |
| 72 | base_url=os.environ["INFERENCE_ENDPOINT"] + "/v1", |
| 73 | api_key=os.environ["MODEL_ACCESS_KEY"], |
| 74 | ) |
| 75 | |
| 76 | response = client.chat.completions.create( |
| 77 | model="llama3.3-70b-instruct", |
| 78 | messages=[{"role": "user", "content": "Hello!"}], |
| 79 | ) |
| 80 | ``` |
| 81 | |
| 82 | **Full guide**: See [serverless-inference.md](reference/serverless-inference.md) |
| 83 | |
| 84 | --- |
| 85 | |
| 86 | ## Quick Start: Agent Development Kit |
| 87 | |
| 88 | ```bash |
| 89 | # Install and configure |
| 90 | pip install gradient-adk |
| 91 | gradient agent configure |
| 92 | |
| 93 | # Run locally |
| 94 | gradient agent run |
| 95 | # → http://localhost:8080/run |
| 96 | |
| 97 | # Deploy to DigitalOcean |
| 98 | gradient agent deploy |
| 99 | ``` |
| 100 | |
| 101 | ```python |
| 102 | # Agent entrypoint |
| 103 | from gradient_adk import entrypoint |
| 104 | |
| 105 | @entrypoint |
| 106 | def entry(payload, context): |
| 107 | query = payload["prompt"] |
| 108 | return {"response": "Hello from agent!"} |
| 109 | ``` |
| 110 | |
| 111 | **Full guide**: See [agent-development-kit.md](reference/agent-development-kit.md) |
| 112 | |
| 113 | --- |
| 114 | |
| 115 | ## Available Models |
| 116 | |
| 117 | | Model | Use Case | |
| 118 | |-------|----------| |
| 119 | | `llama3.3-70b-instruct` | General purpose, high quality | |
| 120 | | `llama3-8b` | Faster, lower cost | |
| 121 | | `mistral-7b` | Efficient, multilingual | |
| 122 | |
| 123 | ```bash |
| 124 | # List all available models |
| 125 | doctl genai list-models |
| 126 | ``` |
| 127 | |
| 128 | Check [Gradient AI Models](https://docs.digitalocean.com/products/gradient-ai-platform/details/models/) for current availability. |
| 129 | |
| 130 | --- |
| 131 | |
| 132 | ## Reference Files |
| 133 | |
| 134 | - **[serverless-inference.md](reference/serverless-inference.md)** — SDK setup, API parameters, examples |
| 135 | - **[agent-development-kit.md](reference/agent-development-kit.md)** — ADK workflow, knowledge bases, guardrails |
| 136 | |
| 137 | --- |
| 138 | |
| 139 | ## Quick Troubleshooting |
| 140 | |
| 141 | | Error | Cause | Fix | |
| 142 | |-------|-------|-----| |
| 143 | | `401 Unauthorized` | Invalid model access key | Verify key in GitHub Secrets | |
| 144 | | `Model not found` | Invalid model ID | Run `doctl genai list-models` | |
| 145 | | `Rate limit exceeded` | Too many requests | Implement exponential backoff | |
| 146 | | ADK deploy fails | Missing token scopes | Ensure `genai` CRUD + `project` read scopes | |
| 147 | |
| 148 | --- |
| 149 | |
| 150 | ## Integration with Other Skills |
| 151 | |
| 152 | - **→ designer**: Add AI service environment variables to app spec |
| 153 | - **→ deployment**: Model access key stored in GitHub Secrets |
| 154 | - **→ devcontainers**: Test AI integrations locally before deployment |
| 155 | - **→ planner**: Plan AI-enabled app deployments |
| 156 | |
| 157 | --- |
| 158 | |
| 159 | ## Documentation Links |
| 160 | |
| 161 | - [Gradient AI Platform](https://docs.digitalocean.com/products/gradient-ai-platform/) |
| 162 | - [Available Models](https://docs.digitalocean.com/products/gradient-ai-platform/details/models/) |
| 163 | - [Serverless Inference](https://docs.digitalocean.com/products/gradient-ai-platform/how-to/serverless-inference/) |
| 164 | - [Agent Development Kit](https://docs.digitalocean.com/products/gradient-ai-platform/how-to/adk/) |