keys secrets store shared runtime credentials for project services.
Use them for credentials such as:
- a shared
SERVICE_API_TOKENfor a project-owned agent or integration DATABASE_URLSTRIPE_SECRET_KEY- other shared API keys used by backend services
keys secret with container.secrets, MeshAgent injects each key/value pair into the running container as environment variables at runtime.
Project keys secrets are for application credentials that the service needs while it is running. If the credential belongs to a specific room or identity, use room secrets. If the credential is only for authenticating a private image pull, use image pull secrets.
Note: OpenAI and Anthropic credentials are often handled through MeshAgent Studio Integrations and the LLM proxy, not as generic project keys secrets. In MeshAgent Studio, users can switch the project to their own provider credentials or use MeshAgent-managed routing by default.
Before you start
These examples assume:- the MeshAgent CLI is installed
- you have already authenticated with
meshagent setup - you have an active project selected
Create a project keys secret
bash
bash
Reference it from a project service
Create a file namedproject-secret-demo.yaml:
secret-1234567890 with the secret ID returned by meshagent secret key create.
When the service starts, MeshAgent loads the referenced keys secret and injects each entry as an environment variable.
Deploy the service
bash
SERVICE_API_TOKEN exists and then starts meshagent process join --model=gpt-5.4 ... inside the MeshAgent CLI image. MeshAgent injects the actual stored secret value into the container environment at runtime, so the agent process really does receive the secret. It does not print the value, because logging secrets would be unsafe. This example is only showing how the secret reaches the agent. If you were building a real GitHub, Supabase, or Stripe integration, your bootstrap logic, toolkit setup, or custom tool layer would still need to read SERVICE_API_TOKEN and use it explicitly.
Update or delete a project secret
Update an existing secret:bash
bash
Best practices
- Use project
keyssecrets only for shared runtime credentials used by project services. - Attach a secret only to the services that actually need it.
- Avoid logging secret values from inside the container.
- Rotate credentials by updating the secret and redeploying the service.