AgentBase Monitor
Monitor, debug, and view status of agents running on GreenNode AgentBase Runtime.
Authentication
Read the shared auth setup reference at /agentbase skill's references/auth-setup.md for full IAM credential configuration. In brief: run bash .claude/skills/agentbase/scripts/check_credentials.sh iam to verify credentials are configured. NEVER read .greennode.json or .env directly — always use the helper scripts. If check_credentials.sh iam returns MISSING, STOP — you MUST read the "If Credentials Are Not Found" section in /agentbase skill's references/auth-setup.md and follow it exactly. Do NOT skip this or provide your own credential setup instructions.
Interaction Guidelines
- Never assume API response structure — always inspect the actual response first before extracting or filtering data. Do not guess field names.
- Guide first, act only when asked — if the user asks "how to" view logs, metrics, or dashboard, respond with instructions and guidance only. Do NOT execute API calls unless they explicitly ask you to do it for them.
- Read-only operations proceed directly — for log and metric queries (runtime-logs, endpoint-logs, metrics) and dashboard views, proceed directly once you have the required IDs. If a runtime ID or endpoint ID is needed and not provided, list runtimes first and ask the user to pick one. Only skip the listing if the user has already provided a specific ID.
- Never auto-decide parameters — when an action requires parameters (e.g., runtime ID, endpoint ID, log offset, limit), always ask the user for each required value. You may recommend sensible defaults (e.g., limit=100), but never auto-select or impose values without the user's explicit agreement.
- Present options, let user choose — when there are multiple runtimes or endpoints to choose from, list them and let the user pick. Do not make the choice for them.
- Always read full API response body — when calling platform APIs, capture and read the full JSON response (not just status codes). This avoids misidentifying field names or data structures, ensures correct field extraction, and enables better error handling and debugging.
- Handle errors gracefully — if any individual API call fails, show available data and mark failed sections with the error. Do not retry automatically — offer the user to retry individual failed sections.
Part 1: Observability (Logs & Metrics)
Operations
runtime-logs [id] -- View runtime logs
Fetch logs from an agent runtime container.
Parameters:
--from N (int, max 5000) -- starting offset (0-based)
--limit N (int, max 500) -- number of log lines to return
--from-time ISO (string, optional) -- start of time range filter (ISO 8601)
--to-time ISO (string, optional) -- end of time range filter (ISO 8601)
--query TEXT (string, optional) -- keyword search filter
--order asc|desc (string, optional) -- log ordering
Response (LogSearchResult): totalCount (int), logs (array of LogRecord with timestamp (string) and content (string)).
Command:
# Basic log fetch (most recent 100 entries)
bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 100
# With time range and keyword search
bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID \
--from 0 --limit 100 \
--from-time "2026-03-13T00:00:00Z" \
--to-time "2026-03-13T12:00:00Z" \
--query "error"
Tips:
- Use
--from to paginate through large log sets (e.g. --from 100 to skip first 100 entries)
- Max
--limit is 500, max --from is 5000
- Use
--query to filter logs by keyword server-side (e.g. --query "error")
- Use
--from-time/--to-time to narrow logs to a specific time window
- Each log entry has
timestamp and content fields
endpoint-logs [id] [endpointId] -- View endpoint logs
Fetch logs from a specific endpoint within a runtime.
Parameters: Same as runtime-logs (--from, --limit, --from-time, --to-time, --query).
Command:
bash .claude/skills/agentbase/scripts/runtime.sh endpoints logs $RUNTIME_ID $ENDPOINT_ID \
--from 0 --limit 100
metrics [id] [endpointId] -- View endpoint resource metrics
Get CPU and RAM usage metrics for a specific endpoint. Supports historical time range queries.
Query parameters:
--from-time ISO (string, optional) -- start of time range (ISO 8601)
--to-time ISO (string, optional) -- end of time range (ISO 8601)
Command:
# Current metrics
bash .claude/skills/agentbase/scripts/runtime.sh endpoints metrics $RUNTIME_ID $ENDPOINT_ID
# Historical metrics with time range
bash .claude/skills/agentbase/scripts/runtime.sh endpoints metrics $RUNTIME_ID $ENDPOINT_ID \
--from-time "2026-03-13T00:00:00Z" --to-time "2026-03-13T12:00:00Z"
Response (AgentRuntimeEndpointMetrics):
cpuCoresUsage -- array of {timestamp (date-time), value (double)} data points
memoryBytesUsage -- array of {timestamp (date-time), value (int64)} data points
events [id] [endpointId] -- View infrastructure events for an endpoint
Fetch the infrastructure-level events emitted while deploying and running an endpoint. This is the first place to look when an endpoint is not ACTIVE but the logs are empty — startup failures (image pull errors, out-of-memory kills, scheduling/capacity failures, health-probe failures) surface here as events before any application log is produced.
Command:
bash .claude/skills/agentbase/scripts/runtime.sh endpoints events $RUNTIME_ID $ENDPOINT_ID
Response: array of event objects, each with:
message (string) -- the event message (e.g. Back-off pulling image ..., out of memory, insufficient capacity)
lastTimestamp (date-time) -- when the event last occurred
Common event signatures (match against the message text):
| Event message indicates |
Meaning |
Next step |
Image pull failure (e.g. pulling image / ErrImagePull) |
Image cannot be pulled |
Verify imageUrl and registry credentials (imageAuth) on the runtime version |
Out of memory (e.g. OOM / out of memory) |
Instance exceeded its memory limit |
Scale up the flavor or fix the memory leak (cross-check metrics) |
Scheduling / capacity failure (e.g. insufficient / no capacity) |
No capacity to place the instance |
Usually a flavor/capacity issue — try a smaller flavor or retry later |
Health probe failure (e.g. probe failed) |
/health not returning 200 |
Verify the health endpoint (see Log Analysis Guide) |
| Crash / restart loop |
Instance keeps crashing on startup |
Check endpoint logs for the startup traceback |
traces -- Distributed tracing (passthrough)
Query distributed traces for agent runtimes. These commands are a thin passthrough to the platform's tracing backend: the accepted query parameters (other than traceId / tagKey) and the response body shape are defined by that backend, not by the runtime API spec. Pass backend query params verbatim via repeated --param key=value; the response is the backend's raw JSON string.
Param semantics not documented here. Do NOT invent trace query param names. If the user needs specific filters (time range, service, tags, min duration, etc.), source the exact param keys from the tracing backend's own documentation or the console's network calls before using them. Without that, the commands still work as a raw passthrough.
Commands:
# Search traces (params forwarded to the tracing backend)
bash .claude/skills/agentbase/scripts/runtime.sh traces search --param key=value [--param key=value ...]
# Get a single trace by ID
bash .claude/skills/agentbase/scripts/runtime.sh traces get $TRACE_ID [--param key=value ...]
# List available values for a trace tag key (for building filters)
bash .claude/skills/agentbase/scripts/runtime.sh traces tag-values $TAG_KEY [--param key=value ...]
--param values are URL-encoded automatically. The response is returned as-is (a JSON string from the backend) — parse it according to the backend's schema.
Current Limitations
| Feature |
Status |
| Log filtering by level (INFO/WARN/ERROR) |
Not supported — all log levels are returned together |
| Log time range filter |
Supported — use --from-time/--to-time |
| Log keyword search |
Supported — use --query |
| Historical metrics |
Supported — use --from-time/--to-time |
| Log streaming/tailing |
Not supported — use polling as a workaround (see below) |
| Alerting/thresholds |
Not supported |
Pseudo-tailing pattern: To approximate log tailing, poll the logs command every 5-10 seconds with an increasing --from offset. Inform the user of the polling limit at the start (e.g., "Tailing logs for up to 5 minutes..."). After reaching the limit, inform the user and offer to restart tailing. Be mindful of rate limits:
OFFSET=0
LIMIT=100
MAX_POLLS=60
for i in $(seq 1 $MAX_POLLS); do
RESULT=$(bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from $OFFSET --limit $LIMIT)
BATCH_SIZE=$(echo "$RESULT" | jq '.logs | length')
if [ "$BATCH_SIZE" -gt 0 ] 2>/dev/null; then
echo "$RESULT" | jq -r '.logs[].content'
OFFSET=$((OFFSET + BATCH_SIZE))
fi
sleep 5
done
Log Analysis Guide
Common Error Signatures
When reviewing logs, look for these patterns:
| Pattern |
Meaning |
Next Step |
Traceback (most recent call last) |
Python exception — read the last line for the actual error |
Check the exception type and message at the bottom of the traceback |
ModuleNotFoundError: No module named '...' |
Missing dependency |
Add the module to requirements.txt and rebuild |
ImportError: cannot import name '...' |
Wrong package version or API change |
Check package version compatibility |
ConnectionRefusedError / ConnectionError |
Cannot reach external service |
Verify the service URL, check if auth credentials are injected correctly |
401 Unauthorized / 403 Forbidden |
Authentication/authorization failure |
Check IAM token, service account permissions, or external API key |
OSError: [Errno 98] Address already in use |
Port conflict (usually 8080) |
Ensure only one process binds to port 8080 |
MemoryError / Killed |
Out of memory |
Scale up flavor or optimize memory usage |
TimeoutError / ReadTimeout |
External API or LLM call timed out |
Increase timeout, check LLM endpoint health |
KeyError: '...' |
Missing expected field in payload/response |
Check payload format matches what handler expects |
Health check failed |
/health endpoint not returning 200 |
Verify @app.ping is defined and returns PingStatus.HEALTHY |
Debugging Decision Tree
Use this flow to diagnose common issues:
Agent not responding?
├─ Check runtime status (/agentbase-deploy runtime get)
│ ├─ Status = FAILED → Check runtime logs (see runtime-logs above)
│ ├─ Status = CREATING → Wait, then re-check
│ └─ Status = ACTIVE → Check endpoint logs (see endpoint-logs above)
│ ├─ Logs show Python traceback → Fix the code error
│ ├─ Logs show "Health check failed" → Fix health endpoint
│ ├─ No recent logs → Check endpoint events (see events above) for infrastructure-level
│ │ failures (image pull, out-of-memory, capacity), then metrics
│ └─ Logs look normal → Issue may be in request routing, check endpoint URL
Agent returns errors (4xx/5xx)?
├─ 500 Internal Server Error → Check endpoint logs for traceback (see endpoint-logs above)
├─ 502 Bad Gateway → Container crashed or not ready, check runtime logs (see runtime-logs above)
├─ 503 Service Unavailable → Container starting up or overloaded, check metrics (see metrics above)
└─ 401/403 → Check if agent's outbound auth is configured (/agentbase-identity)
Agent is slow?
├─ Check metrics for CPU/RAM (see metrics above)
│ ├─ CPU near limit → CPU-bound (e.g., stuck loop, heavy computation)
│ │ └─ Scale up flavor or optimize code
│ ├─ RAM near limit → Memory-bound (e.g., large model in memory, data leak)
│ │ └─ Scale up flavor or fix memory leak
│ └─ Both low → Bottleneck is external (LLM API, database, network)
│ └─ Check logs for slow external calls, add request timing
Correlating Logs with Metrics
- High CPU + normal RAM → CPU-bound workload (tight loops, heavy computation, synchronous LLM calls)
- High RAM + normal CPU → Memory leak or large data structures (loading entire datasets, caching without limits)
- Both high → Resource exhaustion — scale up the flavor or optimize both code paths
- Both low + slow responses → External dependency bottleneck (LLM API latency, database queries, network timeouts)
Log Filtering
Use server-side filtering when possible, and client-side techniques for finer control:
# Server-side: keyword search via --query
bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 100 --query "error"
# Server-side: time range filter
bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID \
--from 0 --limit 100 \
--from-time "2026-03-13T00:00:00Z" --to-time "2026-03-13T12:00:00Z"
# Client-side: filter fetched results locally
LOGS=$(bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 100)
echo "$LOGS" | jq -r '.logs[].content' | grep -i "error\|traceback\|exception\|failed"
# Client-side: show only the last N lines
echo "$LOGS" | jq -r '.logs[].content' | tail -n 20
# Client-side: count errors
echo "$LOGS" | jq -r '.logs[].content' | grep -ci "error"
Troubleshooting Guide
| Error |
Cause |
Fix |
| Agent not responding |
Runtime crashed or not started |
Check runtime status (/agentbase-deploy runtime get), then check runtime logs for crash messages |
| 502/503 errors on endpoint |
Container startup failure |
Check endpoint logs for startup failures, verify health endpoint returns 200 |
| High latency |
Resource saturation |
Check metrics for CPU/RAM saturation, consider scaling up flavor or replicas |
| OOM kills |
Memory spikes exceeding limit |
Check metrics for memory spikes, increase flavor size |
| Image pull errors |
Wrong URL or missing credentials |
Verify imageUrl and registry credentials in runtime config |
| Container crash loop |
Code error or missing dependencies |
Check runtime logs for Python tracebacks or missing dependencies |
Part 2: Status Dashboard
Show a unified dashboard of all AgentBase resources across services.
How It Works
- Discover all resources using
bash .claude/skills/agentbase/scripts/discovery.sh
- Format into a dashboard (see output format below)
- If any API call fails, show that section as
Could not fetch (error details) instead of crashing
Output Format
Format the results into a readable dashboard. Example:
AgentBase Status Dashboard
==========================
IAM: Configured (client_id: abc...xyz)
Agent Identities (2):
my-agent - "My first agent"
test-bot - "Testing bot"
Auth Providers:
API Keys (1): openai-prod (ACTIVE)
Delegated (0): none
OAuth2 (0): none
Runtimes (1):
my-agent-rt (ACTIVE, v3, 1x1-general)
DEFAULT: https://...
Memory (1):
my-memory (2 strategies, 30d expiry)
AI Platform:
API Keys (1): my-key (ACTIVE)
Container Registry:
Repos (1): my-repo (private)
Section Details
- IAM: Show masked client_id (first 3 + last 3 chars)
- Agent Identities: Name and description for each
- Auth Providers: Group by type (API Key, Delegated, OAuth2). Show name and status for each. Show "none" if empty.
- Runtimes: Name, status, description, wallet (
poc). For each runtime, list its endpoints with name, version, URL, and status. Fetch endpoints via bash .claude/skills/agentbase/scripts/runtime.sh endpoints list $RUNTIME_ID. (Note: runtime list DTO contains id, name, description, status, statusReason, createdAt, updatedAt, poc — poc=true bills the POC wallet (free credits), poc=false the real wallet. For flavor/version details, use bash .claude/skills/agentbase/scripts/runtime.sh versions $RUNTIME_ID which returns version, imageUrl, flavorId, autoscaling per version.)
- Memory: Name, number of strategies, event expiry duration
- AI Platform: API key names and status
- Container Registry: Repo names and access level (public/private)
Error Handling
If any individual API call fails, display that section with the error instead of failing the whole dashboard:
Runtimes:
Could not fetch (401 Unauthorized - token may be expired)
--json Flag
If the user passes --json, output the raw JSON responses from all APIs as a single JSON object instead of the formatted dashboard:
{
"agentIdentities": { ... },
"apiKeyProviders": { ... },
"delegatedApiKeyProviders": { ... },
"oauth2Providers": { ... },
"runtimes": { ... },
"memories": { ... },
"aipApiKeys": { ... },
"crRepository": { ... }
}
Dashboard Pagination
Different services use different pagination:
- Identity Service (agent identities, auth providers): 0-indexed (page=0 is first page)
- Runtime Service, Memory Service, AI Platform: 1-indexed (page=1 is first page)
For the status dashboard, fetch the first page of each service with a reasonable size (e.g., size=10). If a service has more items than displayed, show the total count and offer to show more (e.g., "Showing 10 of 25 runtimes. Want to see more?").
Instructions
- Parse the user's argument to determine the operation (
runtime-logs, endpoint-logs, metrics, events, traces, dashboard).
- For logs/metrics/events operations:
a. If a runtime ID is needed and not provided, list runtimes first (
bash .claude/skills/agentbase/scripts/runtime.sh list) and ask the user to pick one.
b. If an endpoint ID is needed, list endpoints for the runtime (bash .claude/skills/agentbase/scripts/runtime.sh endpoints list $RUNTIME_ID) and ask the user to pick one.
c. For logs, default to --from 0 --limit 100 to fetch the most recent entries. Use --from to paginate if more logs are needed (max --from: 5000, max --limit: 500). Use --query for keyword filtering and --from-time/--to-time for time range filtering when the user specifies these.
d. Present log output in a readable format, highlighting errors and warnings. Each log entry has timestamp and content fields.
e. For metrics, display CPU (cpuCoresUsage) and RAM (memoryBytesUsage, convert values to MB/GB) as time-series data points. Use --from-time/--to-time for historical ranges. To show usage as percentages, fetch available flavors via bash .claude/skills/agentbase/scripts/runtime.sh flavors (returns id, name, cpu, ram for each flavor), then match the runtime's flavorId to get CPU/RAM limits.
f. For events, present each event as lastTimestamp — message, newest first. Match messages against the "Common event signatures" table to suggest a next step. Use this especially when an endpoint is stuck out of ACTIVE and logs are empty.
- For traces operation: these are a passthrough to the tracing backend. Do NOT invent query param names — only pass
--param keys the user supplies or that you sourced from the backend's docs/console. Return the backend's JSON response and parse per its schema.
- For dashboard operation:
a. Parse the user's argument for
--json flag.
b. Run bash .claude/skills/agentbase/scripts/discovery.sh (or bash .claude/skills/agentbase/scripts/discovery.sh json for raw JSON).
c. Format the results as a dashboard (or raw JSON if --json).
d. Display the dashboard to the user.
e. After displaying, offer to drill into any section or show more items if pagination was truncated.
1---2name: agentbase-monitor3description: Monitor, debug, view logs, metrics, and status dashboard for DEPLOYED AI agents. View runtime logs, endpoint logs, and resource metrics (CPU/RAM). Show unified dashboard of all platform resources. Trigger for show logs, check logs, what is wrong with my agent, agent crashed, debug my deployed agent, tail logs, agent is slow, agent status, show dashboard, platform overview, what do I have, list all resources, show my agents, inventory, performance, check metrics, resource usage, or any debugging/monitoring of a deployed agent. DO NOT use for managing runtime lifecycle (create/update/delete) — use /agentbase-deploy runtime. DO NOT use for local testing — use /agentbase-wizard test.4---56# AgentBase Monitor78Monitor, debug, and view status of agents running on GreenNode AgentBase Runtime.910- **Console**: https://aiplatform.console.vngcloud.vn/agent-runtime?tab=runtime1112## Authentication1314Read the shared auth setup reference at `/agentbase` skill's `references/auth-setup.md` for full IAM credential configuration. In brief: run `bash .claude/skills/agentbase/scripts/check_credentials.sh iam` to verify credentials are configured. **NEVER read `.greennode.json` or `.env` directly** — always use the helper scripts. If `check_credentials.sh iam` returns MISSING, **STOP — you MUST read** the **"If Credentials Are Not Found"** section in `/agentbase` skill's `references/auth-setup.md` and follow it exactly. Do NOT skip this or provide your own credential setup instructions.1516---1718## Interaction Guidelines1920- **Never assume API response structure** — always inspect the actual response first before extracting or filtering data. Do not guess field names.21- **Guide first, act only when asked** — if the user asks "how to" view logs, metrics, or dashboard, respond with instructions and guidance only. Do NOT execute API calls unless they explicitly ask you to do it for them.22- **Read-only operations proceed directly** — for log and metric queries (runtime-logs, endpoint-logs, metrics) and dashboard views, proceed directly once you have the required IDs. If a runtime ID or endpoint ID is needed and not provided, list runtimes first and ask the user to pick one. Only skip the listing if the user has already provided a specific ID.23- **Never auto-decide parameters** — when an action requires parameters (e.g., runtime ID, endpoint ID, log offset, limit), always ask the user for each required value. You may recommend sensible defaults (e.g., limit=100), but never auto-select or impose values without the user's explicit agreement.24- **Present options, let user choose** — when there are multiple runtimes or endpoints to choose from, list them and let the user pick. Do not make the choice for them.25- **Always read full API response body** — when calling platform APIs, capture and read the full JSON response (not just status codes). This avoids misidentifying field names or data structures, ensures correct field extraction, and enables better error handling and debugging.26- **Handle errors gracefully** — if any individual API call fails, show available data and mark failed sections with the error. Do not retry automatically — offer the user to retry individual failed sections.2728---2930# Part 1: Observability (Logs & Metrics)3132## Operations3334### runtime-logs [id] -- View runtime logs3536Fetch logs from an agent runtime container.3738**Parameters**:39- `--from N` (int, max 5000) -- starting offset (0-based)40- `--limit N` (int, max 500) -- number of log lines to return41- `--from-time ISO` (string, optional) -- start of time range filter (ISO 8601)42- `--to-time ISO` (string, optional) -- end of time range filter (ISO 8601)43- `--query TEXT` (string, optional) -- keyword search filter44- `--order asc|desc` (string, optional) -- log ordering4546**Response** (`LogSearchResult`): `totalCount` (int), `logs` (array of `LogRecord` with `timestamp` (string) and `content` (string)).4748**Command**:49```bash50# Basic log fetch (most recent 100 entries)51bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 1005253# With time range and keyword search54bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID \55 --from 0 --limit 100 \56 --from-time "2026-03-13T00:00:00Z" \57 --to-time "2026-03-13T12:00:00Z" \58 --query "error"59```6061**Tips**:62- Use `--from` to paginate through large log sets (e.g. `--from 100` to skip first 100 entries)63- Max `--limit` is 500, max `--from` is 500064- Use `--query` to filter logs by keyword server-side (e.g. `--query "error"`)65- Use `--from-time`/`--to-time` to narrow logs to a specific time window66- Each log entry has `timestamp` and `content` fields6768---6970### endpoint-logs [id] [endpointId] -- View endpoint logs7172Fetch logs from a specific endpoint within a runtime.7374**Parameters**: Same as runtime-logs (`--from`, `--limit`, `--from-time`, `--to-time`, `--query`).7576**Command**:77```bash78bash .claude/skills/agentbase/scripts/runtime.sh endpoints logs $RUNTIME_ID $ENDPOINT_ID \79 --from 0 --limit 10080```8182---8384### metrics [id] [endpointId] -- View endpoint resource metrics8586Get CPU and RAM usage metrics for a specific endpoint. Supports historical time range queries.8788**Query parameters**:89- `--from-time ISO` (string, optional) -- start of time range (ISO 8601)90- `--to-time ISO` (string, optional) -- end of time range (ISO 8601)9192**Command**:93```bash94# Current metrics95bash .claude/skills/agentbase/scripts/runtime.sh endpoints metrics $RUNTIME_ID $ENDPOINT_ID9697# Historical metrics with time range98bash .claude/skills/agentbase/scripts/runtime.sh endpoints metrics $RUNTIME_ID $ENDPOINT_ID \99 --from-time "2026-03-13T00:00:00Z" --to-time "2026-03-13T12:00:00Z"100```101102**Response** (`AgentRuntimeEndpointMetrics`):103- `cpuCoresUsage` -- array of `{timestamp (date-time), value (double)}` data points104- `memoryBytesUsage` -- array of `{timestamp (date-time), value (int64)}` data points105106---107108### events [id] [endpointId] -- View infrastructure events for an endpoint109110Fetch the infrastructure-level events emitted while deploying and running an endpoint. This is the **first place to look when an endpoint is not `ACTIVE` but the logs are empty** — startup failures (image pull errors, out-of-memory kills, scheduling/capacity failures, health-probe failures) surface here as events before any application log is produced.111112**Command**:113```bash114bash .claude/skills/agentbase/scripts/runtime.sh endpoints events $RUNTIME_ID $ENDPOINT_ID115```116117**Response**: array of event objects, each with:118- `message` (string) -- the event message (e.g. `Back-off pulling image ...`, `out of memory`, `insufficient capacity`)119- `lastTimestamp` (date-time) -- when the event last occurred120121**Common event signatures** (match against the `message` text):122123| Event message indicates | Meaning | Next step |124|------------------------|---------|-----------|125| Image pull failure (e.g. `pulling image` / `ErrImagePull`) | Image cannot be pulled | Verify `imageUrl` and registry credentials (`imageAuth`) on the runtime version |126| Out of memory (e.g. `OOM` / `out of memory`) | Instance exceeded its memory limit | Scale up the flavor or fix the memory leak (cross-check `metrics`) |127| Scheduling / capacity failure (e.g. `insufficient` / `no capacity`) | No capacity to place the instance | Usually a flavor/capacity issue — try a smaller flavor or retry later |128| Health probe failure (e.g. `probe failed`) | `/health` not returning 200 | Verify the health endpoint (see Log Analysis Guide) |129| Crash / restart loop | Instance keeps crashing on startup | Check endpoint logs for the startup traceback |130131---132133### traces -- Distributed tracing (passthrough)134135Query distributed traces for agent runtimes. These commands are a **thin passthrough** to the platform's tracing backend: the accepted query parameters (other than `traceId` / `tagKey`) and the response body shape are defined by that backend, **not by the runtime API spec**. Pass backend query params verbatim via repeated `--param key=value`; the response is the backend's raw JSON string.136137> **Param semantics not documented here.** Do NOT invent trace query param names. If the user needs specific filters (time range, service, tags, min duration, etc.), source the exact param keys from the tracing backend's own documentation or the console's network calls before using them. Without that, the commands still work as a raw passthrough.138139**Commands**:140```bash141# Search traces (params forwarded to the tracing backend)142bash .claude/skills/agentbase/scripts/runtime.sh traces search --param key=value [--param key=value ...]143144# Get a single trace by ID145bash .claude/skills/agentbase/scripts/runtime.sh traces get $TRACE_ID [--param key=value ...]146147# List available values for a trace tag key (for building filters)148bash .claude/skills/agentbase/scripts/runtime.sh traces tag-values $TAG_KEY [--param key=value ...]149```150151`--param` values are URL-encoded automatically. The response is returned as-is (a JSON string from the backend) — parse it according to the backend's schema.152153---154155## Current Limitations156157| Feature | Status |158|---------|--------|159| Log filtering by level (INFO/WARN/ERROR) | Not supported — all log levels are returned together |160| Log time range filter | Supported — use `--from-time`/`--to-time` |161| Log keyword search | Supported — use `--query` |162| Historical metrics | Supported — use `--from-time`/`--to-time` |163| Log streaming/tailing | Not supported — use polling as a workaround (see below) |164| Alerting/thresholds | Not supported |165166**Pseudo-tailing pattern**: To approximate log tailing, poll the logs command every 5-10 seconds with an increasing `--from` offset. Inform the user of the polling limit at the start (e.g., "Tailing logs for up to 5 minutes..."). After reaching the limit, inform the user and offer to restart tailing. Be mindful of rate limits:167```bash168OFFSET=0169LIMIT=100170MAX_POLLS=60171for i in $(seq 1 $MAX_POLLS); do172 RESULT=$(bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from $OFFSET --limit $LIMIT)173 BATCH_SIZE=$(echo "$RESULT" | jq '.logs | length')174 if [ "$BATCH_SIZE" -gt 0 ] 2>/dev/null; then175 echo "$RESULT" | jq -r '.logs[].content'176 OFFSET=$((OFFSET + BATCH_SIZE))177 fi178 sleep 5179done180```181182---183184## Log Analysis Guide185186### Common Error Signatures187188When reviewing logs, look for these patterns:189190| Pattern | Meaning | Next Step |191|---------|---------|-----------|192| `Traceback (most recent call last)` | Python exception — read the last line for the actual error | Check the exception type and message at the bottom of the traceback |193| `ModuleNotFoundError: No module named '...'` | Missing dependency | Add the module to `requirements.txt` and rebuild |194| `ImportError: cannot import name '...'` | Wrong package version or API change | Check package version compatibility |195| `ConnectionRefusedError` / `ConnectionError` | Cannot reach external service | Verify the service URL, check if auth credentials are injected correctly |196| `401 Unauthorized` / `403 Forbidden` | Authentication/authorization failure | Check IAM token, service account permissions, or external API key |197| `OSError: [Errno 98] Address already in use` | Port conflict (usually 8080) | Ensure only one process binds to port 8080 |198| `MemoryError` / `Killed` | Out of memory | Scale up flavor or optimize memory usage |199| `TimeoutError` / `ReadTimeout` | External API or LLM call timed out | Increase timeout, check LLM endpoint health |200| `KeyError: '...'` | Missing expected field in payload/response | Check payload format matches what handler expects |201| `Health check failed` | `/health` endpoint not returning 200 | Verify `@app.ping` is defined and returns `PingStatus.HEALTHY` |202203### Debugging Decision Tree204205Use this flow to diagnose common issues:206207```208Agent not responding?209├─ Check runtime status (/agentbase-deploy runtime get)210│ ├─ Status = FAILED → Check runtime logs (see runtime-logs above)211│ ├─ Status = CREATING → Wait, then re-check212│ └─ Status = ACTIVE → Check endpoint logs (see endpoint-logs above)213│ ├─ Logs show Python traceback → Fix the code error214│ ├─ Logs show "Health check failed" → Fix health endpoint215│ ├─ No recent logs → Check endpoint events (see events above) for infrastructure-level216│ │ failures (image pull, out-of-memory, capacity), then metrics217│ └─ Logs look normal → Issue may be in request routing, check endpoint URL218219Agent returns errors (4xx/5xx)?220├─ 500 Internal Server Error → Check endpoint logs for traceback (see endpoint-logs above)221├─ 502 Bad Gateway → Container crashed or not ready, check runtime logs (see runtime-logs above)222├─ 503 Service Unavailable → Container starting up or overloaded, check metrics (see metrics above)223└─ 401/403 → Check if agent's outbound auth is configured (/agentbase-identity)224225Agent is slow?226├─ Check metrics for CPU/RAM (see metrics above)227│ ├─ CPU near limit → CPU-bound (e.g., stuck loop, heavy computation)228│ │ └─ Scale up flavor or optimize code229│ ├─ RAM near limit → Memory-bound (e.g., large model in memory, data leak)230│ │ └─ Scale up flavor or fix memory leak231│ └─ Both low → Bottleneck is external (LLM API, database, network)232│ └─ Check logs for slow external calls, add request timing233```234235### Correlating Logs with Metrics236237- **High CPU + normal RAM** → CPU-bound workload (tight loops, heavy computation, synchronous LLM calls)238- **High RAM + normal CPU** → Memory leak or large data structures (loading entire datasets, caching without limits)239- **Both high** → Resource exhaustion — scale up the flavor or optimize both code paths240- **Both low + slow responses** → External dependency bottleneck (LLM API latency, database queries, network timeouts)241242### Log Filtering243244Use server-side filtering when possible, and client-side techniques for finer control:245246```bash247# Server-side: keyword search via --query248bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 100 --query "error"249250# Server-side: time range filter251bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID \252 --from 0 --limit 100 \253 --from-time "2026-03-13T00:00:00Z" --to-time "2026-03-13T12:00:00Z"254255# Client-side: filter fetched results locally256LOGS=$(bash .claude/skills/agentbase/scripts/runtime.sh logs $RUNTIME_ID --from 0 --limit 100)257echo "$LOGS" | jq -r '.logs[].content' | grep -i "error\|traceback\|exception\|failed"258259# Client-side: show only the last N lines260echo "$LOGS" | jq -r '.logs[].content' | tail -n 20261262# Client-side: count errors263echo "$LOGS" | jq -r '.logs[].content' | grep -ci "error"264```265266## Troubleshooting Guide267268| Error | Cause | Fix |269|-------|-------|-----|270| Agent not responding | Runtime crashed or not started | Check runtime status (`/agentbase-deploy runtime get`), then check runtime logs for crash messages |271| 502/503 errors on endpoint | Container startup failure | Check endpoint logs for startup failures, verify health endpoint returns 200 |272| High latency | Resource saturation | Check metrics for CPU/RAM saturation, consider scaling up flavor or replicas |273| OOM kills | Memory spikes exceeding limit | Check metrics for memory spikes, increase flavor size |274| Image pull errors | Wrong URL or missing credentials | Verify `imageUrl` and registry credentials in runtime config |275| Container crash loop | Code error or missing dependencies | Check runtime logs for Python tracebacks or missing dependencies |276277---278279# Part 2: Status Dashboard280281Show a unified dashboard of all AgentBase resources across services.282283## How It Works2842851. **Discover all resources** using `bash .claude/skills/agentbase/scripts/discovery.sh`2862. **Format into a dashboard** (see output format below)2873. **If any API call fails**, show that section as `Could not fetch (error details)` instead of crashing288289---290291## Output Format292293Format the results into a readable dashboard. Example:294295```296AgentBase Status Dashboard297==========================298299IAM: Configured (client_id: abc...xyz)300301Agent Identities (2):302 my-agent - "My first agent"303 test-bot - "Testing bot"304305Auth Providers:306 API Keys (1): openai-prod (ACTIVE)307 Delegated (0): none308 OAuth2 (0): none309310Runtimes (1):311 my-agent-rt (ACTIVE, v3, 1x1-general)312 DEFAULT: https://...313314Memory (1):315 my-memory (2 strategies, 30d expiry)316317AI Platform:318 API Keys (1): my-key (ACTIVE)319320Container Registry:321 Repos (1): my-repo (private)322```323324### Section Details325326- **IAM**: Show masked client_id (first 3 + last 3 chars)327- **Agent Identities**: Name and description for each328- **Auth Providers**: Group by type (API Key, Delegated, OAuth2). Show name and status for each. Show "none" if empty.329- **Runtimes**: Name, status, description, wallet (`poc`). For each runtime, list its endpoints with name, version, URL, and status. Fetch endpoints via `bash .claude/skills/agentbase/scripts/runtime.sh endpoints list $RUNTIME_ID`. (Note: runtime list DTO contains `id, name, description, status, statusReason, createdAt, updatedAt, poc` — `poc=true` bills the POC wallet (free credits), `poc=false` the real wallet. For flavor/version details, use `bash .claude/skills/agentbase/scripts/runtime.sh versions $RUNTIME_ID` which returns `version`, `imageUrl`, `flavorId`, `autoscaling` per version.)330- **Memory**: Name, number of strategies, event expiry duration331- **AI Platform**: API key names and status332- **Container Registry**: Repo names and access level (public/private)333334### Error Handling335336If any individual API call fails, display that section with the error instead of failing the whole dashboard:337```338Runtimes:339 Could not fetch (401 Unauthorized - token may be expired)340```341342### --json Flag343344If the user passes `--json`, output the raw JSON responses from all APIs as a single JSON object instead of the formatted dashboard:345```json346{347 "agentIdentities": { ... },348 "apiKeyProviders": { ... },349 "delegatedApiKeyProviders": { ... },350 "oauth2Providers": { ... },351 "runtimes": { ... },352 "memories": { ... },353 "aipApiKeys": { ... },354 "crRepository": { ... }355}356```357358---359360## Dashboard Pagination361362Different services use different pagination:363- **Identity Service** (agent identities, auth providers): **0-indexed** (page=0 is first page)364- **Runtime Service**, **Memory Service**, **AI Platform**: **1-indexed** (page=1 is first page)365366For the status dashboard, fetch the first page of each service with a reasonable size (e.g., size=10). If a service has more items than displayed, show the total count and offer to show more (e.g., "Showing 10 of 25 runtimes. Want to see more?").367368---369370## Instructions3713721. Parse the user's argument to determine the operation (`runtime-logs`, `endpoint-logs`, `metrics`, `events`, `traces`, `dashboard`).3732. **For logs/metrics/events operations:**374 a. If a runtime ID is needed and not provided, list runtimes first (`bash .claude/skills/agentbase/scripts/runtime.sh list`) and ask the user to pick one.375 b. If an endpoint ID is needed, list endpoints for the runtime (`bash .claude/skills/agentbase/scripts/runtime.sh endpoints list $RUNTIME_ID`) and ask the user to pick one.376 c. For logs, default to `--from 0 --limit 100` to fetch the most recent entries. Use `--from` to paginate if more logs are needed (max `--from`: 5000, max `--limit`: 500). Use `--query` for keyword filtering and `--from-time`/`--to-time` for time range filtering when the user specifies these.377 d. Present log output in a readable format, highlighting errors and warnings. Each log entry has `timestamp` and `content` fields.378 e. For metrics, display CPU (`cpuCoresUsage`) and RAM (`memoryBytesUsage`, convert values to MB/GB) as time-series data points. Use `--from-time`/`--to-time` for historical ranges. To show usage as percentages, fetch available flavors via `bash .claude/skills/agentbase/scripts/runtime.sh flavors` (returns `id`, `name`, `cpu`, `ram` for each flavor), then match the runtime's `flavorId` to get CPU/RAM limits.379 f. For events, present each event as `lastTimestamp — message`, newest first. Match messages against the "Common event signatures" table to suggest a next step. Use this especially when an endpoint is stuck out of `ACTIVE` and logs are empty.3803. **For traces operation:** these are a passthrough to the tracing backend. Do NOT invent query param names — only pass `--param` keys the user supplies or that you sourced from the backend's docs/console. Return the backend's JSON response and parse per its schema.3814. **For dashboard operation:**382 a. Parse the user's argument for `--json` flag.383 b. Run `bash .claude/skills/agentbase/scripts/discovery.sh` (or `bash .claude/skills/agentbase/scripts/discovery.sh json` for raw JSON).384 c. Format the results as a dashboard (or raw JSON if `--json`).385 d. Display the dashboard to the user.386 e. After displaying, offer to drill into any section or show more items if pagination was truncated.