Semantic Kernel competitor brief
- Agent pattern: Plan-and-execute agent
- Search surfaces: Web and news
- Saved artifact:
semantic-kernel-competitor-brief.md
What you’ll build
A Semantic Kernel prompt that states a research plan, resolves each open question with automatic calls to search plugins, checks the evidence quality, and writes a competitor brief with visible gaps.
Default brief: Compare three US residential solar-financing platforms using company and product facts plus recent developments. Include source URLs and unresolved evidence gaps.
How the agent works
- State the plan. The agent identifies the comparison questions before searching, making the intended research path visible.
- Resolve each question. Web and news functions are registered as a
serpapiplugin and selected automatically. - Inspect the gaps. The agent reviews evidence quality before writing the final competitor comparison.
Core agent setup
This excerpt shows how the SerpApi functions become one Semantic Kernel plugin. The complete script also configures the chat service, invokes the prompt, and saves the competitor brief.
kernel = Kernel()
kernel.add_service(
OpenAIChatCompletion(ai_model_id=MODEL, api_key=api_key),
)
kernel.add_functions(
"serpapi",
[
web_search(
provider="semantic-kernel",
allowed_engines=["google_light", "bing"],
),
news_search(provider="semantic-kernel"),
],
)
settings = OpenAIChatPromptExecutionSettings(
function_choice_behavior=FunctionChoiceBehavior.Auto(),
)
response = await kernel.invoke_prompt(
prompt,
arguments=KernelArguments(settings=settings),
)Run the recipe
Set SERPAPI_API_KEY and OPENAI_API_KEY in the repository-root .env, then run:
uv run --isolated --no-project --with 'serpapi-search-tools[semantic-kernel]' --with python-dotenv \
cookbook/semantic-kernel/main.pyOptional controls: OPENAI_MODEL, COOKBOOK_PROMPT, and COOKBOOK_OUTPUT_DIR.
Native plugin shape: The two search functions are registered with the Kernel as one plugin. Automatic function choice lets the kernel select the right evidence surface.
Inspect the result
The recipe writes cookbook-output/semantic-kernel-competitor-brief.md. Expect the research plan, a three-company comparison, product and market evidence, recent developments, source URLs, and unresolved gaps.
Replace the default solar-financing task through COOKBOOK_PROMPT while retaining the plan-and-execute process.
SerpApi tools used
web_search supplies company and product facts, while news_search tracks recent competitor developments. Both functions are registered in the serpapi plugin, helping the agent resolve stable facts and current signals through separate tool contracts.
Framework pattern: The research process follows Semantic Kernel’s Python plan-and-execute example and registers SerpApi web and news functions as plugins.