Skip to main content
An inline service is a service that you configure in the request that creates a session, instead of adding the service to an access bundle. Only that session can use the inline service, and its credentials are deleted when the session ends. We recommend using inline services when you create sessions from code that already has credentials for the services the agent needs to reach.
A session can use only inline services, or combine them with services in the project.

Prerequisites

  • A machine identity with the Admin role in an Agent Vault project
  • An access token for the machine identity, from the Universal Auth Login endpoint, or an SDK client logged in as the machine identity (Python or Node.js)
  • A running proxy in the same project, which the agent’s machine can reach

Create a session with inline services

Create a session as the machine identity, with your Agent Vault project ID and the inline services in services. In this example, the session gets one HTTP service for api.github.com with a bearer token, and the agent can send only GET requests to that host:
Start the agent with the new session’s token. When the agent finishes, revoke the session.
A machine identity can also send inline services with a session that it creates on behalf of a user. The user doesn’t need the Admin role, and the inline services don’t use the user’s personal values.

Inline service fields

An inline service has the same fields as a service in the project, with the following differences:
  • name is optional for HTTP APIs and MCP servers (without one, the service goes by its first host on the Sessions page and in the session logs)
  • name is required for a database or SSH server, because the agent connects to it by name
  • Credentials, custom header values, and substitution values can’t use variables, so they can’t contain text in double braces, such as {{GITHUB_TOKEN}}
  • An OAuth credential can’t start a sign-in, so it names an OAuth variable or carries tokens you already have (see Use OAuth in an inline service)
  • A credential can’t use member-provided values
  • You can’t change an inline service after you create the session
For the full reference of every field, check out the Create session endpoint, the Python SDK reference, or the Node.js SDK reference.

Limits

  • A session can have up to 30 inline services
  • No two of a session’s services can have the same name (a service without a name counts as its first host)

Use OAuth in an inline service

An HTTP API or MCP server sent with a session can use OAuth in one of two ways. Either way, the proxy sends the access token as Authorization: Bearer <access-token>. To use a sign-in stored in Infisical, name an OAuth variable of the project in variable:
Your backend can also create OAuth variables through the API. If someone deletes the variable while the session is live, the proxy refuses the agent’s requests to the service. To use tokens your code already has, send them with the provider’s endpoints, your OAuth app’s client ID, and the scopes the tokens were granted:
Infisical renews the access token with the refresh token while the session lasts, and deletes the tokens with the session’s other credentials when the session ends. Leave out clientSecret if your OAuth app has none. If the provider rotates refresh tokens, the refresh token you sent stops working once Infisical renews the access token.

Combine with services in the project

To give a session an access bundle as well as inline services, name the access bundle in accessBundle in the same request. A session can have only one access bundle. To add other services from the project, put their names in services next to the inline services, such as "services": ["linear", {"type": "http", ...}]. When you create the session, Infisical checks its services for host conflicts, the same as for the services in one access bundle:
  • If two of the services use the same host pattern, creating the session fails
  • If an inline service and a service from the project cover the same host with different patterns, such as api.github.com and *.github.com, requests to that host use the service with the more specific pattern
If someone later adds a service to the access bundle with the same name as one of the session’s inline services, or renames a service in the access bundle to that name, the session keeps using its own inline service and doesn’t get the access bundle’s service. Other sessions on the access bundle get the access bundle’s service as usual.

Find a session’s inline services

To see a session’s inline services, go to Sessions in your Agent Vault project, select View Session Logs on the session’s row, and look under Inline Services. The Access column on the Sessions page also shows how many inline services a session has. Hover over the count to see their names and hosts.
The Sessions page with the pointer over the 1 inline service badge of the Deploy preview session, showing the vercel service and its host api.vercel.com
The Get session and List sessions endpoints return the inline services in services, and the audit event for creating the session lists them too.

Credential deletion

Infisical deletes the inline services’ credentials, custom header values, and substitution values once the session ends:
  • If someone revokes the session, Infisical deletes the values right away
  • If the session expires, Infisical deletes the values within an hour
If you set ttl to never, revoke the session when the agent finishes, so that Infisical deletes the values. Infisical keeps the rest of each inline service, such as its name and hosts, so you can still find the session’s inline services after the session ends.

Troubleshooting

The machine identity has the Member role in the Agent Vault project. Either give it the Admin role, or add the services to an access bundle, grant the bundle to the machine identity, and name the access bundle or the services instead.To give the machine identity the Admin role:
1
In your Agent Vault project, go to Access Control > Machine Identities.
2
Open the machine identity’s menu and select Change Role.
3
Choose Admin in Product Role, then select Save.
The user or machine identity that created the session no longer has the Admin role in the Agent Vault project. Give the role back, or create a new session as an admin.

Next steps

Session logs

Record every request an agent makes during a session.

HTTP APIs

Limit an HTTP service’s methods and paths, and add custom headers and substitutions.