Add per-agent scopes at configured AutoGen function boundaries. Wrapped functions enforce required scopes; other functions remain outside the integration.
AutoGen agents in a group chat share credentials. If one agent is compromised or hallucinates, it has access to everything the others can do.
Configured AutoGen agents can present separate scoped JWTs. Protected function wrappers enforce the required scope, and optional audit callbacks record selected calls.
npm install @grantex/autogen — wraps AutoGen function maps with authorization.
Create identities with role-specific scopes for each agent in the group.
Obtain a role-scoped grant for each agent through the configured authorization flow before the conversation starts.
Each agent presents its own JWT. Configured function wrappers verify the grant and required scope before execution.
Add an audit wrapper to attribute selected function calls and outcomes to specific agents.
import { createGrantexFunction } from '@grantex/autogen';
const writeCode = createGrantexFunction({
name: 'write_code',
description: 'Write code for an approved task',
parameters: {
type: 'object',
properties: { task: { type: 'string' } },
required: ['task'],
},
grantToken: coderToken,
requiredScope: 'code:write',
func: async ({ task }) => writeCodeFn(task),
});
const runCode = createGrantexFunction({
name: 'run_code',
description: 'Execute approved code',
parameters: {
type: 'object',
properties: { source: { type: 'string' } },
required: ['source'],
},
grantToken: executorToken,
requiredScope: 'code:execute',
func: async ({ source }) => runCodeFn(source),
});
const tools = [writeCode.definition, runCode.definition];
Each agent in the AutoGen group gets its own scoped token and identity.
Prevent agents from accessing tools outside their role. Enforced at the protocol level.
Wrap functions to record which agent called which function and with what scope context.
Agents can delegate narrower scopes to spawned sub-agents with depth tracking.
Adapter wrapper for AutoGen function maps; integrate it at every protected function boundary.
Revoke an agent grant centrally. Local JWT consumers must synchronize revocation state or use short token lifetimes.
This integration enforces authorization only where its wrapper or middleware is installed. Local JWT verification checks signatures and claims after JWKS retrieval; it does not prove current revocation unless the verifier performs an online state check or synchronizes revocation data.
Token verification does not create a consent record or prove that a tool executed. Use the configured authorization flow for grant decisions and add an audit integration at the execution boundary when action records are required.
Follow the integration guide and verify the package version before deployment. Apache 2.0.