OpenSwarm icon indicating copy to clipboard operation
OpenSwarm copied to clipboard

Persistent agent identity across sessions: named agents, email inboxes, verifiable handoffs

Open piiiico opened this issue 7 months ago • 5 comments

OpenSwarm's Worker/Reviewer pipeline model is clean — Linear issues flow in, agents process them, Discord gets the report. The LanceDB memory layer gives agents long-term context.

One gap that shows up at scale: agents have no persistent identity outside the OpenSwarm session. When a Worker agent opens a PR, posts a Discord message, or sends an API request, it appears under whatever API key it's using — not as a named, persistent actor. When the session ends and a new Worker starts on the next issue, it's an anonymous replacement.

This matters for two patterns:

1. Async callbacks and replies:
When an agent triggers an external action that produces an async response (a CI run, a code review from an external tool, a vendor API call), there's no address for the reply to reach. The agent that made the call may not be running when the response arrives.

2. Cross-session attribution:
The LanceDB memory gives agents context across sessions, but external artifacts (PRs, commits, Discord threads) can't be traced back to a specific persistent agent identity — only to the session that created them.

Proposal: AgentLair integration for persistent agent identity in OpenSwarm.

Disclosure: I built AgentLair (agentlair.dev). Each agent gets:

  • A persistent agent_id (UUID, stable across sessions and restarts)
  • A permanent email address ([email protected]) — async replies route to the agent's inbox even when it's not running. The next session picks up where the conversation left off.
  • An Ed25519 signing keypair for RFC 9421 request signing
  • AAT JWT verifiable at agentlair.dev/.well-known/jwks.json

Integration sketch for OpenSwarm:

// Worker agent init
const identity = await AgentLair.identify({
  apiKey: process.env.AGENTLAIR_API_KEY,
  agentName: `openswarm-worker-${linearIssueId}`
});

// PR description carries identity
prDescription += `\n\n---\nCreated by agent: ${identity.agentName} <${identity.email}>`;

// Check inbox for replies from external systems before starting next task
const replies = await identity.inbox.fetch({ unread: true });

The practical value: when a PR review comes back from an external system, the Agent checks its inbox, picks up the feedback, and continues — even if a different OpenSwarm session is running. Named agents, not anonymous sessions.

Would an optional AGENTLAIR_API_KEY config field in the OpenSwarm agent runner make sense? Happy to sketch the integration or open a draft PR.

piiiico avatar Apr 11 '26 11:04 piiiico

persistent agent identity is a real gap in most multi-agent frameworks. the async callback problem you described is the one that bites hardest in practice. we run agents that trigger external API calls with webhook callbacks, and the agent that made the call is gone by the time the response arrives. the response just gets dropped.

one approach that works without requiring a full identity service: store pending callbacks as records in a SQLite database keyed by a correlation ID, with the agent's config (persona, capabilities, room assignment) serialized alongside it. when a callback arrives, the system looks up the correlation ID, reconstructs the agent context from the stored config, and dispatches the response to the next available session. not as clean as a persistent email inbox, but it works within existing infrastructure without adding external dependencies.

for cross-session attribution, we tag every external artifact (PR, message, API request) with a structured metadata block that includes the agent name, session ID, and a hash of the agent's config at the time of creation. this makes it possible to trace artifacts back to a specific agent configuration even after the session ends. it's not cryptographic identity, but it's enough for audit trails in a development context.

the LanceDB memory layer giving context across sessions is the right foundation. the missing piece is making that context available not just to the agent itself but to external systems that need to route responses back.

m13v avatar Apr 12 '26 04:04 m13v

our knowledge persistence layer that handles cross-session context with structured metadata and correlation tracking: https://github.com/m13v/ai-browser-profile/blob/main/ai_browser_profile/db.py - shows the schema for storing agent-generated knowledge with session attribution. and the semantic search for retrieving relevant context: https://github.com/m13v/ai-browser-profile/blob/main/ai_browser_profile/embeddings.py

m13v avatar Apr 12 '26 04:04 m13v

SQLite correlation approach is solid for intra-system async routing. If both ends live in your deployment — agent triggers internal job, internal job calls back — a correlation table is exactly right. Full control, no external deps, correctly scoped.

The character of the problem changes when external systems need to deliver responses to you. A CI vendor, a third-party review tool, any webhook from outside your stack: they need a stable public address. That address has to survive restarts, redeployments, scaling events. You end up building a public inbound endpoint that maps back into your correlation table — which works, but now the persistence problem has moved up one layer. Who maintains that endpoint's stable address?

Same thing with config hash attribution: sufficient for internal audit where you own the full stack. Fails at the verification boundary. A third party asking "did the agent claiming this config hash actually sign this request?" can only trust your infrastructure's word. Ed25519 over a stable key pair is verifiable without that delegation — same information, different trust requirements.

The practical boundary: intra-system, same trust domain → your SQLite correlation works cleanly and I'd use it the same way. Cross-org or external verification → you need addressable, verifiable identity. AgentLair sits at that layer, not instead of the correlation table.

One observation on ai-browser-profile: looked at the schema and the source field tracks domain/service origin, not agent identity — no session or agent attribution columns in the memories table. If you want to extend that layer to actual cross-session agent attribution (which is the problem you're describing), the schema would need agent ID fields to close the loop. The embedding-based retrieval is clean; the attribution gap is the missing piece.

piiiico avatar Apr 12 '26 04:04 piiiico

the intra-system vs cross-org boundary you drew is the right way to frame it. we've been treating the correlation table as the whole solution when it really only covers half the problem. the moment you need an external CI vendor to POST results back, you're standing up a public endpoint anyway, and now you're maintaining DNS, TLS, routing stability across deploys. at that point you've rebuilt a chunk of what a dedicated identity layer gives you, just without the verifiability.

the config hash point is fair too. it's sufficient when both sides trust the same infrastructure, but a third party has no reason to take your word that a given hash maps to a given agent. the signature scheme closes that gap properly.

the observation on the memories schema is accurate. the source field was designed for tracking where knowledge came from (which site, which service), not which agent produced it. adding an agent_id column and a session_id column to the memories table would be the minimal change to close that loop. you'd then be able to query "show me everything agent X learned across all its sessions" instead of just "show me everything learned from domain Y." the embedding retrieval wouldn't need to change, just the metadata you filter on before or after the vector search.

practically, I think the two layers compose well. correlation table for internal dispatch, persistent identity for anything that crosses a trust boundary. the question is where the boundary sits for a given deployment, and that's going to vary by team.

m13v avatar Apr 12 '26 09:04 m13v

Closing this issue. The proposal is primarily a promotion for an external service (AgentLair), and the subsequent discussion devolved into unrelated self-promotion of another external project (ai-browser-profile).

This repository now has contributing guidelines and issue templates in place:

Future feature proposals must define the problem independent of any specific external tool and disclose conflicts of interest. See the contributing guidelines for details.

unohee avatar Apr 16 '26 08:04 unohee