Skip to main content
Glama

aga_demonstrate_lifecycle

Execute a complete attestation lifecycle demonstration: attest, measure, detect drift, revoke, bundle, and verify integrity for AI agent actions.

Instructions

Execute full AGA lifecycle demo: attest → measure → drift → revoke → bundle → verify.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subject_contentNo
subject_metadataNo
scenarioNoScenario: drone, scada, or custom
include_driftNo
include_revocationNo
include_behavioralNo

Implementation Reference

  • The main handler function for the 'aga_demonstrate_lifecycle' tool. It executes the full AGA lifecycle demo including attestation, monitoring, drift detection, behavioral monitoring, revocation, and evidence bundling.
    export async function handleFullLifecycle(args: FullLifecycleArgs, ctx: ServerContext) {
      const scenario = SCENARIOS[args.scenario ?? ''] ?? {
        content: args.subject_content ?? 'def agent(): return task.execute()',
        metadata: args.subject_metadata ?? { filename: 'lifecycle-test' },
      };
      const content = scenario.content;
      const meta = scenario.metadata;
      const includeDrift = args.include_drift !== false;
      const includeRevocation = args.include_revocation !== false;
      const includeBehavioral = args.include_behavioral !== false;
    
      const phases: Record<string, unknown> = {};
    
      // Phase 1: Attestation
      const subId = computeSubjectIdFromString(content, meta);
      const policyRef = sha256Str(JSON.stringify(ctx.defaultEnforcement));
      const att = performAttestation({ subject_identifier: subId, policy_reference: policyRef, evidence_items: [] });
      if (!att.success || !att.sealed_hash || !att.seal_salt) return ctx.error('Attestation failed');
    
      const artifact = generateArtifact({
        subject_identifier: subId, policy_reference: policyRef, policy_version: 1,
        sealed_hash: att.sealed_hash, seal_salt: att.seal_salt,
        enforcement_parameters: { ...ctx.defaultEnforcement, enforcement_triggers: ['QUARANTINE', 'TERMINATE'] },
        disclosure_policy: ctx.defaultClaims,
        evidence_commitments: att.evidence_commitments, issuer_keypair: ctx.issuerKP,
      });
      await ctx.storage.storeArtifact(artifact);
      ctx.portal.reset();
      ctx.portal.loadArtifact(artifact, pkToHex(ctx.issuerKP.publicKey));
      ctx.activeArtifact = artifact;
      await ctx.appendToChain('POLICY_ISSUANCE', { artifact_hash: hashArtifact(artifact) });
      phases.attestation = { success: true, artifact_hash: hashArtifact(artifact), portal_state: ctx.portal.state };
    
      // Phase 2: Clean monitoring
      const result = ctx.portal.measure(new TextEncoder().encode(content), meta);
      const artRef = hashArtifact(artifact);
      const receipt = generateReceipt({
        subjectId: subId, artifactRef: artRef,
        currentHash: `${result.currentBytesHash}||${result.currentMetaHash}`,
        sealedHash: `${result.expectedBytesHash}||${result.expectedMetaHash}`,
        driftDetected: false, driftDescription: null, action: null,
        measurementType: 'EXECUTABLE_IMAGE', seq: ctx.portal.sequenceCounter + 1,
        prevLeaf: ctx.portal.lastLeafHash, portalKP: ctx.portalKP,
      });
      await ctx.storage.storeReceipt(receipt);
      await ctx.appendToChain('INTERACTION_RECEIPT', { receipt_id: receipt.receipt_id });
      phases.monitoring = { match: result.match, receipt_id: receipt.receipt_id };
    
      // Phase 3: Drift detection
      if (includeDrift) {
        const injected = content.replace('return', 'return attacker.exfiltrate(') + ')';
        const driftResult = ctx.portal.measure(new TextEncoder().encode(injected), meta);
        ctx.portal.enforce('QUARANTINE');
        ctx.quarantine = initQuarantine();
        captureInput(ctx.quarantine, 'attacker_command', 'exfiltrate data');
        const driftReceipt = generateReceipt({
          subjectId: subId, artifactRef: artRef,
          currentHash: `${driftResult.currentBytesHash}||${driftResult.currentMetaHash}`,
          sealedHash: `${driftResult.expectedBytesHash}||${driftResult.expectedMetaHash}`,
          driftDetected: true, driftDescription: 'Binary modification detected', action: 'QUARANTINE',
          measurementType: 'EXECUTABLE_IMAGE', seq: ctx.portal.sequenceCounter + 1,
          prevLeaf: ctx.portal.lastLeafHash, portalKP: ctx.portalKP,
        });
        await ctx.storage.storeReceipt(driftReceipt);
        await ctx.appendToChain('INTERACTION_RECEIPT', { receipt_id: driftReceipt.receipt_id, drift_detected: true });
        phases.drift_detection = { drift_detected: true, enforcement: 'QUARANTINE', portal_state: ctx.portal.state };
      }
    
      // Phase 3b: Behavioral drift
      if (includeBehavioral) {
        ctx.behavioralMonitor.setBaseline({
          permitted_tools: ['survey', 'report'], rate_limits: { survey: 10 },
          forbidden_sequences: [['exfiltrate', 'transmit_external']], window_ms: 60000,
        });
        ctx.behavioralMonitor.recordInvocation('exfiltrate', sha256Str('exfil'));
        const bm = ctx.behavioralMonitor.measure();
        if (bm.drift_detected) {
          await ctx.appendToChain('BEHAVIORAL_DRIFT', { violations: bm.violations, behavioral_hash: bm.behavioral_hash });
        }
        phases.behavioral_drift = { drift_detected: bm.drift_detected, violations: bm.violations.length };
      }
    
      // Phase 3c: Revocation
      if (includeRevocation) {
        ctx.portal.revoke(artifact.sealed_hash);
        await ctx.appendToChain('REVOCATION', { artifact_sealed_hash: artifact.sealed_hash, reason: 'Compromise detected' });
        phases.revocation = { revoked: true, portal_state: ctx.portal.state };
      }
    
      // Phase 4: Evidence bundle
      const allEvents = await ctx.storage.getAllEvents();
      const { checkpoint } = createCheckpoint(allEvents);
      await ctx.storage.storeCheckpoint(checkpoint);
      await ctx.appendToChain('ANCHOR_BATCH', { merkle_root: checkpoint.merkle_root, leaf_count: allEvents.length });
    
      const allReceipts = await ctx.storage.getAllReceipts();
      const batchEvents = await ctx.storage.getEvents(checkpoint.batch_start_sequence, checkpoint.batch_end_sequence);
      const proofs = batchEvents.length > 1 ? [eventInclusionProof(batchEvents, batchEvents[1].sequence_number)] : [];
      const bundle = generateBundle(artifact, allReceipts, proofs, checkpoint, ctx.portalKP);
      const verification = verifyBundleOffline(bundle, pkToHex(ctx.issuerKP.publicKey));
      phases.evidence_bundle = { verification, receipt_count: allReceipts.length };
    
      return ctx.json({
        success: true,
        scenario: args.scenario ?? 'default',
        phases,
        final_verdict: verification.overall ? 'PASS' : 'FAIL',
        portal_state: ctx.portal.state,
      });
    }
  • src/server.ts:276-287 (registration)
    Registration of the 'aga_demonstrate_lifecycle' tool in the main server definition.
    server.tool('aga_demonstrate_lifecycle',
      'Execute full AGA lifecycle demo: attest → measure → drift → revoke → bundle → verify.',
      {
        subject_content: z.string().optional(),
        subject_metadata: z.record(z.string()).optional(),
        scenario: z.string().optional().describe('Scenario: drone, scada, or custom'),
        include_drift: z.boolean().optional(),
        include_revocation: z.boolean().optional(),
        include_behavioral: z.boolean().optional(),
      },
      async (args) => handleFullLifecycle(args, ctx),
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the sequence of operations but doesn't explain what each step does, whether it's read-only or destructive, what permissions are needed, or what the output looks like. For a tool with 6 parameters and no annotations, this is insufficient to understand its behavior beyond a high-level workflow.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single sentence listing the demo steps. It's front-loaded with the main purpose and wastes no words. Every part of the sentence directly contributes to explaining the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain what the tool returns, how the parameters interact, or what the 'AGA lifecycle' entails. For a demo tool that likely has significant side effects, more context is needed to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is low at 17%, with only one parameter ('scenario') having a description. The tool description doesn't add any meaning about the parameters—it doesn't explain what 'subject_content' or 'subject_metadata' are, or how the boolean flags affect the demo. With 6 parameters and minimal schema coverage, the description fails to compensate for the gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Execute[s] full AGA lifecycle demo' and lists the sequence of operations (attest → measure → drift → revoke → bundle → verify), which gives a general idea of what it does. However, it's vague about what 'AGA lifecycle' entails and doesn't distinguish this from sibling tools like aga_measure_behavior or aga_verify_artifact, which might handle parts of this lifecycle individually.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There's no guidance on when to use this tool versus its siblings. The description implies it's for a 'demo' but doesn't specify scenarios where this comprehensive tool is preferable over using individual tools like aga_measure_subject or aga_revoke_artifact separately. No exclusions or alternatives are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/attestedintelligence/aga-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server