@bytesbrains/pi-loki-gate
Loki log gateway for pi agents — query Grafana Loki for container/job/worker logs from the wrok.in AI Factory.
Package details
Install @bytesbrains/pi-loki-gate from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@bytesbrains/pi-loki-gate- Package
@bytesbrains/pi-loki-gate- Version
1.0.0- Published
- May 15, 2026
- Downloads
- not available
- Author
- nandal
- License
- MIT
- Types
- extension
- Size
- 18.2 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-loki-gate
Loki log gateway for pi agents — query Grafana Loki for structured application logs from the wrok.in AI Factory.
For raw Docker container output (console.log + everything), use pi-docker-logs.
Install
pi install npm:pi-loki-gate
Configuration
Add a .lokirc.yml to your repo root:
lokiUrl: http://localhost:3100
defaultLimit: 100
| Key | Default | Description |
|---|---|---|
lokiUrl |
http://localhost:3100 |
Grafana Loki API URL |
defaultLimit |
100 |
Default log lines per query |
Available Labels
| Label | Values | Description |
|---|---|---|
service_name |
worker, orchestrator |
Service producing the log |
service |
worker, orchestrator |
Same as service_name |
agent |
developer, etc. |
Agent running the task |
Tools
loki_query
Run arbitrary LogQL queries against Loki.
loki_query(query='{service_name="orchestrator"}')
loki_query(query='{service_name="worker"} |= "error"', limit=50)
loki_job_logs
Fetch logs for a specific factory job by its ID.
Note: Only matches structured JSON log lines. Console output like "Job X complete" is only in Docker logs — use
docker_worker_logsfor full output.
loki_job_logs(jobId="af57818e")
loki_worker_logs
Fetch logs from workers or orchestrator via Loki.
loki_worker_logs(worker="1")
loki_worker_logs(worker="3", search="error")
loki_worker_logs(container="ai-factory-orchestrator")
Loki vs Docker Logs
| Loki | Docker Logs | |
|---|---|---|
| Captures | Structured JSON only | All stdout/stderr |
| Per-container | ❌ | ✅ |
| Label filtering | ✅ (agent, service) | ❌ (text search) |
| Best for | Service/agent exploration, error patterns | Complete job output, console messages |
License
MIT