user-robot-xmarksRunning a Custom Tool and Agent Locally

This is an example of how to run a custom tool and agent locally, independent of GLChat.

circle-exclamation
chevron-rightPrerequisiteshashtag

Installation

# you can use a Conda environment
pip install gllm-agents-binary

Running The Code

circle-info

All the code used in the following examples can be found in our GitHub repository gen-ai-examples/custom-tool-and-agentarrow-up-right.

This example uses hello_tool.pyarrow-up-right for the tool definition and hello_agent_example.pyarrow-up-right to run the agent.

git clone https://github.com/GDP-ADMIN/gen-ai-examples.git
cd gen-ai-examples/examples/custom-tool-and-agent

Set up your OPENAI_API_KEY

circle-info

Execute the script

With verbose=True, you will see the agent's thinking process, which may look like this:

> Entering new AgentExecutor chain... Invoking: `simple_hello_tool` with `{'name': 'World'}` Hello, World! > Finished chain. Hello, World!

The key indicators of success:

  • The agent initialization completes without errors

  • The verbose output shows the tool being invoked

  • The final output includes the greeting "Hello, World!"

chevron-rightTroubleshootinghashtag

For common issues and their solutions, please refer to the centralized FAQ documentarrow-up-right.

Last updated