1. Learning objective
Connect an agent session
Correlate an Agent SDK session with an AIGP execution, identify model/tool evidence, and interpret failures without over-claiming what the record proves.
- Guide 3 lab
- A running authenticated AIGP API for end-to-end observation
2. Technical context
Understand execution IDs
A terminal answer alone cannot show which bounded execution stages were observed. A stable external execution ID makes evidence retrieval possible without treating a provider session ID as an AIGP primary key.
3. Run without AIGP
Run without AIGP
Run the existing Agent SDK lab with AI_GOVERNANCE_* unset. It prints the application-owned Claude session ID and finishes normally.
cd labs/agent-frameworks/anthropic/claude-agent-tool-intg
source .venv/bin/activate
python app.py4. Configure AIGP
Configure execution tracking
Configure the existing public Agent Executions API scope and rerun. The adapter registers the caller-created session as external_execution_id, receives an AIGP execution ID, emits bounded events, and finalizes the run.
Authenticate local AIGP requests
Obtain a short-lived token
If your local OSS stack uses Keycloak, the organization and project headers are scope selectors, not authentication. Generate a token from the generated local OAuth client and pass it only through AI_GOVERNANCE_ACCESS_TOKEN for this terminal session.
# Run from the OSS repository after its local Keycloak stack is ready.
cd /path/to/ai-governance-oss
./servers.sh up
# This ignored file contains the local walkthrough client credentials.
# It does not contain an access token.
set -a
source .env.oauth.generated
set +a
# Mint one short-lived token in memory for this terminal only.
export AI_GOVERNANCE_ACCESS_TOKEN="$(
uv run python -c 'from ai_governance.oauth import access_token_from_environment; print(access_token_from_environment())'
)"
# Return to the Claude lab. Its .env supplies Claude and AIGP scope settings.
cd /path/to/labs/agent-frameworks/anthropic/claude-agent-tool-intg
set -a
source .env
set +a
python app.py
# Remove the in-memory token when the session is over.
unset AI_GOVERNANCE_ACCESS_TOKENNever commit, print, paste into a screenshot, or add the token to .env. For development-mode and production workload identities, see Developer Authentication.
5. Inspect execution evidence
Inspect the execution timeline
Use GET /api/v1/agent-executions/{execution_id}. Verify ordered WORKFLOW_STEP, MODEL_CALL, and TOOL_CALL evidence, plus terminal status. Sequence order does not itself establish causal dependencies; use explicit tool-call context where supplied.
The same verified MCP workflow execution, viewed as ordered evidence: two workflow steps, four model calls, one reported tool call, and terminal completion.
6. Test failure handling
Test evidence delivery
Make evidence delivery unavailable. The lab reports unavailable evidence and does not fabricate a completed execution. Its normal non-protected Claude workflow remains independent.
7. Technical boundaries
Understand evidence boundaries
- The application owns its session and local exception behavior.
- AIGP owns the canonical execution ID and accepted evidence timeline.
- AIGP does not infer raw content or tool execution from a model event alone.
8. Next step
Add a subagent
This is a documented integration boundary, not an implicit AIGP feature. Continue only with the capabilities explicitly marked ready in the learning path.
Back to developer guides