Skip to content

Share sessions between A2A and interactive mode #2734

@maxcleme

Description

@maxcleme

I'd like to start an agent task non-interactively over A2A, let it finish, and then jump into the same conversation interactively from another terminal with docker-agent run --session <id>. That doesn't work today: A2A sessions are never visible to run --session.

The cause is that serve a2a and run use two different session backends:

  • cmd.PersistentFlags().StringVarP(&flags.sessionDB, "session-db", "s", filepath.Join(paths.GetHomeDir(), ".cagent", "session.db"), "Path to the session database")

  • executor := newExecutorWrapper(adka2a.ExecutorConfig{
    RunnerConfig: runner.Config{
    AppName: name,
    Agent: adkAgent,
    SessionService: session.InMemoryService(),
    },
    })

The two stores never see each other. So a session started via serve a2a never lands in ~/.cagent/session.db, never shows up in run --session listings, and disappears entirely the moment the serve a2a process exits.

What I'd expect

Be able to do this:

# Terminal 1 — kick off a task via A2A and let it run to completion.
docker-agent serve a2a ./agent.yaml --listen 127.0.0.1:8082 &

# Send a message with a known contextId.
curl -sS http://127.0.0.1:8082/invoke \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"1","method":"message/send","params":{"message":{"role":"user","messageId":"m1","contextId":"my-task-001","parts":[{"kind":"text","text":"Investigate the failing test in pkg/foo"}]}}}'

# Wait for completion, then stop the serve process — the work is done.

# Terminal 2 — pick the conversation up interactively.
docker-agent run ./agent.yaml --session my-task-001

That second command should drop me into the same conversation, with full prior turns in context, so I can poke around interactively (ask follow-ups, tweak, etc.) without re-priming the agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiFor features/issues/fixes related to the usage of the cagent APIarea/sessionsFor features/issues/fixes related to session lifecycle (resume, persistence, export)priority:mediumNormal priority, standard sprint work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions