Commit 0575dff
feat: add --token flag to kagent invoke for API key passthrough (#1465)
## Summary
- Add `--token` flag to `kagent invoke` that injects an `Authorization:
Bearer` header into A2A requests
- Enables using the API key passthrough feature (#1327) from the CLI,
where the Bearer token is forwarded directly to LLM providers
- Uses a custom `http.RoundTripper` to inject the header on every
request made by the A2A client
## Test plan
- [x] Tested with valid OpenAI API key as Bearer token — agent responds
normally
- [x] Tested without token — fails with "api_key client option must be
set"
- [x] Tested with invalid token — fails with 401 auth error
- [x] Tested streaming mode with token — works correctly
- [x] Verified mutual exclusion CRD validation (apiKeyPassthrough +
apiKeySecret rejected)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent b108bde commit 0575dff
2 files changed
+29
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
24 | 38 | | |
25 | 39 | | |
26 | 40 | | |
| |||
64 | 78 | | |
65 | 79 | | |
66 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
67 | 93 | | |
68 | 94 | | |
69 | 95 | | |
70 | | - | |
| 96 | + | |
71 | 97 | | |
72 | 98 | | |
73 | 99 | | |
| |||
85 | 111 | | |
86 | 112 | | |
87 | 113 | | |
88 | | - | |
| 114 | + | |
89 | 115 | | |
90 | 116 | | |
91 | 117 | | |
| |||
0 commit comments