RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD ....D bean · Issue #893 · a2aproject/a2a-java · GitHub
Skip to content

RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD ....D bean #893

Closed

Description

@mescaja

An A2A Agent Server Executor producer class is throwing this error when calling a Rest Client

jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD bean [class=io.quarkus.oidc.runtime.OidcTokenCredentialProducer, id=qPtfJ2z9Vcs78nLYoSxmBSZ461Y]
	- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
	at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
	at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
	at io.quarkus.oidc.OidcTokenCredentialProducer_ProducerMethod_currentAccessToken_LqZ323vwEzgoIJymPKn-DMYcc6w_ClientProxy.arc$delegate(Unknown Source)
	at io.quarkus.oidc.OidcTokenCredentialProducer_ProducerMethod_currentAccessToken_LqZ323vwEzgoIJymPKn-DMYcc6w_ClientProxy.getToken(Unknown Source)
	at org.acme.WanakuAgentExecutorProducer$WanakuAgentExecutor.execute(WanakuAgentExecutorProducer.java:93)
	at org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler$2.run(DefaultRequestHandler.java:935)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:677)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)

2026-05-23 15:19:41,661 ERROR [org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler] (a2a-event-consumer-1) onError for task 1e4f3f4f-7d5f-4c07-a09d-c86a093e0da4: org.a2aproject.sdk.spec.InternalError: Agent execution failed: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD bean [class=io.quarkus.oidc.runtime.OidcTokenCredentialProducer, id=qPtfJ2z9Vcs78nLYoSxmBSZ461Y]
	- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
	at org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler$2.run(DefaultRequestHandler.java:946)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:677)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)

The Rest Client definition

@RegisterRestClient(configKey="binance-rest-client")
public interface BinanceLocalAgentRestClient {

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @ClientHeaderParam(name = "Authorization", value = "Bearer {token}")
    DeepChatMessage callBinanceLocalAgent(@NotBody String token, DeepChatMessage payload);
}

from the AgentExecutor method the rest resource is called as follows

        @Override
        public void execute(RequestContext context, AgentEmitter agentEmitter) throws A2AError {

try {
                DeepChatMessage aiMessage = binanceLocalAgentRestClient.callBinanceLocalAgent(accessToken.getToken(), userMessage);
} catch ( JsonProcessingException e) {
                e.printStackTrace();
            }
}

it's rather straightforward setup. Even i got the rest client setup to call a public, not protected hello world endpoint like this in the application.properties, still throwing the same error.

quarkus.rest-client.binance-rest-client.url=https://binance-local.tst/hello

I didn't try using Quarkus Mutiny on the Rest Client to return a Uni and make the rest call none blocking. i don't think it'd make any difference in terms of this error.

Activity

  1. mescaja commented on May 23, 2026

    @mescaja
    Author

    i tried annotate the Rest client class with @ActivateRequestContext, no difference whatsoever

    
    @ActivateRequestContext
    @RegisterRestClient(configKey="binance-rest-client")
    public interface BinanceLocalAgentRestClient {
    
        @POST
        @Consumes(MediaType.APPLICATION_JSON)
        @Produces(MediaType.APPLICATION_JSON)
        @ClientHeaderParam(name = "Authorization", value = "Bearer {token}")
    
        DeepChatMessage callBinanceLocalAgent(@NotBody String token, DeepChatMessage payload);
    }
    
  2. mescaja commented on May 23, 2026

    @mescaja
    Author

    these are other alternatives

    • AgentExecutor >> AI Service >> Tools exposing the rest API
    • AgentExecutor >> AI Service >> MCP >> run the tool that exposes the rest API

    Since i have to propagate the access token available from the A2A Server Agent request context, i much rather call the Rest API directly from the AgentExecutor to keep things simple

  3. mescaja commented on May 23, 2026

    @mescaja
    Author

    i am using JSONRPC transport from 1.0.0.CR1 SDK with Quarkus 3.35.4

    <quarkus.platform.version>3.35.4</quarkus.platform.version>
    .....
               <dependency>
                    <groupId>org.a2aproject.sdk</groupId>
                    <artifactId>a2a-java-sdk-bom</artifactId>
                    <version>1.0.0.CR1</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
  4. kabir commented on May 26, 2026

    @kabir
    Collaborator

    Thanks for the report, I'm trying to fix it

  5. self-assigned this
    on May 26, 2026
  6. mescaja commented on May 26, 2026

    @mescaja
    Author

    thanks @kabir

    the token propagation when quarkus-langchain4j-oidc-mcp-auth-provider quarkus is extension added to the quarkus app seems to have stopped working in 1.0.0.CR1.

    not sure it's related to the same underlying issue or a separate one. I can raise a ticket for it if need be but essentially in the scenario where an A2A client Agent calls a A2A Server agent protected by oidc scheme which in turns runs a AI Service to call a tool exposed by an MCP that is also protected by OIDC, the JWT token acquired by the A2A client Agent used to authenticate the request to the A2A server agent get propagated successfully during the MCP call (Authorization header gets set to the same JWT access token) only when the pom file is set with <version>1.0.0.Beta1</version>

    if switched to <version>1.0.0.CR1</version> , the MCP calls fails returning 401 error code.

  7. kabir commented on May 26, 2026

    @kabir
    Collaborator

    @mescaja Does the linked PR #897 fix the problem?

  8. mescaja commented on May 26, 2026

    @mescaja
    Author

    let me give it a go today. will confirm

  9. added a commit that references this issue on May 26, 2026
    0477a66
  10. mescaja commented on May 26, 2026

    @mescaja
    Author

    @mescaja Does the linked PR #897 fix the problem?

    i don't think it's fixed although i may have not implemented the fix in my environment correctly. I will check it again tomorrow

    Still getting the 401 error which goes away if i downgrade from CR1 to Beta1

  11. ehsavoie commented on May 27, 2026

    @ehsavoie
    Collaborator

    @mescaja Does it work if you enable opentelemetry in CR1 ?

  12. mescaja commented on May 27, 2026

    @mescaja
    Author

    @ehsavoie , i didn't try. i never enabled OpenTelemetry in any of my Quarkus app. let me give it a go, it might take me a while to get this test done. hopefully at some point today

  13. mescaja commented on May 27, 2026

    @mescaja
    Author

    i might need some guidance here. Not sure all is correctly setup in terms of enabling OTel

    I added a few dependencies to my pom in the A2A server agent

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.acme</groupId>
        <artifactId>remote-agent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <packaging>quarkus</packaging>
    
        <properties>
            <compiler-plugin.version>3.15.0</compiler-plugin.version>
            <maven.compiler.release>21</maven.compiler.release>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
            <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
            <quarkus.platform.version>3.35.4</quarkus.platform.version>
            <skipITs>true</skipITs>
            <surefire-plugin.version>3.5.4</surefire-plugin.version>
            <version.org.eclipse.microprofile.telemetry>2.0.1</version.org.eclipse.microprofile.telemetry>
        </properties>
    
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>${quarkus.platform.group-id}</groupId>
                    <artifactId>${quarkus.platform.artifact-id}</artifactId>
                    <version>${quarkus.platform.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <dependency>
                    <groupId>${quarkus.platform.group-id}</groupId>
                    <artifactId>quarkus-langchain4j-bom</artifactId>
                    <version>${quarkus.platform.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <dependency>
                    <groupId>org.a2aproject.sdk</groupId>
                    <artifactId>a2a-java-sdk-bom</artifactId>
                    <version>1.0.0.CR1</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
        <dependencies>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-rest</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-rest-jackson</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-arc</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-oidc</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkiverse.langchain4j</groupId>
                <artifactId>quarkus-langchain4j-oidc-mcp-auth-provider</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-rest-client-oidc-token-propagation</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkiverse.langchain4j</groupId>
                <artifactId>quarkus-langchain4j-mistral-ai</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-kubernetes</artifactId>
            </dependency>
    
             <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-container-image-jib</artifactId>
            </dependency>
            <dependency>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-junit</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.rest-assured</groupId>
                <artifactId>rest-assured</artifactId>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>org.a2aproject.sdk</groupId>
                <artifactId>a2a-java-sdk-client</artifactId>
            </dependency>
            <dependency>
                <groupId>org.a2aproject.sdk</groupId>
                <artifactId>a2a-java-sdk-server-common</artifactId>
            </dependency>
            <dependency>
                <groupId>org.a2aproject.sdk</groupId>
                <artifactId>a2a-java-sdk-reference-jsonrpc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.a2aproject.sdk</groupId>
                <artifactId>a2a-java-sdk-microprofile-config</artifactId>
            </dependency>
            <dependency>
                <groupId>org.a2aproject.sdk</groupId>
                <artifactId>a2a-java-sdk-opentelemetry-common</artifactId>
            </dependency>
            <dependency>
                <groupId>org.eclipse.microprofile.telemetry</groupId>
                <artifactId>microprofile-telemetry-api</artifactId>
                <version>${version.org.eclipse.microprofile.telemetry}</version>
                <type>pom</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>jakarta.enterprise</groupId>
                <artifactId>jakarta.enterprise.cdi-api</artifactId>
            </dependency>
            <dependency>
                <groupId>jakarta.inject</groupId>
                <artifactId>jakarta.inject-api</artifactId>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>${quarkus.platform.group-id}</groupId>
                    <artifactId>quarkus-maven-plugin</artifactId>
                    <version>${quarkus.platform.version}</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${compiler-plugin.version}</version>
                    <configuration>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire-plugin.version}</version>
                    <configuration>
                        <argLine>@{argLine}</argLine>
                        <systemPropertyVariables>
                            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            <maven.home>${maven.home}</maven.home>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${surefire-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <argLine>@{argLine}</argLine>
                        <systemPropertyVariables>
                            <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            <maven.home>${maven.home}</maven.home>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
        <profiles>
            <profile>
                <id>native</id>
                <activation>
                    <property>
                        <name>native</name>
                    </property>
                </activation>
                <properties>
                    <quarkus.package.jar.enabled>false</quarkus.package.jar.enabled>
                    <skipITs>false</skipITs>
                    <quarkus.native.enabled>true</quarkus.native.enabled>
                </properties>
            </profile>
        </profiles>
    </project>
    
    

    run a test, same issue

    : jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD bean [class=io.quarkus.oidc.runtime.OidcTokenCredentialProducer, id=qPtfJ2z9Vcs78nLYoSxmBSZ461Y]
    	- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
    	at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
    	at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
    	at io.quarkus.oidc.OidcTokenCredentialProducer_ProducerMethod_currentAccessToken_LqZ323vwEzgoIJymPKn-DMYcc6w_ClientProxy.arc$delegate(Unknown Source)
    	at io.quarkus.oidc.OidcTokenCredentialProducer_ProducerMethod_currentAccessToken_LqZ323vwEzgoIJymPKn-DMYcc6w_ClientProxy.getToken(Unknown Source)
    	at io.quarkus.oidc.token.propagation.reactive.AccessTokenRequestReactiveFilter.verifyTokenInstance(AccessTokenRequestReactiveFilter.java:158)
    	at io.quarkus.oidc.token.propagation.reactive.AccessTokenRequestReactiveFilter.filter(AccessTokenRequestReactiveFilter.java:87)
    	at org.jboss.resteasy.reactive.client.spi.ResteasyReactiveClientRequestFilter.filter(ResteasyReactiveClientRequestFilter.java:21)
    	at org.jboss.resteasy.reactive.client.handlers.ClientRequestFilterRestHandler.handle(ClientRequestFilterRestHandler.java:25)
    	at org.jboss.resteasy.reactive.client.handlers.ClientRequestFilterRestHandler.handle(ClientRequestFilterRestHandler.java:10)
    	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.invokeHandler(AbstractResteasyReactiveContext.java:231)
    	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
    	at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.performRequestInternal(AsyncInvokerImpl.java:285)
    	at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.performRequestInternal(AsyncInvokerImpl.java:275)
    	at org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl.method(AsyncInvokerImpl.java:235)
    	at org.jboss.resteasy.reactive.client.impl.InvocationBuilderImpl.method(InvocationBuilderImpl.java:328)
    	at org.acme.BinanceLocalAgentRestClient$$QuarkusRestClientInterface.callBinanceLocalAgent(Unknown Source)
    	at org.acme.BinanceLocalAgentRestClient$$CDIWrapper.callBinanceLocalAgent(Unknown Source)
    	at org.acme.BinanceLocalAgentRestClient$$CDIWrapper_ClientProxy.callBinanceLocalAgent(Unknown Source)
    	at org.acme.WanakuAgentExecutorProducer$WanakuAgentExecutor.execute(WanakuAgentExecutorProducer.java:92)
    	at org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler$2.run(DefaultRequestHandler.java:935)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
    	at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
    	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:677)
    	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
    	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
    	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
    	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
    	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
    	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
    	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    	at java.base/java.lang.Thread.run(Thread.java:1583)
    

    on the above configuration i just made one change 1.0.0.Beta1, run the same test, all works perfect.

  14. mescaja commented on May 27, 2026

    @mescaja
    Author

    this is the AsyncManagedExecutorProducer class added to my A2A Server quarkus app. This is the version from the last pull request committed by @kabir this week.

    package org.acme;
    
    import java.util.concurrent.Executor;
    
    import jakarta.annotation.PostConstruct;
    import jakarta.annotation.Priority;
    import jakarta.enterprise.context.ApplicationScoped;
    import jakarta.enterprise.inject.Alternative;
    import jakarta.enterprise.inject.Produces;
    import jakarta.inject.Inject;
    
    import org.a2aproject.sdk.server.util.async.Internal;
    import org.eclipse.microprofile.context.ManagedExecutor;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    /**
     * Alternative executor producer that provides a ManagedExecutor with CDI context propagation.
     * <p>
     * This producer replaces the default {@code AsyncExecutorProducer} so that CDI request context
     * (and any other registered thread context types) are propagated to the agent executor thread.
     * This allows {@code @RequestScoped} beans to be injected and used inside
     * {@link org.a2aproject.sdk.server.agentexecution.AgentExecutor#execute}.
     * <p>
     * Priority 20 ensures this alternative takes precedence over the default producer (priority 10).
     *
     * @see org.eclipse.microprofile.context.ManagedExecutor
     */
    @ApplicationScoped
    @Alternative
    @Priority(20)
    public class AsyncManagedExecutorProducer {
        private static final Logger LOGGER = LoggerFactory.getLogger(AsyncManagedExecutorProducer.class);
    
        @Inject
        ManagedExecutor managedExecutor;
    
        @PostConstruct
        public void init() {
            LOGGER.info("Initializing ManagedExecutor for async operations with CDI context propagation");
            if (managedExecutor == null) {
                LOGGER.warn("ManagedExecutor not available - context propagation may not work correctly");
            }
        }
    
        @Produces
        @Internal
        public Executor produce() {
            LOGGER.debug("Using ManagedExecutor for async operations with CDI context propagation");
            if (managedExecutor == null) {
                throw new IllegalStateException("ManagedExecutor not injected - ensure MicroProfile Context Propagation is available");
            }
            return managedExecutor;
        }
    }
    
  15. 6 remaining items

  16. reopened this on May 28, 2026
  17. kabir commented on May 28, 2026

    @kabir
    Collaborator

    Let's reopen this while we work it out.

    @mescaja Would you be able to provide a small reproducer?

  18. mescaja commented on May 28, 2026

    @mescaja
    Author

    thanks @kabir, i will try put together a reproducer that spins up a keycloak instance using quarkus devservices and a protected Rest resource to echo Hello World!, all running locally. I need sometime to do this, hopefully i'll be ready today

    thanks @ehsavoie, yes, the link you provided is for the extension i am using to propagate the Bearer token from the AgentExecutor to the Rest client. The A2A client acquire an access token (issued by keycloak) which is used to authenticate the request against the A2A Server agent (exposing an AgentCard proteced with OIDC scheme), that same token get propagated downstream using quarkus-rest-client-oidc-token-propagation quarkus extension which gets triggered when rest client is annotated with @accesstoken (as show in some of the code snipped provided earlier)

  19. kabir commented on May 28, 2026

    @kabir
    Collaborator

    Hi @mescaja,

    We realized we have a sample we did for 0.3, which uses Keycloak etc. Maybe this can be a good basis for your reproducer.

    Take a look at https://github.com/kabir/a2a-samples/compare/token-investigation?expand=1. I have updated the Magic 8 Ball sample to use 1.0.0.Beta1 and 1.0.0.CR1 (separate commits).

    I also added a thing to bypass the LLM from the agent executor, so start the server with mvn quarkus:dev -Dskip.agent=true.

    It takes a while before the server is ready, even after I am able to get the agent card in my browser. But eventually the example passes with all three versions.

  20. mescaja commented on May 28, 2026

    @mescaja
    Author

    I have the reproducer ready. it consists of 3 quarkus apps (couldn't make it simpler than that). Unzip the 3 files to a local folder for instance /home/admin/A2A.

    step 1: start up keycloak

    cd /home/admin/A2A/keycloak-reproducer
    ./mvnw quarkus:dev
    

    this start up Keycloak on port 9001. You need to wait till Keycloak is fully up and running otherwise the other 2 apps won't start up due to the OIDC extension dependency on the Idp being available.

    step 2: start up A2A Server Agent

    cd /home/admin/A2A/a2a-server-agent-reproducer
    ./mvnw quarkus:dev
    

    this start up the A2A Server agent on port 8001

    step 3: start up A2A Client Agent

    cd /home/admin/A2A/a2a-client-agent-reproducer
    ./mvnw quarkus:dev
    

    this start up the A2A Client agent on port 7001

    step 4: test

    go to http://localhost:7001/keycloak/hello
    browser should be redirected to keycloak login page
    log on as bob/bob or alice/alice
    the page should render "Hello from Quarkus REST - A2A Client Agent: Hello from A2A Server Agent: Miguel"

    Step 5: reproduce the issue

    edit the pom.xml file under the a2a-server-agent-reproducer quarkus app
    reset version to 1.0.0.CR1
    Save and retest
    go to http://localhost:7001/keycloak/hello
    log on as bob/bob or alice/alice

    this error comes back

     org.a2aproject.sdk.spec.InternalError: Agent execution failed: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of PRODUCER_METHOD bean [class=io.quarkus.oidc.runtime.OidcTokenCredentialProducer, id=qPtfJ2z9Vcs78nLYoSxmBSZ461Y]
    	- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
    	at org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler$2.run(DefaultRequestHandler.java:946)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
    	at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
    	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:677)
    	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
    	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
    	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
    	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
    	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
    	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
    	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    	at java.base/java.lang.Thread.run(Thread.java:1583)
    

    i will upload the 3 quarkus apps now

  21. mescaja commented on May 28, 2026

    @mescaja
    Author

    having issue uploading the zip file

  22. mescaja commented on May 28, 2026

    @mescaja
    Author
  23. mescaja commented on May 28, 2026

    @mescaja
    Author
  24. mescaja commented on May 28, 2026

    @mescaja
    Author
  25. mescaja commented on May 28, 2026

    @mescaja
    Author

    Hi @mescaja,

    We realized we have a sample we did for 0.3, which uses Keycloak etc. Maybe this can be a good basis for your reproducer.

    Take a look at https://github.com/kabir/a2a-samples/compare/token-investigation?expand=1. I have updated the Magic 8 Ball sample to use 1.0.0.Beta1 and 1.0.0.CR1 (separate commits).

    I also added a thing to bypass the LLM from the agent executor, so start the server with mvn quarkus:dev -Dskip.agent=true.

    It takes a while before the server is ready, even after I am able to get the agent card in my browser. But eventually the example passes with all three versions.

    Thanks @kabir, i remember those examples. mostly taking artifacts form the platform i am building right now stripping things out as much as i could. Let me know if you're able to run through the reproducer fine.

  26. kabir commented on May 29, 2026

    @kabir
    Collaborator

    @mescaja It's taken some digging but I might have a fix!

    It passes for me with #902.

    There are a few things I'm not convinced about, so I'll check a few things in a fresh Claude session on Monday ;-)

  27. mescaja commented on May 31, 2026

    @mescaja
    Author

    Thanks a lot @kabir sounds like you're nearly there. i'll run a test as soon as you tell me it's all ready to go

  28. kabir commented on Jun 1, 2026

    @kabir
    Collaborator

    @mescaja I think I have fixed it properly now, see #904

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions