Skip to content

Conversation

@26tanishabanik
Copy link

This PR adds the missing GET /api/agents/:id, since the remote client already calls GetAgent and needs the exact config. Without it, remote mode can’t read welcome_message, hence the welcome never shows.

Fixes #973

id := c.Param("id")

src, ok := s.sm.sources[id]
if !ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove a 404 if the id isn't found, we do have the /agents so the ID should be known

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the cagent with below command:

> ./bin/cagent api examples/welcome_message.yaml
Listening on [::]:8080
{"time":"2025-12-08T14:42:03.689901+05:30","id":"","remote_ip":"::1","host":"localhost:8080","method":"POST","uri":"/api/sessions","user_agent":"Go-http-client/1.1","status":200,"error":"","latency":841333,"latency_human":"841.333µs","bytes_in":228,"bytes_out":230}
Fetching agent with ID: examples/welcome_message.yaml
Agent found? false
{"time":"2025-12-08T14:42:03.691819+05:30","id":"","remote_ip":"::1","host":"localhost:8080","method":"GET","uri":"/api/agents/examples/welcome_message.yaml","user_agent":"Go-http-client/1.1","status":200,"error":"","latency":439000,"latency_human":"439µs","bytes_in":0,"bytes_out":736}
Fetching agent with ID: examples/welcome_message.yaml
Agent found? false
{"time":"2025-12-08T14:42:03.694068+05:30","id":"","remote_ip":"::1","host":"localhost:8080","method":"GET","uri":"/api/agents/examples/welcome_message.yaml","user_agent":"Go-http-client/1.1","status":200,"error":"","latency":216833,"latency_human":"216.833µs","bytes_in":0,"bytes_out":736}

And then sent a request like this:

./bin/cagent run --remote http://localhost:8080 examples/welcome_message.yaml

Without the first !ok block, the welcome message doesn't come, do you want me to just remove the second !ok block? @rumpl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would actually need something like this: #1046

Basically it would seem that our urls are not defined as they should

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the code

…t instead of a separate agent by id endpoint and adds supporting unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Welcome message doesn't show in remote mode

2 participants