---
title: How to Configure Action Gateway for Production Agents (public)
description: Configure production agents with selected tools, explicit permissions, preloading, direct Python calls, and focused tool outputs.
product: Managed Agents
url: https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/use-in-production/
last_updated: "2026-10-22"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Configure Action Gateway for Production Agents (public)

Action Gateway connects applications and AI agents to tools through a managed MCP endpoint or SDK, with the accounts and permissions you choose. See [What You Can Build](https://docs.digitalocean.com/products/managed-agents/action-gateway/details/what-you-can-build/index.html.md) for standalone agent examples.

Use Action Gateway to give a production agent the tools its workflow needs without granting access to the entire catalog. An **All tools** session supports open-ended tasks. For a known workflow, select specific tools, define their permissions, and control how the agent discovers them and consumes their results.

These controls make tool use more predictable, but do not make model decisions deterministic. Put fixed tool calls and step ordering in application code when the workflow must follow a known sequence.

**Note**:

  Action Gateway is in [public preview](https://docs.digitalocean.com/platform/product-lifecycle/index.html.md#public-preview).

## Prerequisites

- Access to Action Gateway and a working [client connection](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/connect-action-gateway/index.html.md).
- A development environment where you can test tools without changing production resources.

## Restrict the Session’s Tools and Permissions

Start with one workflow. For example, a capacity-planning agent might read Droplet sizes and inventory to recommend a configuration, without permission to create or delete Droplets.

Use [Tool Playground](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/use-tool-playground/index.html.md) during development to inspect the tools’ names, arguments, and results. When [creating the production session](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/manage-sessions/index.html.md):

1. Choose **Selected tools** instead of **All tools** and include only the operations the workflow needs.
2. Set **Default Action** to **Deny**.
3. Set **Allow** for reviewed calls that can run unattended. Use **Ask** only where a person can complete the [approval flow](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/configure-server-side-approval/index.html.md).
4. Leave unrelated operations out of the selection. An approval or an allow rule cannot authorize a tool outside that selection.

Use a versioned [Toolbelt](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/toolbelts/index.html.md) to reuse an approved group across sessions. Review its members before adopting a new version. Session instructions can describe the workflow, but only [tool selection and policy](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/tool-policies/index.html.md) enforce tool access.

Keep tool selection separate from account access. An issue-triage Toolbelt can serve many application users, while each user’s actor ID selects their own GitHub and Linear connections. Reusing the Toolbelt does not share those accounts or credentials.

If your agent uses `action_search`, `action_invoke`, or `action_code`, allow the required meta tools as well. Their catalog calls still obey the selected-tool policy.

## Preload Known Tools and Limit Runtime Discovery

Enable **Preload** for the small set of tools the agent regularly uses. Their definitions are available immediately, so the model can call them without first searching. Preloading reduces discovery calls, but adds definitions to model context even when a task does not use them.

Keep [Tool Search](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/tool-search/index.html.md) available when the agent needs to choose among the session’s permitted tools. For a fixed workflow, preload the required tools and omit search access. Preloading alone does not restrict access. The session’s selection and policy do.

MCP clients receive preloaded definitions in the session’s tool list. With PyDo, use `session.tools(include_all=True)` when supplying those definitions to a model. The default `session.tools()` supplies the meta tools instead. See [Preloading Tools](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/preloading-tools/index.html.md).

## Call Tools Directly for Fixed Workflow Steps

When your application already knows the tool and its arguments, call it from Python instead of asking a model to select it. Your code controls the call and its place in the workflow. The gateway still checks permissions and resolves provider credentials.

The following example creates a session that selects, allows, and preloads only the read-only Droplet sizes tool. It calls that tool without a model, search, or `action_code` execution.

Make a [DigitalOcean personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) authorized for Action Gateway available as `DIGITALOCEAN_TOKEN`. Keep the token out of source control and agent conversations. Replace `<actor-id>` with your application’s stable user identifier.

### Python

Install PyDo in your Python environment:

```shell
pip install pydo
```

Create `capacity_planner.py` with the following content:

```python
import os

from pydo.action_gateway import ActionGatewayClient

gateway = ActionGatewayClient(token=os.environ["DIGITALOCEAN_TOKEN"])
session = gateway.session.create(
    actor_id="<actor-id>",
    name="capacity-planner",
    tools=["digitalocean_size-list"],
    permissions={
        "default_action": "deny",
        "rules": [{"tool": "digitalocean_size-list", "action": "allow"}],
    },
    config={"preloadTools": ["digitalocean_size-list"]},
)

sizes = session.tools.call("digitalocean_size-list", {})
print(sizes)
```

Run the example to create the session and retrieve the available sizes:

```shell
python capacity_planner.py
```

### Go

Install Godo:

```shell
go get github.com/digitalocean/godo
```

Create `capacity_planner.go` with the following content:

```go
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.Background()

	session, _, err := client.ActionGateway.Sessions.CreateRuntime(ctx, &godo.ActionGatewaySessionCreateRequest{
		Name:    "capacity-planner",
		ActorID: "<actor-id>",
		Tools:   []string{"digitalocean_size-list"},
		Policy: &godo.ActionGatewaySessionPolicy{
			DefaultAction: "deny",
			Rules: []godo.ActionGatewaySessionPolicyRule{
				{Tool: "digitalocean_size-list", Action: "allow"},
			},
		},
		Config: json.RawMessage(`{"preloadTools":["digitalocean_size-list"]}`),
	})
	if err != nil {
		panic(err)
	}

	sizes, _, err := session.Tools.Call(ctx, "digitalocean_size-list", map[string]interface{}{})
	if err != nil {
		panic(err)
	}
	fmt.Println(string(sizes))
}
```

Run the example to create the session and retrieve the available sizes:

```shell
go run capacity_planner.go
```

Each run creates a session. In your application, reuse the session for subsequent calls in the workflow. Handle invocation errors before advancing to dependent steps, and send only the data needed for any later model decision.

For agent-written Python workflows, use the [Code Execution Tool](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/code-execution-tool/index.html.md#programmatic-tool-calling). It runs code in a temporary sandbox and can combine tool calls and filter intermediate results before returning a summary to the model. It does not make generated code deterministic or bypass the session’s permissions.

## Return Only the Fields the Workflow Needs

[Create an output view](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/add-tool-output-view/index.html.md) for each tool with a supported output schema. Keep the fields needed for the next decision. For a capacity-planning workflow, those might include size, memory, and price information rather than every provider field.

When creating the session, choose the view in the tool’s **Output view** control instead of **Full output**. The view applies to direct calls, `action_invoke`, and calls inside `action_code`. Test downstream code against this reduced output shape, including empty results and missing optional fields.

Views reduce result data and can lower model-token costs. They do not change the provider operation, credential scopes, or invocation charges. These examples use full output and do not require an output view.

## Authorize Accounts Before Unattended Runs

[Authorize provider connections](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/manage-connections/index.html.md) before deploying a workload that cannot pause for sign-in. Create the connection and session as the same DigitalOcean user, in the same team, with the same actor ID. Limit the credential’s scopes in the provider itself. Gateway policy does not reduce those scopes.

If your application serves other users, [have each user authorize their own provider account](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/manage-connections/index.html.md#connect-an-application-users-account). Your backend creates and owns the connection using its DigitalOcean credentials. The account holder completes provider consent. Keep the token in your backend and derive the actor ID from the authenticated user, not an untrusted request. Use separate actors for different accounts at the same provider.

When a tool needs renewed consent, pause or fail the dependent step, ask the account holder to reconnect, and resume after authorization completes. Keep the same actor and session URL. Check for effects from an earlier attempt before retrying a write. See [Restore Provider Access](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/manage-connections/index.html.md#restore-provider-access).

## Test and Deploy the Configuration

Before deploying, verify that:

- Required calls succeed, while calls outside the selected tools or policy fail. Test restrictions in a development environment without attempting unwanted production writes.
- The session uses the intended provider accounts and returns the output fields your application expects.
- The application handles denied calls, unavailable connections, rate limits, timeouts, and partial failures without treating them as successful results.
- Write recovery checks provider state before resubmitting an operation. [Automatic retries](https://docs.digitalocean.com/products/managed-agents/action-gateway/concepts/reliable-execution/index.html.md) do not make a new invocation safe to repeat or a multi-tool workflow transactional.

Keep the tool selection, policy, preloads, and output-view bindings in your deployment configuration. Create a replacement session when those settings change, test it, and update the application or MCP client to use it. Check view compatibility when changing tool versions.

Monitor errors, latency, and calls in [Action Gateway Insights](https://docs.digitalocean.com/products/managed-agents/action-gateway/how-to/track-usage/index.html.md). Review [pricing](https://docs.digitalocean.com/products/managed-agents/action-gateway/details/pricing/index.html.md) for tool invocation, code execution, and paid provider tools before scaling the workload.

For complete session configurations that apply these controls, use the [web research assistant](https://docs.digitalocean.com/products/managed-agents/action-gateway/examples/build-research-assistant/index.html.md) or [Jira issue triage](https://docs.digitalocean.com/products/managed-agents/action-gateway/examples/triage-jira-issues/index.html.md) examples.