Guides
Connected accounts
Your end user connects their own account at a third party — a tracker, a CRM, a calendar — once, and your agents use it as them. When a tool needs an account the user has not connected, the run pauses with a sign-in link and carries on by itself once they sign in. You write no OAuth code: the platform runs the sign-in with your OAuth client and keeps the tokens, sealed.
1. Register an OAuth client with the provider
- In the provider's developer settings, create an OAuth app for your product. Its consent screen shows your app's name.
- Its redirect URI is the platform's callback. Providers call it the redirect URI, the callback URL or the authorization callback URL; for this platform it is:
https://api.np.openelan.ai/v1/connect/callback
- Exactly as written: the same scheme, host and path, with no trailing slash. Providers compare it character for character, and a mismatch is refused at the provider's sign-in page, before the platform is ever reached.
- One per platform. Each platform you deploy to has its own API host and so its own callback. Most providers let one app list several; a GitHub OAuth App takes exactly one, so it needs an app per platform.
- Keep the client secret in a project secret. The platform never reads its value; it reaches only the pods of agents that use the connection.
elan secret set secrets tracker-client-secret # reads stdin2. Declare the connection
Once, for the project. Every agent in it that names the connection shares it, and your user connects once per project.
connections:
tracker:
displayName: Tracker
issuer: https://login.tracker.example # endpoints are discovered here
resource: https://mcp.tracker.example/mcp # tokens are issued for, and sent to, this
scopes: [issues:read]
client:
id: abc123
secret: tracker-client-secret # omit for a public client
targets:
triage:
egress:
- host: login.tracker.example # the pod exchanges and refreshes here
- host: mcp.tracker.example- A provider with no metadata states
authorizationEndpointandtokenEndpointinstead ofissuer. - The deploy refuses a connection an agent names and elan.yaml does not declare, an issuer or token host missing from the agent's
egress:, a URL that is not https, and a binding outside the connection'sresource.
3. Name it in your agent
Exactly as you would a caller's credential: declared in credentials=, then named on a binding or in a tool.
from agentkit_core.manifest import AgentManifest, Credentials, ToolAuth, ToolBinding
from agentkit_runtime.security import auth_config
from google.adk.tools.authenticated_function_tool import AuthenticatedFunctionTool
MANIFEST = AgentManifest(
slug="triage",
version="0.1.0",
credentials=Credentials(connections=["tracker"]),
tools=[
# An MCP server: connected before its tools are listed.
ToolBinding(kind="mcp", ref="tracker", url="https://mcp.tracker.example/mcp",
tool_filter=["open_issues"], auth=ToolAuth(credential="tracker")),
],
...
)
async def my_issues(credential) -> dict:
"""A Python tool: handed the user's access token."""
return await tracker.issues(token=credential.oauth2.access_token)
def build(ctx):
return LlmAgent(..., tools=[
*ctx.tools(),
AuthenticatedFunctionTool(func=my_issues, auth_config=auth_config("tracker")),
])4. When the user has not connected
The run pauses with interrupt_kind: connection, and the event carries payload.connection: the account's name and the link. Open the link for the user, with their ticket on it:
import { CONNECTION_INTERRUPT_KIND, connectUrl } from "elan-sdk";
// `event` came from the stream this page opened with `ticket` — the
// end user's own, which is also what starts their sign-in.
if (event.kind === "paused"
&& event.payload.interrupt_kind === CONNECTION_INTERRUPT_KIND) {
// A small window rather than a tab; the platform closes it once they are in.
window.open(connectUrl(event.payload.connection, ticket), "connect",
"popup,width=520,height=720");
}- The link alone is refused. It starts a sign-in only with the ticket of the user it was made for, so a link that leaks connects nobody's account to anybody else's run.
- It is good for one sign-in, within ten minutes. Reopening it before then is fine; once the provider has sent the user back, or the ten minutes are up, the next run that needs the account makes a new one.
- The run resumes by itself once the provider sends the user back. Your app sees it carry on in the event stream.
- A user who declines ends the run with an error naming the connection.
- In the Playground, the paused run shows a Connect button that does all of this for you.
After that
- Later runs never ask. Each one is handed the user's current access token.
- Refreshed before it expires, by the agent's pod, with your client secret. If the provider refuses the refresh — the user revoked your app — the next run asks them to connect again.
- Sent only to the connection's resource, and only by the bindings and tools that name it.
Example: GitHub's MCP server
GitHub runs its own MCP server and publishes its sign-in metadata, so a real third party takes the same three steps. This agent summarizes the user's own recent pull requests, issues and commits.
- Register an OAuth App under GitHub → Settings → Developer settings → OAuth Apps, with
https://api.np.openelan.ai/v1/connect/callbackas its Authorization callback URL, then generate a client secret and keep it withelan secret set secrets github-client-secret.
connections:
github:
displayName: GitHub
issuer: https://github.com/login/oauth # GitHub publishes its metadata here
resource: https://api.githubcopilot.com/mcp
scopes: [read:user, repo]
client:
id: Ov23li... # the OAuth App's client ID
secret: github-client-secret
targets:
github-activity:
egress:
- host: github.com # the exchange
- host: api.githubcopilot.com # the toolsMANIFEST = AgentManifest(
slug="github-activity",
...
credentials=Credentials(connections=["github"]),
tools=[ToolBinding(
kind="mcp", ref="github",
url="https://api.githubcopilot.com/mcp/readonly", # no tool that writes
tool_filter=["get_me", "search_pull_requests", "search_issues",
"search_commits", "pull_request_read", "issue_read"],
auth=ToolAuth(credential="github"),
)],
)/readonlyon GitHub's URL exposes only tools that read, andtool_filternarrows those to what the agent needs. It sits inside the connection'sresource, which is what lets the token be sent to it.- Nothing is refreshed. An OAuth App's tokens do not expire. A user who revokes your app at GitHub → Settings → Applications leaves a token GitHub refuses, and the platform cannot tell until a refresh, which never comes: disconnect it (below) and the next run asks them to connect again.
- An organization's private repositories appear only once the organization allows your OAuth App.
Listing and disconnecting
A user's own, or — as a tenant admin — any of your end users'. Never a token:
from elan_sdk import Elan
elan = Elan.from_env()
for connection in elan.connections.list(end_user_id="ada", project="salmon"):
print(connection.name, connection.status)
elan.connections.disconnect("tracker", end_user_id="ada", project="salmon")Disconnecting deletes the tokens here, and the next run that needs the account asks again. Revoking your app's grant at the provider is the user's, from the provider's own settings.
- In the Playground, the Connected accounts button beside the agent's name lists yours and disconnects one — no admin needed.
- In the console, a tenant admin sees every user's connected accounts under the project's Connected accounts, with their status, and can disconnect any one of them.
- Destroying the project deletes every connection in it. Destroying one agent leaves them, because another agent in the project may use the same connection.
Where the tokens live
| What | Where |
|---|---|
| Access and refresh token | The platform, sealed at rest and bound to their user and connection. A database dump reveals nothing |
| Your client secret | Your project's secrets, delivered only to the pods of agents that use the connection |
| The sign-in in progress | Ten minutes, sealed, holding the PKCE verifier and then the code until the pod exchanges it |
| Events, the stored conversation, logs, the model | None of them, ever. The pause carries only the link |
- Shared within a grouped pod. Agents grouped into one pod share a process, so a connection one of them names is reachable by the others. An agent that must not should be deployed on its own.
- To act as a user whose tokens your own backend already holds, pass them in the security context instead. Every way a credential can reach an MCP call is in MCP authentication by example.