Skip to main content

D-11 Credential Broker

Brick D: Tools, skills, plugins, MCP, connectors. French version: D-11-credential-broker

1. Role and responsibilities​

Stores long lived secrets in OpenBao and issues short lived delegated tokens; the agent never sees the long secret.

  • Write only credentials
  • Lease with TTL and reduced scopes
  • Revocation (kill switch, incident)

2. Position in the architecture and interactions​

  • Callers: Tool Gateway, Connector Hub, MCP Gateway.
  • Execution path: Synchronous.
  • Every interaction goes through the Control Plane API v1 (/v1) behind the API Gateway (D-14).

3. Open source component and developed part​

  • Open source: OpenBao
  • Developed: Lease API, OAuth token exchange.
  • External integration through an adapter eai/integrations/<system>.py with an in-process fallback when the URL is not configured.

4. Data model​

Tables (schema eai, tenant_id RLS):

  • eai.connectors (credential_ref)
  • eai.credential_leases

Common columns: id uuid, tenant_id uuid NOT NULL, created_at, updated_at; RLS policy current_setting('app.tenant_id', true)::uuid.

5. Contract​

  • Applied contract: connector-manifest, tool-manifest
  • JSON Schema: contracts/v1/tool-manifest.schema.json, contracts/v1/connector-manifest.schema.json
  • Key fields: spec.auth, spec.credential_ref
  • Validation: POST /v1/contracts/{name}/validate; manifest apply: POST /v1/manifests/apply.

6. API endpoints​

  • POST /v1/connectors/{name}/credentials
  • POST /v1/credentials/broker/lease
  • POST /v1/secrets

Request POST /v1/credentials/broker/lease:

{
"connector": "salesforce-eu",
"scopes": [
"Case:read"
],
"ttl_seconds": 300,
"run_id": "run_01J9"
}

Response:

{
"lease_id": "lease_9",
"token_ref": "lease:9",
"expires_at": "2025-01-10T10:05:00Z"
}

7. SDK examples​

Python:

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_xxx_secret")
client.connectors.set_credentials("salesforce-eu", {"client_id": "...", "client_secret": "..."})
lease = client.connectors.lease(connector="salesforce-eu", scopes=["Case:read"], ttl_seconds=300)

TypeScript:

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY });
const lease = await client.credentials.lease({ connector: "salesforce-eu", ttl_seconds: 300 });

Java:

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.build();
JsonNode lease = client.credentials().lease(Map.of("connector", "salesforce-eu", "scopes", List.of("Case:read"), "ttl_seconds", 300));

Go:

c, _ := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")))
lease, _ := c.Credentials.Lease(ctx, map[string]any{"connector": "salesforce-eu", "ttl_seconds": 300})

8. Configuration​

  • Environment variables: EAI_OPENBAO_URL, EAI_OPENBAO_TOKEN, EAI_DATABASE_URL
  • Helm values keys: global.openbao, controlPlane.config.EAI_OPENBAO_URL

9. Security controls​

  • Secret never returned by the API
  • Lease bound to the run and revoked at its end
  • Every request carries the tenant resolved from the credential; PostgreSQL RLS
  • Every mutation and policy decision writes a hash-chained audit event

10. Observability​

  • Prometheus metrics: eai_leases_issued_total, eai_leases_active
  • Traces: OpenTelemetry spans with GenAI semantic conventions (gen_ai.operation.name, gen_ai.agent.id, gen_ai.tool.name), attributes eai.tenant_id, eai.run_id, traceparent propagation.
  • Audit actions: credential.lease, secret.write

11. FinOps units​

  • Lease count.
  • Emitted as Usage Event (POST /v1/finops/usage) with tenant, project, agent and run.

12. Failure modes and resilience​

  • OpenBao down: refusal (fail closed)
  • Normalized errors (error envelope, message_i18n en/fr)

13. Standalone adoption (client of a client)​

  • enterprise_ai.connectors + OpenBao.
  • SDK: enterprise_ai.tools / mcp / skills / plugins / connectors / channels
  • Minimal deployment: Helm chart with controlPlane.enabled=true and PostgreSQL; disabled external components use their in-process fallback.

14. Acceptance tests​

  1. GET connector contains no secret
  2. TTL above maximum -> 422
  3. Cross-tenant access refused
  4. Error returned in fr with Accept-Language: fr