Skip to content

Commit ca83595

Browse files
committed
feat: add click parsing with hello-world flag
Add click parsing to codemcp/agno.py, and add a --hello-world flag which triggers the short circuited commented out agent.print_response logic. ```git-revs 89c5bd7 (Base revision) ab5a1f3 Add click import 39fa084 Add hello_world parameter to main function 21be165 Add click CLI with hello-world flag HEAD Auto-commit format changes ``` codemcp-id: 263-feat-add-click-parsing-with-hello-world-flag ghstack-source-id: 884d7e8 Pull-Request-resolved: #252
1 parent ef64fde commit ca83595

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

codemcp/agno.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Union
44
from urllib.parse import quote
55

6+
import click
67
from agno.agent import Agent
78
from agno.api.playground import PlaygroundEndpointCreate, create_playground_endpoint
89
from agno.cli.console import console
@@ -60,11 +61,12 @@ async def serve_playground_app_async(
6061
await server.serve()
6162

6263

63-
async def main():
64+
async def main(hello_world: bool = False):
6465
async with MCPTools(f"{sys.executable} -m codemcp.hot_reload_entry") as codemcp:
6566
# TODO: cli-ify the model
6667
from agno.models.anthropic import Claude
67-
#from agno.models.google import Gemini
68+
69+
# from agno.models.google import Gemini
6870
agent = Agent(
6971
model=Claude(id="claude-3-7-sonnet-20250219"),
7072
# model=Gemini(id="gemini-2.5-pro-exp-03-25"),
@@ -73,8 +75,16 @@ async def main():
7375
markdown=True,
7476
show_tool_calls=True,
7577
)
76-
# agent.print_response("What tools do you have?", stream=True, show_full_reasoning=True, stream_intermediate_steps=True)
77-
# return
78+
79+
# If --hello-world flag is used, run the short-circuited response and return
80+
if hello_world:
81+
await agent.aprint_response(
82+
"What tools do you have?",
83+
stream=True,
84+
show_full_reasoning=True,
85+
stream_intermediate_steps=True,
86+
)
87+
return
7888

7989
# Comment out the playground code
8090
# playground = Playground(agents=[agent]).get_app()
@@ -100,7 +110,12 @@ async def main():
100110
break
101111

102112

103-
if __name__ == "__main__":
113+
@click.command()
114+
@click.option(
115+
"--hello-world", is_flag=True, help="Run a simple test query to see available tools"
116+
)
117+
def cli(hello_world: bool = False):
118+
"""CLI for the Agno agent with CodeMCP integration."""
104119
from agno.debug import enable_debug_mode
105120

106121
enable_debug_mode()
@@ -111,4 +126,8 @@ async def main():
111126
logging.getLogger("anthropic").setLevel(logging.DEBUG)
112127
logging.getLogger("google_genai").setLevel(logging.DEBUG)
113128

114-
asyncio.run(main())
129+
asyncio.run(main(hello_world=hello_world))
130+
131+
132+
if __name__ == "__main__":
133+
cli()

0 commit comments

Comments
 (0)