When your agent needs to reach an external system (such as a monitoring service, a webhook, or a third-party API), or requires a secret like an API key or token, use a source.
A source provides two things to your agent at runtime:
Network egress to the host the source points to. Sources contribute network policies automatically, so you do not need to configure egress separately.
Secrets delivered into the running agent container at /app/var/run/source_credentials.json.
Read source credentials
Foundry writes resolved secrets to /app/var/run/source_credentials.json. The file has the following shape:
Keep the following in mind when reading credentials:
The file contents will be {} if the credentials could not be resolved.
Do not cache the file contents in memory. The file is replaced atomically (as a single, indivisible operation, with no partial or intermediate state visible), so read it when you need the current value.