canonical: https://jentic.com/apis/googleapis.com/libraryagent

# Google Library Agent API

The Library Agent API is Google's example library service exposing a small set of operations over shelves and books, intended for developers to learn the Google Cloud APIs design patterns. It supports listing shelves, listing or fetching individual books, and modeling borrow and return actions on a book. Because it is a sample API rather than a production service, it is most useful as a teaching tool, an integration test target, or a reference for Google's resource-oriented API conventions.

## For AI agents

Browse shelves and books and simulate borrow and return actions on a sample Google library service. Useful as a learning aid and integration test target.

## Scope

Does not represent a real library catalog, support creating shelves or books, or persist user-specific state - use only as a sample for learning Google's API patterns or for integration tests.

## Capabilities

- List shelves available in the library service
- List the books on a specific shelf
- Fetch a single book by its resource name
- Borrow a book using the books:borrow action
- Return a borrowed book using the books:return action

## Use cases

### Learning Google Cloud API design patterns

Developers exploring Google Cloud's resource-oriented API conventions use the Library Agent API to see hierarchical resource names like shelves/{shelf}/books/{book} and custom verb actions such as :borrow and :return in practice. The endpoints are stable and free to call, which makes the service a low-stakes sandbox for new SDK and tooling work.

Example prompt: List shelves with GET /v1/shelves, then list books on the first shelf and fetch one book by resource name.

### Integration test target for SDKs and agents

Teams building SDKs, MCP servers, or agent frameworks need a real Google API target for end-to-end tests that does not risk production data. The Library Agent's borrow and return endpoints provide simple state changes that an integration suite can call safely on every CI run.

Example prompt: Borrow a book then return it and assert that the response state transitions correctly.

### Demo data for educational tutorials

Workshops and onboarding sessions for Google Cloud APIs use the Library Agent service as the backing store for live coding demos. The shelves and books domain is intuitive enough that learners can focus on auth, pagination, and request shape rather than learning a complex service.

Example prompt: Walk a learner through GET /v1/shelves, GET /v1/{+parent}/books, and POST /v1/{+name}:borrow with explanations for each call.

### Agent framework smoke tests through Jentic

An agent framework can use the Library Agent API through Jentic as a smoke test that validates the full search-load-execute flow without needing real customer credentials. The five operations cover list, get, and custom-verb actions, which exercises the most common Jentic discovery paths.

Example prompt: Run google_libraryagent_borrow_book with a known book resource name and verify the response includes state=BORROWED.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v1/shelves | List all shelves |
| GET | /v1/{+parent}/books | List books on a shelf |
| GET | /v1/{+name} | Get a single book by resource name |
| POST | /v1/{+name}:borrow | Borrow a book |
| POST | /v1/{+name}:return | Return a borrowed book |

## Key resources

- **shelves** — List shelves available in the library
- **books** — List, get, borrow, and return books on a shelf

## Why Jentic

- **Setup:** Wiring the Library Agent API by hand means configuring service-account or user OAuth2, refreshing tokens, and learning its shelf and book resource-name paths yourself. Through Jentic you install once, import the Library Agent API from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** The shelf and book names travel in the URL path (/v1/{parent}/books, /v1/{name}:borrow), so a rule can pin your agent to one shelf: it lists and borrows books under that shelf and nothing else. You choose the operations it may call, so if you grant only the list and get operations the agent can browse without borrowing or returning.
- **Credential handling:** Your Google Cloud service-account or user OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time as a short-lived access token. The raw secret never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'list shelves' or 'borrow a book', and Jentic returns the matching v1 operation with its resource-name template so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Books API** — Google Books offers real catalog and volume data; Library Agent is a sample with mock shelves
- **Google Tasks API** — Tasks tracks to-do items; Library Agent demonstrates resource-oriented design with custom verbs
- **Google Calendar API** — Calendar is a full production API showing the same resource patterns at scale

## FAQ

### What authentication does the Library Agent API use?

OAuth 2.0 with the https://www.googleapis.com/auth/cloud-platform scope, using a standard Google Cloud service account or user OAuth flow. Through Jentic the credential lives in the encrypted vault and the agent only ever sees a short-lived access token.

### Is the Library Agent API a production service?

No. It is a Google sample API, designed to demonstrate Cloud API design patterns and serve as a learning and integration test target. Do not build production workflows on top of it; the data is shared and the service has no SLA.

### What are the rate limits for the Library Agent API?

Google applies the default Cloud APIs project quota of 60 requests per minute. The service has no published per-endpoint limits because it is a sample, but standard 429 backoff still applies.

### How do I borrow a book through Jentic?

Run jentic search 'borrow a book in the library agent service' to find POST /v1/{+name}:borrow, jentic load to fetch its parameters, then jentic execute with the book resource name like shelves/123/books/456. The response includes the new state field.

### Can I create new shelves or books with this API?

No. The Library Agent v1 API only exposes list, get, borrow, and return. Shelves and books are seeded by Google and cannot be created or deleted through the API.

### Is the Library Agent API free?

Yes. The service has no per-call pricing - only the standard Google Cloud project quota applies.

### Can I limit what my agent is allowed to do with the Library Agent API?

Yes. Because you run Jentic One yourself, your own rules decide which operations and credentials your agent may use with the Library Agent API. Since shelf and book names travel in the URL path, you can pin the agent to a single shelf so it only lists and borrows books under that shelf and nothing else. You also choose the operations it may call, so granting only the list and get operations lets the agent browse without ever borrowing or returning a book.
