Skip to content

Commit a168f17

Browse files
Marek DanoMarek Dano
authored andcommitted
fix: json import moved to top-level, doc token inprovement
Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
1 parent eda6724 commit a168f17

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

docs/docs/using/agents/a2a.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,14 @@ Before running the demo agent, ensure the following configuration:
253253
make dev
254254

255255
# Terminal 2: Start the demo agent (auto-registers with ContextForge)
256-
# Option 1: Let the script generate the token
256+
# Option 1: Let the script generate the token internally
257257
PLATFORM_ADMIN_EMAIL=admin@example.com uv run python scripts/demo_a2a_agent.py
258258

259-
# Option 2: Generate token manually (recommended for scripted access)
259+
# Option 2: Generate token manually for testing API calls (script still generates its own token)
260260
export TOKEN=$(python -m mcpgateway.utils.create_jwt_token \
261261
--username "admin@example.com" --exp 60)
262262
uv run python scripts/demo_a2a_agent.py
263+
# The $TOKEN variable is now available for the curl test commands below
263264
```
264265

265266
Note: The token generation uses your configured `JWT_SECRET_KEY` from `.env` (defaults to `my-test-key` for local development).

scripts/demo_a2a_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717

1818
import atexit
19+
import json
1920
import os
2021
import random
2122
import signal
@@ -167,7 +168,6 @@ async def run_agent(request: Request) -> Response:
167168
body = await request.body()
168169
print(f"Raw request body: {body.decode('utf-8')}")
169170

170-
import json
171171
body_dict = json.loads(body)
172172

173173
query_text = ""

scripts/demo_a2a_agent_auth.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,19 @@ def run(self, query: str) -> str:
334334
class Parameters(BaseModel):
335335
"""Parameters object containing the actual query."""
336336

337-
query: str = ""
338-
message: str = ""
337+
query: Optional[str] = None
338+
message: Optional[str] = None
339339

340340

341341
class A2ARequest(BaseModel):
342342
"""Request model for A2A protocol format (ContextForge custom agent format)."""
343343

344-
interaction_type: str = ""
344+
interaction_type: Optional[str] = None
345345
parameters: Optional[Parameters] = None
346-
protocol_version: str = ""
346+
protocol_version: Optional[str] = None
347347
# Also support direct query/message for simple testing
348-
query: str = ""
349-
message: str = ""
348+
query: Optional[str] = None
349+
message: Optional[str] = None
350350

351351

352352
class MessagePart(BaseModel):

0 commit comments

Comments
 (0)