Skip to content

Commit 21cdf01

Browse files
committed
add more .env examples
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
1 parent 8b8c8f3 commit 21cdf01

4 files changed

Lines changed: 48 additions & 4 deletions

File tree

a2a/git_issue_agent/.env.kagenti

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MCP_URL = "http://github-tool:8000/mcp"
2+
LOG_LEVEL = "DEBUG"
3+
JWKS_URI = "http://keycloak.keycloak.svc.cluster.local:8080/realms/master/protocol/openid-connect/certs"

a2a/git_issue_agent/.env.openai

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TASK_MODEL_ID = "gpt-4.1-nano"

a2a/git_issue_agent/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Github Issue Agent
2+
3+
## Introduction
4+
5+
The Github Issue Agent is designed to perform tasks dealing with Github issues, leveraging large language models (LLMs) to generate plans, execute steps, and summarize findings. This agent integrates with [the upstream Github MCP Server](https://github.com/github/github-mcp-server) as a tool via MCP and utilizes AI models for data extraction, summarization, and more. This agent also integrates with [this MCP Man-in-the-Middle](https://github.com/kagenti/agent-examples/tree/main/mcp/github_tool) that will verify OAuth tokens and can be configured with Github PATs to communicate with the upstream Github MPC Server.
6+
7+
## Architecture
8+
9+
<TODO>
10+
11+
### Configuration Variables
12+
13+
| Variable Name | Description | Required? | Default Value |
14+
|---------------|-------------|-----------|---------------|
15+
| LLM_API_BASE | The URL for OpenAI compatible API | Yes | `http://localhost:11434/v1` |
16+
| LLM_API_KEY | The API key for OpenAI compatible API | No | `my_api_key` |
17+
| TASK_MODEL_ID | The ID of the LLM | Yes | `granite3.3:8b` |
18+
| EXTRA_HEADERS | Extra headers for the OpenAI API, e.g. {"MY_HEADER": "my_value"} | No | `{}` |
19+
| MODEL_TEMPERATURE | The temperature for the model | Yes | `0` |
20+
| MCP_URL | Endpoint where the Slack MCP server can be found | No | "" |
21+
| SERVICE_PORT | Port on which the service will run | Yes | `8000` |
22+
| LOG_LEVEL | Application log level | No | DEBUG |
23+
| GITHUB_TOKEN | If set, will send requests to Github MCP Server with `Authorization: Bearer <GITHUB_TOKEN>` header. | No | - |
24+
| JWKS_URI | Endpoint to obtain JWKS for token validation. Enables token validation. | No | - |
25+
| ISSUER | Expected `iss` value of incoming bearer tokens | No | - |
26+
| TOKEN_URL | Endpoint to perform token exchange. Required for token exchange. | No | - |
27+
| CLIENT_ID | Client ID to authenticate to auth server with. Required for token exchange. Expected `aud` value of incoming bearer tokens | No | - |
28+
| CLIENT_SECRET | Client secret to authenticate to auth server with. Required for token exchange. | No | - |
29+
| TARGET_SCOPES | Requested scopes of token exchanged token | No | - |
30+
| TARGET_AUDIENCE | Requested audience of token exchanged token | No | - |
31+
32+
> **Note on Authorization configuration**
33+
> By default, no token validation is performed. To enable token validation, set `JWKS_URI`.
34+
> If `ISSUER` is additionally set, the `iss` claim will be checked to equal this value.
35+
> If all of `TOKEN_URL`, `CLIENT_ID`, and `CLIENT_SECRET` are set in addition, token exchange will be performed using Bearer tokens from incoming requests, to send to the MCP endpoint.
36+
> In addition to `TOKEN_URL`, `CLIENT_ID`, `CLIENT_SECRET`, which trigger token exchange, `TARGET_SCOPES` can be optionally configured to be the `scope` in the token exchange request.

a2a/git_issue_agent/a2a_agent.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ async def execute(self, context: RequestContext, event_queue: EventQueue):
138138
Returns:
139139
None
140140
"""
141-
if settings.JWKS_URI:
141+
if settings.GITHUB_TOKEN:
142+
user_token = settings.GITHUB_TOKEN
143+
elif settings.JWKS_URI:
142144
user_token = context.call_context.user._user.access_token
143145
else:
144-
user_token = settings.GITHUB_TOKEN
146+
raise Exception("either JWKS_URI or GITHUB_TOKEN env var must be set")
145147
user_input = [context.get_user_input()]
146148
task = context.current_task
147149
if not task:
@@ -222,8 +224,10 @@ def run():
222224
)
223225

224226
app = server.build() # this returns a Starlette app
225-
if not settings.JWKS_URI is None:
227+
if settings.JWKS_URI:
226228
logging.info("JWKS_URI is set - using JWT Validation middleware")
227-
app.add_middleware(AuthenticationMiddleware, backend=BearerAuthBackend(), on_error=on_auth_error)
229+
app.add_middleware(AuthenticationMiddleware, backend=BearerAuthBackend(), on_error=on_auth_error)
230+
elif settings.GITHUB_TOKEN is None:
231+
logging.error("One of JWKS_URI or GITHUB_TOKEN must be set.")
228232

229233
uvicorn.run(app, host="0.0.0.0", port=settings.SERVICE_PORT)

0 commit comments

Comments
 (0)