Skip to content

Geolocation Tool and Example Agent#252

Merged
scottpersinger merged 6 commits intosupercog-ai:mainfrom
sheaturon:tool/geolocation
Jul 31, 2025
Merged

Geolocation Tool and Example Agent#252
scottpersinger merged 6 commits intosupercog-ai:mainfrom
sheaturon:tool/geolocation

Conversation

@sheaturon
Copy link
Contributor

Adds a geolocation tool with the following capabilities:

  • Time: uses python's datetime library to get current time on the local machine.
  • Timezone: uses python's tzlocal library to get the timezone of the local machine.
  • Location: uses requests library to get ip of local machine, ip is then used in another request, which returns the following information:
    1. city
    2. region
    3. country
    4. coordinates (longitude/latitude) --> not the exact location of user, but the isp location.
    5. timezone
    6. public ip
    7. service provider

Note: gets geolocation information based on public ip of the machine it is being run on, meaning inaccuracies can occur if agent is being run by a server or if ip points to a different location (such as if a vpn is being used).

Other addition:
Very basic agent also created to test the tool, added to agentic's example agents.

@ritzz26 ritzz26 requested a review from Copilot July 10, 2025 18:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new GeolocationTool to fetch local time, timezone, and public-IP-based location; updates tool registry, packaging, and provides an example agent.

  • Introduces GeolocationTool with time, timezone, and IP-based location methods
  • Updates registry (__init__.py) and packaging (pyproject.toml) to include geolocation dependencies
  • Adds a basic example agent demonstrating the new tool

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/agentic/tools/geolocation_tool.py Implements new geolocation methods
src/agentic/tools/init.py Registers GeolocationTool in the tool registry
src/agentic/tools/init.pyi (Accidentally) deleted stub exports for many tools
pyproject.toml Added tzlocal under [geolocation] extras
examples/geolocation_agent.py Provides a sample agent for geolocation functionality
Comments suppressed due to low confidence (2)

examples/geolocation_agent.py:12

  • [nitpick] The instructions mention reporting the weather, but this agent demonstrates geolocation. Update the instructions to reflect location/time queries.
    instructions="You are a helpful assistant that reports the weather.",

@sheaturon sheaturon requested a review from ritzz26 July 11, 2025 04:50
@scottpersinger
Copy link
Collaborator

scottpersinger commented Jul 11, 2025

This is cool! Limited to getting the "agent's" location vs. the human's location... I think we put the user's timezone in the ThreadContext, but we should add the IP address as well (which we could gather server-side in the API call) then you could get the human's location as well.

I think if we added fa_request:Request to as an arg here to get the FastAPi request, we could get fa_request.client.host and add it to the TheadContext:

@agent_router.post("/{agent_name}/process")

@scottpersinger scottpersinger self-requested a review July 31, 2025 17:55
Copy link
Collaborator

@scottpersinger scottpersinger left a comment

Choose a reason for hiding this comment

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

Good enough!

@scottpersinger scottpersinger merged commit 8b4f9ad into supercog-ai:main Jul 31, 2025
2 checks passed
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.

4 participants