Creating
Advanced — Events, OAuth, and Intents
Cross-app communication, OAuth flows, and event emission with the SDK.
Advanced: Events, OAuth, and Intents
Events
Emit events from your tool handlers:
ctx.emit('event_name', payload)Subscribers (including other apps and the Station itself) can listen for these events in real time.
OAuth
Request interactive authentication from your tool handlers:
ctx.requestAuth({ provider: 'google' })This triggers the OAuth flow — the Station opens a browser, completes the flow, and returns an AuthResult containing the accessToken. You can also check auth status with ctx.auth.getStatus() and refresh tokens with ctx.auth.refresh().
Cross-app intents
Call tools on other installed apps:
ctx.intent('messenger', 'send_message', {
channel: '#general',
text: 'Hello from my app!'
})This enables app-to-app communication — your app can leverage tools from any other installed Agent App.
Development guidelines
- Code comments in English
- Conventional commits (
feat:,fix:,perf:,refactor:,chore:) - Never push without explicit user consent
- No Co-Authored-By trailer
- Secrets: always use
agentapps config <appId> KEY:value
Related
- Implement tools — ToolContext API reference
- Managing Agent Apps — production deployment