Forum OpenACS Development: Re: API for AI Agents?!?

Collapse
3: Re: API for AI Agents?!? (response to 2)
Posted by Frank Bergmann on
Hi Malte,

Yeah for non-English native speakers like us the AI stuff is a salvation.

However, it hallucinated im_timesheet::log_hours and a few other points, stressing that you just can't use it in a lot of places.

I take from that:
- A validation of my ideas concerning "read" operations (using indicators and a graph export of the database). Thanks! And yeah, that's probably where to start, because it's not that complicated and it's safe.
- A validation that permissions are a critical point. I'd want the agent to work with the permissions of the respective user only. Actually, I'm not sure how that could be implemented. I'll check.
- I like the idea of using workflow for human approval of agent work.
- A validation that im_audit is very, very important...

The idea of using the TCL API layer for "write" operations is interesting, but I think it wouldn't work precisely because of the permission issues. Access to the TCL API means superuser rights. Writing new TCL routines to be used specifically for the agent would be the same as writing new REST endpoints. In contrast, the existing ]po[ REST API already has permissions.

Iterate based on what agents actually do wrong

Iterate on what customers really need and what produces value for them. No idea about this at the moment...

Cheers!
Frank

Collapse
4: Re: API for AI Agents?!? (response to 3)
Posted by Malte Sussdorff on
Hi Frank,

On the Tcl API and permissions: we've actually been running a Tcl-based API layer in production with multiple clients for our SPA for several years now. We've extended the ]po[ namespace with additional wrapper procs for several modules — timesheet tracking, for example — specifically to give our SPA clean API entry points with validation and permission handling. The Tcl layer gives us access to the full business logic (validation, side effects, audit calls) that the REST endpoints sometimes bypass or duplicate. It handles permission checking at the application level before executing business logic, so it's not operating with superuser rights in practice. That said, I realize my response was written from the perspective of our extended codebase, which has additional features beyond the main ]po[ distribution. Your REST API approach with built-in permissions is a perfectly valid starting point, especially since it's already there and working.

The more interesting question is probably: regardless of which API layer you expose through MCP, how do you handle the permission delegation? You mentioned wanting agents to work with the respective user's permissions — that's exactly right, and it's where something like OAuth token scoping or a principal-user-id passed through the agent layer becomes important. The agent authenticates as itself but acts on behalf of a specific user, and the API layer enforces that user's permission set. We solved this in our Tcl layer but the same pattern would work on top of your REST API.

On the iteration point — absolutely, customer value first. What I meant is more pragmatic: once you have the read-only MCP server running, you'll quickly see which write operations users actually ask the agent to perform. That usage data tells you what to build next, rather than guessing upfront.

Cheers,
Malte