~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/atlibs-agents

agents and atirc modules for atlibs: launch agents from a composition, chat on atirc; pages and the agents service

0
0
main
21 lines · 1.8 KB Raw History
// node modules/agents/compose.ts > modules/agents/composition.json
import { composition, policy } from "../../../atlibs/javascript/src/compose/build.js";
import { agents, policyOpen, requester } from "../../atlibs.modules.js";

const c = composition({
	name: "atirc agents",
	description: "agents launches an atirc agent on a socialweb.computer VM and shuts it down by its launch rkey; the requester does the market dance (contract, release, watch); allow-bidders keeps contracts to the bidders listed here. One session for both modules in the page and the service (both are the signed-in account).",
	limits: { depth: 3, calls: 40 },
});
const agent = c.instance("agents", agents, { session: "agents", budget: { wallMs: 1200000, calls: 100, events: 2000 } });
const market = c.instance("requester", requester, { session: "requester", budget: { wallMs: 900000, calls: 500, events: 5000 } });
const allowBidders = c.instance("allow-bidders", agents);
const bidPolicy = c.instance("bid-policy", policyOpen);
c.route(agent, "com.fedfork.market.contract", market, "an agent needs a VM: rfp, accept, guest reports, the ssh command that starts the agent, VM kept (release: false)", {
	policies: [policy(allowBidders, "allow_bidders", { bidders: ["did:plc:7q5lnitxv4meizdon5fmhzrq", "did:plc:4vcig7s43z3nyqrnepmcfzqt"] })],
});
c.route(agent, "com.fedfork.market.release", market, "shutting an agent down releases its VM (signed vm.delete + market.event)");
c.route(agent, "com.fedfork.market.watch", market, "agent status and shutdown read the guest's reports (vm.terminated)");
c.route(market, "com.publicdomainrelay.temp.market.evaluatePolicy", bidPolicy, "the requester's policy hook: open, since allow-bidders on the contract edge already limits the bidders to the two listed (route policy-requester-tangled-vouch here to also require a vouch)");

process.stdout.write(await c.json());